Commit ba82227a authored by Kai Koehne's avatar Kai Koehne
Browse files

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

parent 580fbb1a
...@@ -75,6 +75,8 @@ public Q_SLOTS: ...@@ -75,6 +75,8 @@ public Q_SLOTS:
void contextPathUpdated(const QStringList &contextPath); void contextPathUpdated(const QStringList &contextPath);
Q_SIGNALS: Q_SIGNALS:
void debuggingClientChanged(bool hasDebuggingClient);
void currentObjectsChanged(const QList<QObject*> &objects); void currentObjectsChanged(const QList<QObject*> &objects);
void designModeBehaviorChanged(bool inDesignMode); void designModeBehaviorChanged(bool inDesignMode);
void reloadRequested(); void reloadRequested();
...@@ -96,6 +98,7 @@ Q_SIGNALS: ...@@ -96,6 +98,7 @@ Q_SIGNALS:
void clearComponentCacheRequested(); void clearComponentCacheRequested();
protected: protected:
virtual void enabledChanged(bool enabled);
virtual void messageReceived(const QByteArray &); virtual void messageReceived(const QByteArray &);
private: private:
......
...@@ -58,6 +58,11 @@ QDeclarativeDesignDebugServer *QDeclarativeDesignDebugServer::instance() ...@@ -58,6 +58,11 @@ QDeclarativeDesignDebugServer *QDeclarativeDesignDebugServer::instance()
return qmlDesignDebugServer(); return qmlDesignDebugServer();
} }
void QDeclarativeDesignDebugServer::enabledChanged(bool enabled)
{
emit debuggingClientChanged(enabled);
}
void QDeclarativeDesignDebugServer::messageReceived(const QByteArray &message) void QDeclarativeDesignDebugServer::messageReceived(const QByteArray &message)
{ {
QDataStream ds(message); QDataStream ds(message);
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#endif #endif
#include <qdeclarativedesignview.h> #include <qdeclarativedesignview.h>
#include <qdeclarativedesigndebugserver.h>
#include <utils/crumblepath.h> #include <utils/crumblepath.h>
#include "qmlruntime.h" #include "qmlruntime.h"
...@@ -785,8 +786,10 @@ void QDeclarativeViewer::createMenu() ...@@ -785,8 +786,10 @@ void QDeclarativeViewer::createMenu()
designModeBehaviorAction->setShortcut(QKeySequence("Ctrl+D")); designModeBehaviorAction->setShortcut(QKeySequence("Ctrl+D"));
designModeBehaviorAction->setCheckable(true); designModeBehaviorAction->setCheckable(true);
designModeBehaviorAction->setChecked(canvas->designModeBehavior()); designModeBehaviorAction->setChecked(canvas->designModeBehavior());
designModeBehaviorAction->setEnabled(QDeclarativeDesignDebugServer::hasDebuggingClient());
connect(designModeBehaviorAction, SIGNAL(triggered(bool)), this, SLOT(setDesignModeBehavior(bool))); connect(designModeBehaviorAction, SIGNAL(triggered(bool)), this, SLOT(setDesignModeBehavior(bool)));
connect(canvas, SIGNAL(designModeBehaviorChanged(bool)), designModeBehaviorAction, SLOT(setChecked(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); QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this);
connect(proxyAction, SIGNAL(triggered()), this, SLOT(showProxySettings())); connect(proxyAction, SIGNAL(triggered()), this, SLOT(showProxySettings()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment