QmlJSInspector: Renamed Observer to Inspector

Manually redid Qt 4.8 commit 206ebd5af21d94c3f3b49d2cb645105a63e6f5fb,
to make future code synchronization easier.

In order not to have to change the QmlApplicationViewer again, a
compatibility class QDeclarativeViewObserver is retained that subclasses
QDeclarativeViewInspector.

Change-Id: Ief87ae2f8f76b1db0c9d65085e4832424b277603
Reviewed-on: http://codereview.qt.nokia.com/242
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Thorbjørn Lindeijer
2011-05-30 16:32:25 +02:00
committed by Kai Koehne
parent e0f79761f3
commit 335f6ad0f7
51 changed files with 528 additions and 474 deletions

View File

@@ -54,8 +54,8 @@
#include <private/qabstractanimation_p.h>
#endif
#include <qdeclarativeviewobserver.h>
#include <qdeclarativeobserverservice.h>
#include <qdeclarativeviewinspector.h>
#include <qdeclarativeinspectorservice.h>
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QNetworkCookieJar>
@@ -648,7 +648,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
}
canvas = new DragAndDropView(this);
observer = new QmlJSDebugger::QDeclarativeViewObserver(canvas, this);
inspector = new QmlJSDebugger::QDeclarativeViewInspector(canvas, this);
new QmlJSDebugger::JSDebuggerAgent(canvas->engine());
canvas->setAttribute(Qt::WA_OpaquePaintEvent);
@@ -698,7 +698,7 @@ void QDeclarativeViewer::setDesignModeBehavior(bool value)
{
if (designModeBehaviorAction)
designModeBehaviorAction->setChecked(value);
observer->setDesignModeBehavior(value);
inspector->setDesignModeBehavior(value);
}
void QDeclarativeViewer::enableExperimentalGestures()
@@ -777,7 +777,7 @@ void QDeclarativeViewer::createMenu()
speedAction->setData(10.0f);
playSpeedMenuActions->addAction(speedAction);
pauseAnimationsAction = playSpeedMenu->addAction(tr("Pause"), observer, SLOT(setAnimationPaused(bool)));
pauseAnimationsAction = playSpeedMenu->addAction(tr("Pause"), inspector, SLOT(setAnimationPaused(bool)));
pauseAnimationsAction->setCheckable(true);
pauseAnimationsAction->setShortcut(QKeySequence("Ctrl+."));
@@ -790,30 +790,30 @@ void QDeclarativeViewer::createMenu()
QAction *playSpeedAction = new QAction(tr("Animations"), this);
playSpeedAction->setMenu(playSpeedMenu);
connect(observer, SIGNAL(animationSpeedChanged(qreal)), SLOT(animationSpeedChanged(qreal)));
connect(observer, SIGNAL(animationPausedChanged(bool)), pauseAnimationsAction, SLOT(setChecked(bool)));
connect(inspector, SIGNAL(animationSpeedChanged(qreal)), SLOT(animationSpeedChanged(qreal)));
connect(inspector, SIGNAL(animationPausedChanged(bool)), pauseAnimationsAction, SLOT(setChecked(bool)));
showWarningsWindow = new QAction(tr("Show Warnings"), this);
showWarningsWindow->setCheckable((true));
showWarningsWindow->setChecked(loggerWindow->isVisible());
connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool)));
designModeBehaviorAction = new QAction(tr("&Observer Mode"), this);
designModeBehaviorAction = new QAction(tr("&Inspector Mode"), this);
designModeBehaviorAction->setShortcut(QKeySequence("Ctrl+D"));
designModeBehaviorAction->setCheckable(true);
designModeBehaviorAction->setChecked(observer->designModeBehavior());
designModeBehaviorAction->setEnabled(QmlJSDebugger::QDeclarativeObserverService::hasDebuggingClient());
designModeBehaviorAction->setChecked(inspector->designModeBehavior());
designModeBehaviorAction->setEnabled(QmlJSDebugger::QDeclarativeInspectorService::hasDebuggingClient());
connect(designModeBehaviorAction, SIGNAL(triggered(bool)), this, SLOT(setDesignModeBehavior(bool)));
connect(observer, SIGNAL(designModeBehaviorChanged(bool)), designModeBehaviorAction, SLOT(setChecked(bool)));
connect(QmlJSDebugger::QDeclarativeObserverService::instance(), SIGNAL(debuggingClientChanged(bool)),
connect(inspector, SIGNAL(designModeBehaviorChanged(bool)), designModeBehaviorAction, SLOT(setChecked(bool)));
connect(QmlJSDebugger::QDeclarativeInspectorService::instance(), SIGNAL(debuggingClientChanged(bool)),
designModeBehaviorAction, SLOT(setEnabled(bool)));
appOnTopAction = new QAction(tr("Keep Window on Top"), this);
appOnTopAction->setCheckable(true);
appOnTopAction->setChecked(observer->showAppOnTop());
appOnTopAction->setChecked(inspector->showAppOnTop());
connect(appOnTopAction, SIGNAL(triggered(bool)), observer, SLOT(setShowAppOnTop(bool)));
connect(observer, SIGNAL(showAppOnTopChanged(bool)), appOnTopAction, SLOT(setChecked(bool)));
connect(appOnTopAction, SIGNAL(triggered(bool)), inspector, SLOT(setShowAppOnTop(bool)));
connect(inspector, SIGNAL(showAppOnTopChanged(bool)), appOnTopAction, SLOT(setChecked(bool)));
QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this);
connect(proxyAction, SIGNAL(triggered()), this, SLOT(showProxySettings()));
@@ -1070,12 +1070,12 @@ void QDeclarativeViewer::toggleRecording()
void QDeclarativeViewer::pauseAnimations()
{
observer->setAnimationPaused(true);
inspector->setAnimationPaused(true);
}
void QDeclarativeViewer::stepAnimations()
{
observer->setAnimationPaused(false);
inspector->setAnimationPaused(false);
QTimer::singleShot(m_stepSize, this, SLOT(pauseAnimations()));
}
@@ -1090,7 +1090,7 @@ void QDeclarativeViewer::setAnimationStep()
void QDeclarativeViewer::changeAnimationSpeed()
{
if (QAction *action = qobject_cast<QAction*>(sender()))
observer->setAnimationSpeed(action->data().toFloat());
inspector->setAnimationSpeed(action->data().toFloat());
}
void QDeclarativeViewer::addLibraryPath(const QString& lib)