summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorChristiaan Janssen <christiaan.janssen@nokia.com>2011-04-14 15:23:17 +0200
committerChristiaan Janssen <christiaan.janssen@nokia.com>2011-04-14 15:25:58 +0200
commitfa2b29426410e9db9678771b3da38aa31610b590 (patch)
tree193d9a1bfb9dc4936e78c33da4be90cbd1a5d98f /src/plugins
parentd613c057d58bd913f0d88b1c1947c7cd9b78f2b1 (diff)
downloadqt-creator-fa2b29426410e9db9678771b3da38aa31610b590.tar.gz
QmlProfiler: stop timer on failed connection
Reviewed-by: Kai Koehne
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerengine.cpp10
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp12
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.h1
-rw-r--r--src/plugins/qmlprofiler/tracewindow.cpp21
-rw-r--r--src/plugins/qmlprofiler/tracewindow.h2
5 files changed, 23 insertions, 23 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
index 5314867488..06bb1647ae 100644
--- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
@@ -102,7 +102,6 @@ void QmlProfilerEngine::start()
void QmlProfilerEngine::stop()
{
- d->m_running = false;
if (d->m_fetchingData)
emit stopRecording();
else
@@ -116,14 +115,15 @@ void QmlProfilerEngine::spontaneousStop()
emit finished();
}
-void QmlProfilerEngine::setFetchingData(bool b) {
+void QmlProfilerEngine::setFetchingData(bool b)
+{
d->m_fetchingData = b;
- }
+}
void QmlProfilerEngine::finishProcess()
{
- // user stop?
- if (!d->m_running) {
+ if (d->m_running) {
+ d->m_running = false;
if (d->m_process) {
disconnect(d->m_process,SIGNAL(finished(int)),this,SLOT(spontaneousStop()));
if (d->m_process->state() == QProcess::Running) {
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index 60f53c31ca..7f1c382321 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -123,6 +123,7 @@ public:
bool m_isAttached;
QAction *m_attachAction;
QToolButton *m_recordButton;
+ bool m_recordingEnabled;
};
QmlProfilerTool::QmlProfilerTool(QObject *parent)
@@ -135,6 +136,7 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
d->m_runConfiguration = 0;
d->m_isAttached = false;
d->m_attachAction = 0;
+ d->m_recordingEnabled = true;
}
QmlProfilerTool::~QmlProfilerTool()
@@ -180,6 +182,7 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
connect(engine, SIGNAL(finished()), this, SLOT(disconnectClient()));
connect(engine, SIGNAL(stopRecording()), this, SLOT(stopRecording()));
connect(d->m_traceWindow, SIGNAL(viewUpdated()), engine, SLOT(finishProcess()));
+ connect(this, SIGNAL(connectionFailed()), engine, SLOT(finishProcess()));
connect(this, SIGNAL(fetchingData(bool)), engine, SLOT(setFetchingData(bool)));
emit fetchingData(d->m_recordButton->isChecked());
@@ -292,11 +295,14 @@ void QmlProfilerTool::connectClient()
d->m_client->waitForConnected();
if (d->m_client->isConnected()) {
+ d->m_traceWindow->setRecording(d->m_recordingEnabled);
if (QmlProfilerPlugin::debugOutput)
qWarning("QmlProfiler: connected and running");
} else {
+ d->m_traceWindow->setRecording(false);
if (QmlProfilerPlugin::debugOutput)
qWarning("QmlProfiler: Failed to connect: %s", qPrintable(d->m_client->errorString()));
+ emit connectionFailed();
}
if (d->m_traceWindow->isRecording())
@@ -311,7 +317,6 @@ void QmlProfilerTool::disconnectClient()
void QmlProfilerTool::startRecording()
{
- d->m_traceWindow->setRecordAtStart(true);
if (d->m_client->isConnected()) {
clearDisplay();
d->m_traceWindow->setRecording(true);
@@ -321,14 +326,13 @@ void QmlProfilerTool::startRecording()
void QmlProfilerTool::stopRecording()
{
- d->m_traceWindow->setRecordAtStart(d->m_recordButton->isChecked());
- if (d->m_client->isConnected())
- d->m_traceWindow->setRecording(false);
+ d->m_traceWindow->setRecording(false);
emit fetchingData(false);
}
void QmlProfilerTool::setRecording(bool recording)
{
+ d->m_recordingEnabled = recording;
if (recording)
startRecording();
else
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h
index f7d12972d7..5e7ec67c00 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.h
+++ b/src/plugins/qmlprofiler/qmlprofilertool.h
@@ -79,6 +79,7 @@ public slots:
signals:
void setTimeLabel(const QString &);
void fetchingData(bool);
+ void connectionFailed();
public:
// Todo: configurable parameters
diff --git a/src/plugins/qmlprofiler/tracewindow.cpp b/src/plugins/qmlprofiler/tracewindow.cpp
index 8c3f3dbb26..4b726103a5 100644
--- a/src/plugins/qmlprofiler/tracewindow.cpp
+++ b/src/plugins/qmlprofiler/tracewindow.cpp
@@ -161,10 +161,14 @@ void TracePlugin::setRecording(bool v)
{
if (v == m_recording)
return;
- QByteArray ba;
- QDataStream stream(&ba, QIODevice::WriteOnly);
- stream << v;
- sendMessage(ba);
+
+ if (status() == Enabled) {
+ QByteArray ba;
+ QDataStream stream(&ba, QIODevice::WriteOnly);
+ stream << v;
+ sendMessage(ba);
+ }
+
m_recording = v;
emit recordingChanged(v);
}
@@ -262,7 +266,7 @@ void TracePlugin::messageReceived(const QByteArray &data)
TraceWindow::TraceWindow(QWidget *parent)
: QWidget(parent),
- m_plugin(0), m_recordAtStart(false)
+ m_plugin(0)
{
setObjectName(tr("Qml Performance Monitor"));
@@ -300,8 +304,6 @@ void TraceWindow::reset(QDeclarativeDebugConnection *conn)
m_plugin = new TracePlugin(conn);
connect(m_plugin,SIGNAL(complete()), this, SIGNAL(viewUpdated()));
connect(m_plugin,SIGNAL(range(int,qint64,qint64,QStringList,QString,int)),this,SIGNAL(range(int,qint64,qint64,QStringList,QString,int)));
- if (m_recordAtStart)
- m_plugin->setRecording(true);
m_view->rootContext()->setContextProperty("connection", m_plugin);
m_view->setSource(QUrl("qrc:/qmlprofiler/MainView.qml"));
@@ -327,11 +329,6 @@ void TraceWindow::clearDisplay()
m_plugin->clearView();
}
-void TraceWindow::setRecordAtStart(bool record)
-{
- m_recordAtStart = record;
-}
-
void TraceWindow::setRecording(bool recording)
{
m_plugin->setRecording(recording);
diff --git a/src/plugins/qmlprofiler/tracewindow.h b/src/plugins/qmlprofiler/tracewindow.h
index 4f0fb72e8d..1ea7fa6d70 100644
--- a/src/plugins/qmlprofiler/tracewindow.h
+++ b/src/plugins/qmlprofiler/tracewindow.h
@@ -63,7 +63,6 @@ public:
~TraceWindow();
void reset(QDeclarativeDebugConnection *conn);
- void setRecordAtStart(bool record);
void setRecording(bool recording);
bool isRecording() const;
@@ -82,7 +81,6 @@ signals:
private:
TracePlugin *m_plugin;
QSize m_sizeHint;
- bool m_recordAtStart;
QDeclarativeView *m_view;
};