QmlObserver: Disable "Observer" mode when no debugging client is attached

This commit is contained in:
Kai Koehne
2010-09-02 14:40:13 +02:00
parent 580fbb1ae5
commit ba82227ae8
3 changed files with 11 additions and 0 deletions
@@ -75,6 +75,8 @@ public Q_SLOTS:
void contextPathUpdated(const QStringList &contextPath);
Q_SIGNALS:
void debuggingClientChanged(bool hasDebuggingClient);
void currentObjectsChanged(const QList<QObject*> &objects);
void designModeBehaviorChanged(bool inDesignMode);
void reloadRequested();
@@ -96,6 +98,7 @@ Q_SIGNALS:
void clearComponentCacheRequested();
protected:
virtual void enabledChanged(bool enabled);
virtual void messageReceived(const QByteArray &);
private:
@@ -58,6 +58,11 @@ QDeclarativeDesignDebugServer *QDeclarativeDesignDebugServer::instance()
return qmlDesignDebugServer();
}
void QDeclarativeDesignDebugServer::enabledChanged(bool enabled)
{
emit debuggingClientChanged(enabled);
}
void QDeclarativeDesignDebugServer::messageReceived(const QByteArray &message)
{
QDataStream ds(message);
+3
View File
@@ -55,6 +55,7 @@
#endif
#include <qdeclarativedesignview.h>
#include <qdeclarativedesigndebugserver.h>
#include <utils/crumblepath.h>
#include "qmlruntime.h"
@@ -785,8 +786,10 @@ void QDeclarativeViewer::createMenu()
designModeBehaviorAction->setShortcut(QKeySequence("Ctrl+D"));
designModeBehaviorAction->setCheckable(true);
designModeBehaviorAction->setChecked(canvas->designModeBehavior());
designModeBehaviorAction->setEnabled(QDeclarativeDesignDebugServer::hasDebuggingClient());
connect(designModeBehaviorAction, SIGNAL(triggered(bool)), this, SLOT(setDesignModeBehavior(bool)));
connect(canvas, SIGNAL(designModeBehaviorChanged(bool)), designModeBehaviorAction, SLOT(setChecked(bool)));
connect(QDeclarativeDesignDebugServer::instance(), SIGNAL(debuggingClientChanged(bool)), designModeBehaviorAction, SLOT(setEnabled(bool)));
QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this);
connect(proxyAction, SIGNAL(triggered()), this, SLOT(showProxySettings()));