summaryrefslogtreecommitdiffstats
path: root/tools/qmldebugger/main.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-26 00:03:08 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-26 00:03:08 (GMT)
commitabb9a3b5031e86bdd89a9338c4f12d703e6f385b (patch)
tree2d0fb9eb222885a15ee06e486e7400cdedcc0a92 /tools/qmldebugger/main.cpp
parent7f43bd48595025961989fcd51bee0271a275b475 (diff)
downloadQt-abb9a3b5031e86bdd89a9338c4f12d703e6f385b.zip
Qt-abb9a3b5031e86bdd89a9338c4f12d703e6f385b.tar.gz
Qt-abb9a3b5031e86bdd89a9338c4f12d703e6f385b.tar.bz2
Move canvas scene snapshot out of in-process debugger
Diffstat (limited to 'tools/qmldebugger/main.cpp')
-rw-r--r--tools/qmldebugger/main.cpp56
1 files changed, 45 insertions, 11 deletions
diff --git a/tools/qmldebugger/main.cpp b/tools/qmldebugger/main.cpp
index 2c5be6c..5b94cbb 100644
--- a/tools/qmldebugger/main.cpp
+++ b/tools/qmldebugger/main.cpp
@@ -8,11 +8,13 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qdatastream.h>
#include "canvasframerate.h"
+#include "canvasscene.h"
#include <QVBoxLayout>
#include <QPushButton>
#include <QLineEdit>
#include <QTabWidget>
#include <QSpinBox>
+#include <QLabel>
class Shell : public QWidget
{
@@ -23,10 +25,12 @@ public:
private slots:
void connectToHost();
void disconnectFromHost();
+ void connectionStateChanged();
private:
QmlDebugClient client;
+ QLabel *m_connectionState;
QLineEdit *m_host;
QSpinBox *m_port;
QPushButton *m_connectButton;
@@ -44,8 +48,10 @@ Shell::Shell(QWidget *parent)
layout->addLayout(connectLayout);
connectLayout->addStretch(2);
+ m_connectionState = new QLabel(this);
+ connectLayout->addWidget(m_connectionState);
m_host = new QLineEdit(this);
- m_host->setText("localhost");
+ m_host->setText("127.0.0.1");
connectLayout->addWidget(m_host);
m_port = new QSpinBox(this);
m_port->setMinimum(1024);
@@ -67,33 +73,61 @@ Shell::Shell(QWidget *parent)
CanvasFrameRate *cfr = new CanvasFrameRate(&client, this);
tabs->addTab(cfr, tr("Frame Rate"));
+
+ CanvasScene *cs = new CanvasScene(&client, this);
+ tabs->addTab(cs, tr("Scene"));
+
+ QObject::connect(&client, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(connectionStateChanged()));
+ connectionStateChanged();
+}
+
+void Shell::connectionStateChanged()
+{
+ switch (client.state()) {
+ default:
+ case QAbstractSocket::UnconnectedState:
+ m_connectionState->setText(tr("Disconnected"));
+ m_connectButton->setEnabled(true);
+ m_disconnectButton->setEnabled(false);
+ break;
+ case QAbstractSocket::HostLookupState:
+ m_connectionState->setText(tr("Resolving"));
+ m_connectButton->setEnabled(false);
+ m_disconnectButton->setEnabled(true);
+ break;
+ case QAbstractSocket::ConnectingState:
+ m_connectionState->setText(tr("Connecting"));
+ m_connectButton->setEnabled(false);
+ m_disconnectButton->setEnabled(true);
+ break;
+ case QAbstractSocket::ConnectedState:
+ m_connectionState->setText(tr("Connected"));
+ m_connectButton->setEnabled(false);
+ m_disconnectButton->setEnabled(true);
+ break;
+ case QAbstractSocket::ClosingState:
+ m_connectionState->setText(tr("Closing"));
+ m_connectButton->setEnabled(false);
+ m_disconnectButton->setEnabled(false);
+ break;
+ }
}
void Shell::connectToHost()
{
- m_connectButton->setEnabled(false);
- m_disconnectButton->setEnabled(true);
client.connectToHost(m_host->text(), m_port->value());
}
void Shell::disconnectFromHost()
{
- m_connectButton->setEnabled(true);
- m_disconnectButton->setEnabled(false);
client.disconnectFromHost();
}
int main(int argc, char ** argv)
{
- if(argc != 3) {
- qWarning() << "Usage:" << argv[0] << "host port";
- return -1;
- }
-
QApplication app(argc, argv);
Shell shell;
-// shell.setFixedSize(1024, 768);
shell.show();