From 37f90fd63ff3ad69df35f9fd1af82f73d6a87590 Mon Sep 17 00:00:00 2001
From: Aurindam Jana <aurindam.jana@digia.com>
Date: Tue, 15 Oct 2013 16:46:35 +0200
Subject: [PATCH] QmlProfiler: remove dependency on QmlProjectManager

Change-Id: I6c13ce1636bbaf201602e4a9473aca4f9953d1cb
Reviewed-by: hjk <hjk121@nokiamail.com>
---
 .../qmlprofiler/qmlprofiler_dependencies.pri  |  1 -
 src/plugins/qmlprofiler/qmlprofilerengine.cpp | 30 +++++++++++++++++--
 src/plugins/qmlprofiler/qmlprofilerengine.h   |  3 ++
 src/plugins/qmlprofiler/qmlprofilertool.cpp   |  2 --
 4 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/src/plugins/qmlprofiler/qmlprofiler_dependencies.pri b/src/plugins/qmlprofiler/qmlprofiler_dependencies.pri
index f43ea85f534..80aadfe4f28 100644
--- a/src/plugins/qmlprofiler/qmlprofiler_dependencies.pri
+++ b/src/plugins/qmlprofiler/qmlprofiler_dependencies.pri
@@ -6,7 +6,6 @@ QTC_PLUGIN_DEPENDS += \
     analyzerbase \
     coreplugin \
     projectexplorer \
-    qmlprojectmanager \
     qmljstools \
     qtsupport \
     texteditor
diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
index 38dc6f5901c..de05868abfd 100644
--- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
@@ -38,16 +38,19 @@
 #include <projectexplorer/projectexplorerconstants.h>
 #include <projectexplorer/kitinformation.h>
 #include <projectexplorer/target.h>
-#include <qmlprojectmanager/qmlprojectplugin.h>
 #include <projectexplorer/environmentaspect.h>
 #include <projectexplorer/localapplicationruncontrol.h>
 #include <projectexplorer/localapplicationrunconfiguration.h>
+#include <qtsupport/qtsupportconstants.h>
 #include <qmldebug/qmloutputparser.h>
 
 #include <QMainWindow>
 #include <QMessageBox>
 #include <QTimer>
 #include <QTcpServer>
+#include <QApplication>
+#include <QMessageBox>
+#include <QPushButton>
 
 using namespace Analyzer;
 using namespace Core;
@@ -113,7 +116,7 @@ bool QmlProfilerRunControl::startEngine()
     if (ProjectExplorer::LocalApplicationRunConfiguration *rc =
             qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration())) {
         if (rc->executable().isEmpty()) {
-            QmlProjectManager::QmlProjectPlugin::showQmlObserverToolWarning();
+            showQmlObserverToolWarning();
             d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle);
             AnalyzerManager::stopTool();
             return false;
@@ -314,5 +317,28 @@ void QmlProfilerRunControl::profilerStateChanged()
     }
 }
 
+void QmlProfilerRunControl::showQmlObserverToolWarning()
+{
+    QMessageBox dialog(QApplication::activeWindow());
+    QPushButton *qtPref = dialog.addButton(tr("Open Qt Versions"),
+                                           QMessageBox::ActionRole);
+    dialog.addButton(QMessageBox::Cancel);
+    dialog.setDefaultButton(qtPref);
+    dialog.setWindowTitle(tr("QML Observer Missing"));
+    dialog.setText(tr("QML Observer could not be found for this Qt version."));
+    dialog.setInformativeText(tr(
+                                  "QML Observer is used to offer debugging features for "
+                                  "Qt Quick UI projects in the Qt 4.7 series.\n\n"
+                                  "To compile QML Observer, go to the Qt Versions page, "
+                                  "select the current Qt version, "
+                                  "and click Build in the Helpers section."));
+    dialog.exec();
+    if (dialog.clickedButton() == qtPref) {
+        Core::ICore::showOptionsDialog(
+                    ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
+                    QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID);
+    }
+}
+
 } // namespace Internal
 } // namespace QmlProfiler
diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.h b/src/plugins/qmlprofiler/qmlprofilerengine.h
index cf0b476f9f9..cfacd6f8a8b 100644
--- a/src/plugins/qmlprofiler/qmlprofilerengine.h
+++ b/src/plugins/qmlprofiler/qmlprofilerengine.h
@@ -75,6 +75,9 @@ private slots:
 private slots:
     void profilerStateChanged();
 
+private:
+    void showQmlObserverToolWarning();
+
 private:
     class QmlProfilerEnginePrivate;
     QmlProfilerEnginePrivate *d;
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index 582ddca23d8..5fbb3307b5d 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -44,7 +44,6 @@
 #include "canvas/qdeclarativecontext2d_p.h"
 #include "canvas/qmlprofilercanvas.h"
 
-#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
 #include <utils/fancymainwindow.h>
 #include <utils/fileinprojectfinder.h>
 #include <utils/qtcassert.h>
@@ -89,7 +88,6 @@ using namespace QmlProfiler::Internal;
 using namespace QmlProfiler::Constants;
 using namespace QmlDebug;
 using namespace ProjectExplorer;
-using namespace QmlProjectManager;
 
 class QmlProfilerTool::QmlProfilerToolPrivate
 {
-- 
GitLab