Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
fa2b2942
Commit
fa2b2942
authored
Apr 14, 2011
by
Christiaan Janssen
Browse files
QmlProfiler: stop timer on failed connection
Reviewed-by: Kai Koehne
parent
d613c057
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmlprofiler/qmlprofilerengine.cpp
View file @
fa2b2942
...
...
@@ -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
)
{
...
...
src/plugins/qmlprofiler/qmlprofilertool.cpp
View file @
fa2b2942
...
...
@@ -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
...
...
src/plugins/qmlprofiler/qmlprofilertool.h
View file @
fa2b2942
...
...
@@ -79,6 +79,7 @@ public slots:
signals:
void
setTimeLabel
(
const
QString
&
);
void
fetchingData
(
bool
);
void
connectionFailed
();
public:
// Todo: configurable parameters
...
...
src/plugins/qmlprofiler/tracewindow.cpp
View file @
fa2b2942
...
...
@@ -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
);
...
...
src/plugins/qmlprofiler/tracewindow.h
View file @
fa2b2942
...
...
@@ -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
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment