summaryrefslogtreecommitdiff
path: root/src/plugins/qmlprofiler
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-07-25 13:57:13 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-07-25 13:57:13 +0200
commitae8ac2eb2f118cfb96efec7a40aa8d55be2704ee (patch)
treefd36ac3e15c7c243d890d5e91544af5307f8c9fc /src/plugins/qmlprofiler
parent76a5b1953ca230d813340a9d536d636aacd0929b (diff)
parent899cc0300336a51f0d553c10d0769b145f99af00 (diff)
downloadqt-creator-ae8ac2eb2f118cfb96efec7a40aa8d55be2704ee.tar.gz
Merge branch '2.3'
Conflicts: qtcreator.pri src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp src/plugins/remotelinux/maemodeploystepfactory.cpp src/plugins/remotelinux/maemodirectdeviceuploadstep.cpp Change-Id: I195163713145e72df20aec4ac9058f0c9158083e
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r--src/plugins/qmlprofiler/localqmlprofilerrunner.h2
-rw-r--r--src/plugins/qmlprofiler/qml/MainView.qml35
-rw-r--r--src/plugins/qmlprofiler/qml/RangeMover.qml12
-rw-r--r--src/plugins/qmlprofiler/qml/StatusDisplay.qml4
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerengine.cpp41
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerengine.h1
-rw-r--r--src/plugins/qmlprofiler/qmlprofilereventview.cpp24
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp3
8 files changed, 89 insertions, 33 deletions
diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.h b/src/plugins/qmlprofiler/localqmlprofilerrunner.h
index 176416bf34..d7bf9393f5 100644
--- a/src/plugins/qmlprofiler/localqmlprofilerrunner.h
+++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.h
@@ -61,6 +61,8 @@ public:
virtual void stop();
virtual int debugPort() const;
+ bool hasExecutable() const { return !m_configuration.executable.isEmpty(); }
+
private slots:
void spontaneousStop(int exitCode);
diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml
index 8664ed5b7f..ff4bc99f3d 100644
--- a/src/plugins/qmlprofiler/qml/MainView.qml
+++ b/src/plugins/qmlprofiler/qml/MainView.qml
@@ -173,6 +173,7 @@ Rectangle {
property real elapsedTime;
signal updateTimer;
Timer {
+ id: elapsedTimer
property date startDate
property bool reset: true
running: connection.recording
@@ -303,18 +304,34 @@ Rectangle {
rangeDetails.line = line
rangeDetails.type = Plotter.names[type]
- var pos = mapToItem(rangeDetails.parent, x, y+height)
- var preferredX = Math.max(10, pos.x - rangeDetails.width/2)
- if (preferredX + rangeDetails.width > rangeDetails.parent.width)
- preferredX = rangeDetails.parent.width - rangeDetails.width
+ var margin = 10;
+
+ var pos = mapToItem(rangeDetails.parent , x, y)
+ var preferredX = pos.x + margin;
+
+ // if over the right side of the window, render it left to the given pos
+ if (preferredX + rangeDetails.width + margin > rangeDetails.parent.width)
+ preferredX = pos.x - rangeDetails.width - margin;
+
+ // if window too narrow, put it at least in "margin" pixels
+ if (preferredX < margin)
+ preferredX = margin;
+
rangeDetails.x = preferredX
- var preferredY = pos.y - rangeDetails.height/2;
- if (preferredY + rangeDetails.height > root.height - 10)
- preferredY = root.height - 10 - rangeDetails.height;
- if (preferredY < 10)
- preferredY=10;
+ // center on current item
+ var preferredY = pos.y + height/2 - rangeDetails.height/2;
+
+ // if too low, put it over the bottom of the window
+ if (preferredY + rangeDetails.height - margin > root.height)
+ preferredY = root.height - rangeDetails.height - margin;
+
+ // but never above the top of the window
+ if (preferredY < margin)
+ preferredY = margin;
+
rangeDetails.y = preferredY;
+
rangeDetails.visible = true
}
diff --git a/src/plugins/qmlprofiler/qml/RangeMover.qml b/src/plugins/qmlprofiler/qml/RangeMover.qml
index 14443783b8..9366a00dae 100644
--- a/src/plugins/qmlprofiler/qml/RangeMover.qml
+++ b/src/plugins/qmlprofiler/qml/RangeMover.qml
@@ -40,6 +40,7 @@ Item {
property color lighterColor:"#cc80b2f6"
property color darkerColor:"#cc6da1e8"
+ property color gapColor: "#666da1e8"
property real value: (canvas.canvasWindow.x + x) * Plotter.xScale(canvas)
property real zoomWidth: 20
onZoomWidthChanged: timeDisplayLabel.hideAll();
@@ -62,8 +63,6 @@ Item {
Rectangle {
id: frame
color:"transparent"
- border.width: 1
- border.color: darkerColor
anchors.fill: parent
anchors.rightMargin: 1
anchors.bottomMargin: 1
@@ -71,13 +70,18 @@ Item {
Rectangle {
id: rect
-
color: lighterColor
width: parent.zoomWidth
height: parent.height
}
-
+ Rectangle {
+ id: gapRect
+ color: gapColor
+ anchors.left: rect.right
+ anchors.right: rightRange.left
+ height: parent.height
+ }
Rectangle {
id: leftRange
diff --git a/src/plugins/qmlprofiler/qml/StatusDisplay.qml b/src/plugins/qmlprofiler/qml/StatusDisplay.qml
index 4653450f92..751c8dffdb 100644
--- a/src/plugins/qmlprofiler/qml/StatusDisplay.qml
+++ b/src/plugins/qmlprofiler/qml/StatusDisplay.qml
@@ -58,7 +58,7 @@ Rectangle {
states: [
// no data available
State {
- when: (root.eventCount == 0) && !connection.recording;
+ when: (root.eventCount == 0) && !elapsedTimer.running;
PropertyChanges {
target: statusDisplay
visible: true
@@ -71,7 +71,7 @@ Rectangle {
},
// running app
State {
- when: connection.recording;
+ when: elapsedTimer.running;
PropertyChanges {
target: statusDisplay
visible: true
diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
index 829f26ea5d..9a3c5dc2c5 100644
--- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
@@ -46,6 +46,7 @@
#include <utils/qtcassert.h>
#include <coreplugin/helpmanager.h>
#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
+#include <qmlprojectmanager/qmlprojectplugin.h>
#include <projectexplorer/localapplicationruncontrol.h>
#include <projectexplorer/applicationrunconfiguration.h>
#include <qt4projectmanager/qt-s60/s60devicedebugruncontrol.h>
@@ -144,8 +145,25 @@ QmlProfilerEngine::~QmlProfilerEngine()
void QmlProfilerEngine::start()
{
QTC_ASSERT(!d->m_runner, return);
+
+ if (QmlProjectManager::QmlProjectRunConfiguration *rc =
+ qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration())) {
+ if (rc->observerPath().isEmpty()) {
+ QmlProjectManager::QmlProjectPlugin::showQmlObserverToolWarning();
+ AnalyzerManager::stopTool();
+ return;
+ }
+ }
+
d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), this);
+ if (LocalQmlProfilerRunner *qmlRunner = qobject_cast<LocalQmlProfilerRunner *>(d->m_runner)) {
+ if (!qmlRunner->hasExecutable()) {
+ showNonmodalWarning(tr("No executable file to launch."));
+ AnalyzerManager::stopTool();
+ return;
+ }
+ }
connect(d->m_runner, SIGNAL(stopped()), this, SLOT(stopped()));
connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
@@ -175,15 +193,7 @@ void QmlProfilerEngine::stopped()
{
// user feedback
if (d->m_running && d->m_fetchingData) {
- Core::ICore * const core = Core::ICore::instance();
- QMessageBox *killedWarning = new QMessageBox(core->mainWindow());
- killedWarning->setIcon(QMessageBox::Warning);
- killedWarning->setWindowTitle(tr("QML Profiler"));
- killedWarning->setText(tr("Application finished before loading profiled data.\n Please use the stop button instead."));
- killedWarning->setStandardButtons(QMessageBox::Ok);
- killedWarning->setDefaultButton(QMessageBox::Ok);
- killedWarning->setModal(false);
- killedWarning->show();
+ showNonmodalWarning(tr("Application finished before loading profiled data.\n Please use the stop button instead."));
}
d->m_running = false;
@@ -282,5 +292,18 @@ void QmlProfilerEngine::wrongSetupMessageBoxFinished(int button)
}
}
+void QmlProfilerEngine::showNonmodalWarning(const QString &warningMsg)
+{
+ Core::ICore * const core = Core::ICore::instance();
+ QMessageBox *noExecWarning = new QMessageBox(core->mainWindow());
+ noExecWarning->setIcon(QMessageBox::Warning);
+ noExecWarning->setWindowTitle(tr("QML Profiler"));
+ noExecWarning->setText(warningMsg);
+ noExecWarning->setStandardButtons(QMessageBox::Ok);
+ noExecWarning->setDefaultButton(QMessageBox::Ok);
+ noExecWarning->setModal(false);
+ noExecWarning->show();
+}
+
} // namespace Internal
} // namespace QmlProfiler
diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.h b/src/plugins/qmlprofiler/qmlprofilerengine.h
index 02dceaf8e2..8b0133b9c9 100644
--- a/src/plugins/qmlprofiler/qmlprofilerengine.h
+++ b/src/plugins/qmlprofiler/qmlprofilerengine.h
@@ -48,6 +48,7 @@ public:
ProjectExplorer::RunConfiguration *runConfiguration);
~QmlProfilerEngine();
+ static void showNonmodalWarning(const QString &warningMsg);
signals:
void processRunning(int port);
void stopRecording();
diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp
index b185616888..62c990716a 100644
--- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp
@@ -50,9 +50,13 @@ public:
{
if (data().type() == QVariant::String) {
// first column
- return data(FilenameRole).toString() == other.data(FilenameRole).toString() ?
+ if (column() == 0) {
+ return data(FilenameRole).toString() == other.data(FilenameRole).toString() ?
data(LineRole).toInt() < other.data(LineRole).toInt() :
data(FilenameRole).toString() < other.data(FilenameRole).toString();
+ } else {
+ return data().toString() < other.data().toString();
+ }
}
return data().toDouble() < other.data().toDouble();
@@ -142,7 +146,7 @@ void QmlProfilerEventStatistics::addRangedEvent(int type, int nestingLevel, int
Q_UNUSED(nestingInType);
const QChar colon = QLatin1Char(':');
- QString localName, displayName, location, details;
+ QString displayName, location, details;
if (data.isEmpty())
details = tr("Source code not available");
@@ -161,8 +165,8 @@ void QmlProfilerEventStatistics::addRangedEvent(int type, int nestingLevel, int
displayName = tr("<bytecode>");
location = QString("--:%1:%2").arg(QString::number(type), details);
} else {
- localName = QUrl(fileName).toLocalFile();
- displayName = localName.mid(localName.lastIndexOf(QChar('/')) + 1) + colon + QString::number(line);
+ const QString filePath = QUrl(fileName).path();
+ displayName = filePath.mid(filePath.lastIndexOf(QChar('/')) + 1) + colon + QString::number(line);
location = fileName+colon+QString::number(line);
}
@@ -229,10 +233,15 @@ void QmlProfilerEventStatistics::QmlProfilerEventStatisticsPrivate::postProcess(
{
double totalTime = 0;
- foreach (QmlEventData *binding, m_rootHash.values())
+ foreach (QmlEventData *binding, m_rootHash.values()) {
+ if (binding->filename->isEmpty())
+ continue;
totalTime += binding->duration;
+ }
foreach (QmlEventData *binding, m_rootHash.values()) {
+ if (binding->filename->isEmpty())
+ continue;
binding->percentOfTime = binding->duration * 100.0 / totalTime;
binding->timePerCall = binding->calls > 0 ? double(binding->duration) / binding->calls : 0;
}
@@ -408,7 +417,7 @@ void QmlProfilerEventsView::buildModel()
bool hasBranches = d->m_fieldShown[Parents] || d->m_fieldShown[Children];
setRootIsDecorated(hasBranches);
- setSortingEnabled(!hasBranches);
+ setSortingEnabled(true);
if (!hasBranches)
sortByColumn(d->m_firstNumericColumn,Qt::DescendingOrder);
@@ -444,7 +453,7 @@ void QmlProfilerEventsView::QmlProfilerEventsViewPrivate::buildModelFromList( co
if (m_fieldShown[Percent]) {
newRow << new EventsViewItem(QString::number(binding->percentOfTime,'f',2)+QLatin1String(" %"));
- newRow.last()->setData(QVariant(binding->eventType));
+ newRow.last()->setData(QVariant(binding->percentOfTime));
}
if (m_fieldShown[TotalDuration]) {
@@ -474,6 +483,7 @@ void QmlProfilerEventsView::QmlProfilerEventsViewPrivate::buildModelFromList( co
if (m_fieldShown[Details]) {
newRow << new EventsViewItem(*binding->details);
+ newRow.last()->setData(QVariant(*binding->details));
}
if (!newRow.isEmpty()) {
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index a72872bce0..50d31c2560 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -420,8 +420,7 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber)
if (lineNumber < 0 || fileUrl.isEmpty())
return;
- const QString fileName = QUrl(fileUrl).toLocalFile();
- const QString projectFileName = d->m_projectFinder.findFile(fileName);
+ const QString projectFileName = d->m_projectFinder.findFile(fileUrl);
Core::EditorManager *editorManager = Core::EditorManager::instance();
Core::IEditor *editor = editorManager->openEditor(projectFileName);