summaryrefslogtreecommitdiffstats
path: root/tools/qmldebugger
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2009-10-08 05:09:39 (GMT)
committerBea Lam <bea.lam@nokia.com>2009-10-08 05:09:39 (GMT)
commite795864872095d2179a3639403343ade3daf61c7 (patch)
tree9406ae1d1415bfc1f3c4a563465cfb53a47683c5 /tools/qmldebugger
parentf149107f3281fd537c98aaac5cba5934d55aa78a (diff)
downloadQt-e795864872095d2179a3639403343ade3daf61c7.zip
Qt-e795864872095d2179a3639403343ade3daf61c7.tar.gz
Qt-e795864872095d2179a3639403343ade3daf61c7.tar.bz2
Add command line options.
Diffstat (limited to 'tools/qmldebugger')
-rw-r--r--tools/qmldebugger/main.cpp49
1 files changed, 43 insertions, 6 deletions
diff --git a/tools/qmldebugger/main.cpp b/tools/qmldebugger/main.cpp
index 7fabfb7..ccd3761 100644
--- a/tools/qmldebugger/main.cpp
+++ b/tools/qmldebugger/main.cpp
@@ -23,9 +23,15 @@ Q_OBJECT
public:
Shell(QWidget * = 0);
-private slots:
+ void setHost(const QString &host);
+ void setPort(quint16 port);
+ void showEngineTab();
+
+public slots:
void connectToHost();
void disconnectFromHost();
+
+private slots:
void connectionStateChanged();
private:
@@ -38,6 +44,7 @@ private:
QPushButton *m_disconnectButton;
EnginePane *m_enginePane;
+ QTabWidget *m_tabs;
};
Shell::Shell(QWidget *parent)
@@ -71,19 +78,34 @@ Shell::Shell(QWidget *parent)
m_disconnectButton->setEnabled(false);
connectLayout->addWidget(m_disconnectButton);
- QTabWidget *tabs = new QTabWidget(this);
- layout->addWidget(tabs);
+ m_tabs = new QTabWidget(this);
+ layout->addWidget(m_tabs);
CanvasFrameRate *cfr = new CanvasFrameRate(&client, this);
- tabs->addTab(cfr, tr("Frame Rate"));
+ m_tabs->addTab(cfr, tr("Frame Rate"));
m_enginePane = new EnginePane(&client, this);
- tabs->addTab(m_enginePane, tr("QML Engine"));
+ m_tabs->addTab(m_enginePane, tr("QML Engine"));
QObject::connect(&client, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(connectionStateChanged()));
connectionStateChanged();
}
+void Shell::setHost(const QString &host)
+{
+ m_host->setText(host);
+}
+
+void Shell::setPort(quint16 port)
+{
+ m_port->setValue(port);
+}
+
+void Shell::showEngineTab()
+{
+ m_tabs->setCurrentWidget(m_enginePane);
+}
+
void Shell::connectionStateChanged()
{
switch (client.state()) {
@@ -132,9 +154,24 @@ int main(int argc, char ** argv)
{
QApplication app(argc, argv);
+ QStringList args = app.arguments();
+
Shell shell;
- shell.show();
+ if (args.contains("--engine"))
+ shell.showEngineTab();
+
+ if (args.count() > 1 && args.at(1).contains(':')) {
+ QStringList hostAndPort = args.at(1).split(':');
+ bool ok = false;
+ quint16 port = hostAndPort[1].toInt(&ok);
+ if (ok) {
+ shell.setHost(hostAndPort[0]);
+ shell.setPort(port);
+ shell.connectToHost();
+ }
+ }
+ shell.show();
return app.exec();
}