Skip to content
Snippets Groups Projects
Commit d16e7a30 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

QmlJSDebugger: Only show the tool box when a debugging client connected

Reviewed-by: Christiaan Janssen
parent 64c32469
No related branches found
No related tags found
No related merge requests found
...@@ -70,6 +70,7 @@ QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeVie ...@@ -70,6 +70,7 @@ QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeVie
executionPaused(false), executionPaused(false),
slowdownFactor(1.0f), slowdownFactor(1.0f),
toolBar(0), toolBar(0),
toolBox(0),
settings(0) settings(0)
{ {
} }
...@@ -105,6 +106,10 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje ...@@ -105,6 +106,10 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje
data->setViewport(data->view->viewport()); data->setViewport(data->view->viewport());
data->debugService = QDeclarativeObserverService::instance(); data->debugService = QDeclarativeObserverService::instance();
connect(data->debugService, SIGNAL(debuggingClientChanged(bool)),
data.data(), SLOT(_q_setToolBoxVisible(bool)));
connect(data->debugService, SIGNAL(designModeBehaviorChanged(bool)), connect(data->debugService, SIGNAL(designModeBehaviorChanged(bool)),
SLOT(setDesignModeBehavior(bool))); SLOT(setDesignModeBehavior(bool)));
connect(data->debugService, SIGNAL(showAppOnTopChanged(bool)), connect(data->debugService, SIGNAL(showAppOnTopChanged(bool)),
...@@ -146,10 +151,6 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje ...@@ -146,10 +151,6 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje
connect(data->subcomponentEditorTool, SIGNAL(contextPathChanged(QStringList)), connect(data->subcomponentEditorTool, SIGNAL(contextPathChanged(QStringList)),
data->debugService, SLOT(contextPathUpdated(QStringList))); data->debugService, SLOT(contextPathUpdated(QStringList)));
#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5)
data->createToolBox();
#endif
data->_q_changeToSingleSelectTool(); data->_q_changeToSingleSelectTool();
} }
...@@ -166,6 +167,16 @@ void QDeclarativeViewObserver::setObserverContext(int contextIndex) ...@@ -166,6 +167,16 @@ void QDeclarativeViewObserver::setObserverContext(int contextIndex)
} }
} }
void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible)
{
#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5)
if (!toolBox && visible)
createToolBox();
if (toolBox)
toolBox->setVisible(visible);
#endif
}
void QDeclarativeViewObserverPrivate::_q_reloadView() void QDeclarativeViewObserverPrivate::_q_reloadView()
{ {
subcomponentEditorTool->clear(); subcomponentEditorTool->clear();
...@@ -906,14 +917,13 @@ void QDeclarativeViewObserverPrivate::createToolBox() ...@@ -906,14 +917,13 @@ void QDeclarativeViewObserverPrivate::createToolBox()
verticalLayout->setMargin(0); verticalLayout->setMargin(0);
verticalLayout->addWidget(toolBar); verticalLayout->addWidget(toolBar);
QWidget *toolBox = new QWidget(q->declarativeView(), Qt::Tool); toolBox = new QWidget(q->declarativeView(), Qt::Tool);
toolBox->setWindowFlags((toolBox->windowFlags() & ~Qt::WindowCloseButtonHint) toolBox->setWindowFlags((toolBox->windowFlags() & ~Qt::WindowCloseButtonHint)
| Qt::CustomizeWindowHint); | Qt::CustomizeWindowHint);
toolBox->setWindowTitle(tr("Qt Quick Toolbox")); toolBox->setWindowTitle(tr("Qt Quick Toolbox"));
toolBox->setLayout(verticalLayout); toolBox->setLayout(verticalLayout);
toolBox->restoreGeometry(settings->value(QLatin1String(KEY_TOOLBOX_GEOMETRY)).toByteArray()); toolBox->restoreGeometry(settings->value(QLatin1String(KEY_TOOLBOX_GEOMETRY)).toByteArray());
toolBox->show();
} }
} //namespace QmlJSDebugger } //namespace QmlJSDebugger
...@@ -94,6 +94,7 @@ public: ...@@ -94,6 +94,7 @@ public:
qreal slowdownFactor; qreal slowdownFactor;
QmlToolBar *toolBar; QmlToolBar *toolBar;
QWidget *toolBox;
QSettings *settings; QSettings *settings;
void setViewport(QWidget *widget); void setViewport(QWidget *widget);
...@@ -127,6 +128,8 @@ public: ...@@ -127,6 +128,8 @@ public:
void enterContext(QGraphicsItem *itemToEnter); void enterContext(QGraphicsItem *itemToEnter);
public slots: public slots:
void _q_setToolBoxVisible(bool visible);
void _q_reloadView(); void _q_reloadView();
void _q_onStatusChanged(QDeclarativeView::Status status); void _q_onStatusChanged(QDeclarativeView::Status status);
void _q_onCurrentObjectsChanged(QList<QObject*> objects); void _q_onCurrentObjectsChanged(QList<QObject*> objects);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment