OSDN Git Service

analyzer: make output pane not pop up automatically in all cases
authorhjk <qtc-committer@nokia.com>
Fri, 20 May 2011 07:12:34 +0000 (09:12 +0200)
committerhjk <hjk@codereview.qt.nokia.com>
Fri, 20 May 2011 09:00:28 +0000 (11:00 +0200)
Change-Id: Ief96ab7093d78915087a273f3eff0b4489c3b370
Reviewed-on: http://codereview.qt.nokia.com/30
Reviewed-by: hjk
16 files changed:
src/plugins/analyzerbase/analyzermanager.cpp
src/plugins/analyzerbase/analyzermanager.h
src/plugins/analyzerbase/ianalyzertool.h
src/plugins/callgrind/callgrindengine.cpp
src/plugins/callgrind/callgrindengine.h
src/plugins/callgrind/callgrindhelper.cpp
src/plugins/callgrind/callgrindhelper.h
src/plugins/callgrind/callgrindtool.cpp
src/plugins/callgrind/callgrindtool.h
src/plugins/callgrind/callgrindvisualisation.cpp
src/plugins/callgrind/callgrindvisualisation.h
src/plugins/memcheck/memchecktool.cpp
src/plugins/memcheck/memchecktool.h
src/plugins/qmlprofiler/qmlprofilertool.cpp
src/plugins/qmlprofiler/qmlprofilertool.h
src/plugins/valgrindtoolbase/valgrindengine.cpp

index 9344424..2cd8ac1 100644 (file)
@@ -516,6 +516,8 @@ void AnalyzerManager::AnalyzerManagerPrivate::startTool()
 
     // make sure mode is shown
     q->showMode();
+    if (q->currentTool()->needsOutputPane())
+        q->popupOutputPane();
 
     ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
 
@@ -896,6 +898,10 @@ void AnalyzerManager::showMode()
 {
     if (d->m_mode)
         ModeManager::instance()->activateMode(d->m_mode->id());
+}
+
+void AnalyzerManager::popupOutputPane()
+{
     d->m_outputpane->popup();
 }
 
index e41cd71..990bcfd 100644 (file)
@@ -102,6 +102,7 @@ public:
     AnalyzerRunControl *createAnalyzer(const AnalyzerStartParameters &sp,
                                        ProjectExplorer::RunConfiguration *rc = 0);
     void showMode();
+    void popupOutputPane();
 
 public slots:
     void startTool();
index 26fc14a..5354fb2 100644 (file)
@@ -110,6 +110,9 @@ public:
 
     /// @return true when this tool can be run remotely, e.g. on a meego or maemo device
     virtual bool canRunRemotely() const = 0;
+
+    /// @return true when this tool needs the output pane to be show on startup
+    virtual bool needsOutputPane() const = 0;
 };
 
 } // namespace Analyzer
index 7d01c28..9f88d28 100644 (file)
@@ -61,10 +61,6 @@ CallgrindEngine::CallgrindEngine(const AnalyzerStartParameters &sp,
     m_progress->setProgressRange(0, 2);
 }
 
-CallgrindEngine::~CallgrindEngine()
-{
-}
-
 QStringList CallgrindEngine::toolArguments() const
 {
     QStringList arguments;
index 37fc69c..e23fb52 100644 (file)
@@ -44,10 +44,10 @@ namespace Internal {
 class CallgrindEngine : public Valgrind::Internal::ValgrindEngine
 {
     Q_OBJECT
+
 public:
     explicit CallgrindEngine(const Analyzer::AnalyzerStartParameters &sp,
                              ProjectExplorer::RunConfiguration *runConfiguration);
-    virtual ~CallgrindEngine();
 
     void start();
 
index 1e08b74..020c900 100644 (file)
@@ -38,7 +38,8 @@
 #include <QtCore/QMap>
 #include <QtCore/QString>
 
-using namespace Callgrind::Internal;
+namespace Callgrind {
+namespace Internal {
 
 QColor CallgrindHelper::colorForString(const QString &text)
 {
@@ -65,10 +66,12 @@ QString CallgrindHelper::toPercent(float costs, const QLocale &locale)
 {
     if (costs > 99.9f)
         return locale.toString(100) + locale.percent();
-    else if (costs > 9.99f)
+    if (costs > 9.99f)
         return locale.toString(costs, 'f', 1) + locale.percent();
-    else if (costs > 0.009f)
+    if (costs > 0.009f)
         return locale.toString(costs, 'f', 2) + locale.percent();
-    else
-        return QString("<") + locale.toString(0.01f) + locale.percent();
+    return QString("<") + locale.toString(0.01f) + locale.percent();
 }
+
+} // namespace Internal
+} // namespace Callgrind
index 383d564..d013f9b 100644 (file)
@@ -62,7 +62,7 @@ namespace CallgrindHelper
     QString toPercent(float costs, const QLocale &locale = QLocale());
 }
 
-}
-}
+} // namespace Internal
+} // namespace Callgrind
 
 #endif // CALLGRINDHELPER_H
index 0ff3379..3d158e5 100644 (file)
@@ -43,7 +43,6 @@
 #include <analyzerbase/analyzermanager.h>
 #include <analyzerbase/analyzersettings.h>
 #include <analyzerbase/analyzerutils.h>
-#include <analyzerbase/ianalyzeroutputpaneadapter.h>
 
 #include <coreplugin/coreconstants.h>
 #include <coreplugin/icontext.h>
@@ -98,13 +97,13 @@ static QToolButton *createToolButton(QAction *action)
 }
 
 CallgrindTool::CallgrindTool(QObject *parent)
-: Analyzer::IAnalyzerTool(parent)
-, m_callgrindWidgetHandler(0)
-, m_dumpAction(0)
-, m_resetAction(0)
-, m_pauseAction(0)
-, m_showCostsOfFunctionAction(0)
-, m_toolbarWidget(0)
+    : Analyzer::IAnalyzerTool(parent)
+    , m_callgrindWidgetHandler(0)
+    , m_dumpAction(0)
+    , m_resetAction(0)
+    , m_pauseAction(0)
+    , m_showCostsOfFunctionAction(0)
+    , m_toolbarWidget(0)
 {
     Core::ICore *core = Core::ICore::instance();
 
@@ -226,12 +225,12 @@ IAnalyzerEngine *CallgrindTool::createEngine(const AnalyzerStartParameters &sp,
 {
     CallgrindEngine *engine = new CallgrindEngine(sp, runConfiguration);
 
-    connect(engine, SIGNAL(parserDataReady(CallgrindEngine *)), SLOT(takeParserData(CallgrindEngine *)));
-
+    connect(engine, SIGNAL(parserDataReady(CallgrindEngine *)),
+            SLOT(takeParserData(CallgrindEngine *)));
     connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
-            this, SLOT(engineStarting(const Analyzer::IAnalyzerEngine*)));
+            SLOT(engineStarting(const Analyzer::IAnalyzerEngine*)));
     connect(engine, SIGNAL(finished()),
-            this, SLOT(engineFinished()));
+            SLOT(engineFinished()));
 
     connect(this, SIGNAL(dumpRequested()), engine, SLOT(dump()));
     connect(this, SIGNAL(resetRequested()), engine, SLOT(reset()));
@@ -299,11 +298,6 @@ QWidget *CallgrindTool::createControlWidget()
     return widget;
 }
 
-CallgrindWidgetHandler *CallgrindTool::callgrindWidgetHandler() const
-{
-  return m_callgrindWidgetHandler;
-}
-
 void CallgrindTool::clearErrorView()
 {
     clearTextMarks();
index 3b724e4..d36fdac 100644 (file)
@@ -85,10 +85,10 @@ public:
     virtual QWidget *createControlWidget();
 
     // For the output pane adapter.
-    CallgrindWidgetHandler *callgrindWidgetHandler() const;
     void clearErrorView();
 
     virtual bool canRunRemotely() const;
+    bool needsOutputPane() const { return false; }
 
 signals:
     void dumpRequested();
index 511c0d0..3ff9b6b 100644 (file)
@@ -57,7 +57,7 @@
 // QGraphicsView::fitInView(const QRectF &rect,
 //                          Qt::AspectRatioMode aspectRatioMode)
 // Bug report here: http://bugreports.qt.nokia.com/browse/QTBUG-11945
-#define FIT_IN_VIEW_MARGIN 2;
+static const int FIT_IN_VIEW_MARGIN = 2;
 
 using namespace Valgrind::Callgrind;
 
@@ -218,7 +218,6 @@ class Visualisation::Private
 {
 public:
     Private(Visualisation *qq);
-    ~Private();
 
     void handleMousePressEvent(QMouseEvent *event, bool doubleClicked);
     qreal sceneHeight() const;
@@ -245,11 +244,6 @@ Visualisation::Private::Private(Visualisation *qq)
             qq, SLOT(populateScene()));
 }
 
-Visualisation::Private::~Private()
-{
-
-}
-
 void Visualisation::Private::handleMousePressEvent(QMouseEvent *event,
                                                    bool doubleClicked)
 {
@@ -466,5 +460,5 @@ void Visualisation::resizeEvent(QResizeEvent *event)
     QGraphicsView::resizeEvent(event);
 }
 
-} // Internal
-} // Callgrind
+} // namespace Internal
+} // namespace Callgrind
index a971408..2694d0c 100644 (file)
@@ -88,7 +88,7 @@ private:
     Private *d;
 };
 
-} // Internal
-} // Callgrind
+} // namespace Internal
+} // namespace Callgrind
 
 #endif // VALGRIND_CALLGRIND_CALLGRINDVISUALISATION_H
index aac5e90..9325844 100644 (file)
@@ -320,9 +320,11 @@ IAnalyzerTool::ToolMode MemcheckTool::mode() const
     return DebugMode;
 }
 
-class FrameFinder : public ErrorListModel::RelevantFrameFinder {
+class FrameFinder : public ErrorListModel::RelevantFrameFinder
+{
 public:
-    Frame findRelevant(const Error &error) const {
+    Frame findRelevant(const Error &error) const
+    {
         const QVector<Stack> stacks = error.stacks();
         if (stacks.isEmpty())
             return Frame();
@@ -467,7 +469,7 @@ void MemcheckTool::engineStarting(const IAnalyzerEngine *engine)
 
 QMenu *MemcheckTool::filterMenu() const
 {
-    QTC_ASSERT(m_suppressionSeparator, return 0; )
+    QTC_ASSERT(m_suppressionSeparator, return 0);
     foreach (QWidget *w, m_suppressionSeparator->associatedWidgets())
         if (QMenu *menu = qobject_cast<QMenu *>(w))
             return menu;
@@ -491,7 +493,8 @@ void MemcheckTool::parserError(const Valgrind::XmlProtocol::Error &error)
 
 void MemcheckTool::internalParserError(const QString &errorString)
 {
-    QMessageBox::critical(m_errorView, tr("Internal Error"), tr("Error occurred parsing valgrind output: %1").arg(errorString));
+    QMessageBox::critical(m_errorView, tr("Internal Error"),
+        tr("Error occurred parsing valgrind output: %1").arg(errorString));
 }
 
 void MemcheckTool::clearErrorView()
index 52997cd..4895898 100644 (file)
@@ -64,6 +64,7 @@ class AnalyzerSettings;
 
 namespace Memcheck {
 namespace Internal {
+
 class MemCheckOutputPaneAdapter;
 class MemcheckErrorView;
 class FrameFinder;
@@ -71,6 +72,7 @@ class FrameFinder;
 class MemcheckErrorFilterProxyModel : public QSortFilterProxyModel
 {
     Q_OBJECT
+
 public:
     MemcheckErrorFilterProxyModel(QObject *parent = 0);
 
@@ -80,6 +82,7 @@ public slots:
 
 protected:
     bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+
 private:
     QList<int> m_acceptedKinds;
     bool m_filterExternalIssues;
@@ -88,6 +91,7 @@ private:
 class MemcheckTool : public Analyzer::IAnalyzerTool
 {
     Q_OBJECT
+
 public:
     explicit MemcheckTool(QObject *parent = 0);
 
@@ -96,18 +100,19 @@ public:
     ToolMode mode() const;
 
     void initialize();
-    virtual void extensionsInitialized() {}
+    void extensionsInitialized() {}
 
-    virtual Analyzer::IAnalyzerOutputPaneAdapter *outputPaneAdapter();
-    virtual Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
-                                  ProjectExplorer::RunConfiguration *runConfiguration = 0);
+    Analyzer::IAnalyzerOutputPaneAdapter *outputPaneAdapter();
+    Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
+                               ProjectExplorer::RunConfiguration *runConfiguration = 0);
 
     // For the output pane adapter.
     MemcheckErrorView *ensurePaneErrorView();
     QWidget *createPaneToolBarWidget();
     void clearErrorView();
 
-    virtual bool canRunRemotely() const;
+    bool canRunRemotely() const;
+    bool needsOutputPane() const { return true; }
 
 private slots:
     void settingsDestroyed(QObject *settings);
index ba00d29..4b7932b 100644 (file)
 #include "qmlprofilerplugin.h"
 #include "qmlprofilerconstants.h"
 #include "qmlprofilerattachdialog.h"
+#include "qmlprofilersummaryview.h"
 
 #include "tracewindow.h"
+#include "timelineview.h"
+
 #include <qmljsdebugclient/qdeclarativedebugclient_p.h>
 
 #include <analyzerbase/analyzermanager.h>
 #include <analyzerbase/analyzerconstants.h>
 #include <analyzerbase/ianalyzeroutputpaneadapter.h>
 
-#include "timelineview.h"
-
 #include "canvas/qdeclarativecanvas_p.h"
 #include "canvas/qdeclarativecontext2d_p.h"
 #include "canvas/qdeclarativetiledcanvas_p.h"
 
 #include <QtGui/QHBoxLayout>
 #include <QtGui/QLabel>
-#include <QtGui/QToolButton>
-
 #include <QtGui/QTabWidget>
-#include "qmlprofilersummaryview.h"
+#include <QtGui/QToolButton>
 
 using namespace Analyzer;
 using namespace QmlProfiler::Internal;
@@ -96,7 +95,6 @@ public:
     virtual void goToNext() { /*TODO*/ }
     virtual void goToPrev() { /*TODO*/ }
 
-
 private:
     QmlProfilerTool *m_tool;
 };
@@ -402,6 +400,7 @@ void QmlProfilerTool::attach()
 
         connectClient();
         AnalyzerManager::instance()->showMode();
+        AnalyzerManager::instance()->popupOutputPane();
     } else {
         stopRecording();
     }
index ef9948c..aec6864 100644 (file)
@@ -43,6 +43,7 @@ namespace Internal {
 class QmlProfilerTool : public Analyzer::IAnalyzerTool
 {
     Q_OBJECT
+
 public:
     explicit QmlProfilerTool(QObject *parent = 0);
     ~QmlProfilerTool();
@@ -62,6 +63,7 @@ public:
     QWidget *createTimeLineWidget();
 
     bool canRunRemotely() const;
+    bool needsOutputPane() const { return false; }
 
     void clearDisplay();
 
index 78991b9..71c9a97 100644 (file)
@@ -187,7 +187,7 @@ void ValgrindEngine::receiveProcessError(const QString &error, QProcess::Process
 
     ///FIXME: get a better API for this into Qt Creator
     ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
-    QList< Core::IOutputPane *> panes = pm->getObjects<Core::IOutputPane>();
+    QList<Core::IOutputPane *> panes = pm->getObjects<Core::IOutputPane>();
     foreach (Core::IOutputPane *pane, panes) {
         if (pane->displayName() == tr("Application Output")) {
             pane->popup(false);