analyzer: make output pane not pop up automatically in all cases

Change-Id: Ief96ab7093d78915087a273f3eff0b4489c3b370
Reviewed-on: http://codereview.qt.nokia.com/30
Reviewed-by: hjk
This commit is contained in:
hjk
2011-05-20 09:12:34 +02:00
committed by hjk
parent 705d450910
commit c31bc05e2e
16 changed files with 63 additions and 57 deletions

View File

@@ -516,6 +516,8 @@ void AnalyzerManager::AnalyzerManagerPrivate::startTool()
// make sure mode is shown // make sure mode is shown
q->showMode(); q->showMode();
if (q->currentTool()->needsOutputPane())
q->popupOutputPane();
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
@@ -896,6 +898,10 @@ void AnalyzerManager::showMode()
{ {
if (d->m_mode) if (d->m_mode)
ModeManager::instance()->activateMode(d->m_mode->id()); ModeManager::instance()->activateMode(d->m_mode->id());
}
void AnalyzerManager::popupOutputPane()
{
d->m_outputpane->popup(); d->m_outputpane->popup();
} }

View File

@@ -102,6 +102,7 @@ public:
AnalyzerRunControl *createAnalyzer(const AnalyzerStartParameters &sp, AnalyzerRunControl *createAnalyzer(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *rc = 0); ProjectExplorer::RunConfiguration *rc = 0);
void showMode(); void showMode();
void popupOutputPane();
public slots: public slots:
void startTool(); void startTool();

View File

@@ -110,6 +110,9 @@ public:
/// @return true when this tool can be run remotely, e.g. on a meego or maemo device /// @return true when this tool can be run remotely, e.g. on a meego or maemo device
virtual bool canRunRemotely() const = 0; 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 } // namespace Analyzer

View File

@@ -61,10 +61,6 @@ CallgrindEngine::CallgrindEngine(const AnalyzerStartParameters &sp,
m_progress->setProgressRange(0, 2); m_progress->setProgressRange(0, 2);
} }
CallgrindEngine::~CallgrindEngine()
{
}
QStringList CallgrindEngine::toolArguments() const QStringList CallgrindEngine::toolArguments() const
{ {
QStringList arguments; QStringList arguments;

View File

@@ -44,10 +44,10 @@ namespace Internal {
class CallgrindEngine : public Valgrind::Internal::ValgrindEngine class CallgrindEngine : public Valgrind::Internal::ValgrindEngine
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit CallgrindEngine(const Analyzer::AnalyzerStartParameters &sp, explicit CallgrindEngine(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration); ProjectExplorer::RunConfiguration *runConfiguration);
virtual ~CallgrindEngine();
void start(); void start();

View File

@@ -38,7 +38,8 @@
#include <QtCore/QMap> #include <QtCore/QMap>
#include <QtCore/QString> #include <QtCore/QString>
using namespace Callgrind::Internal; namespace Callgrind {
namespace Internal {
QColor CallgrindHelper::colorForString(const QString &text) QColor CallgrindHelper::colorForString(const QString &text)
{ {
@@ -65,10 +66,12 @@ QString CallgrindHelper::toPercent(float costs, const QLocale &locale)
{ {
if (costs > 99.9f) if (costs > 99.9f)
return locale.toString(100) + locale.percent(); return locale.toString(100) + locale.percent();
else if (costs > 9.99f) if (costs > 9.99f)
return locale.toString(costs, 'f', 1) + locale.percent(); 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(); 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

View File

@@ -62,7 +62,7 @@ namespace CallgrindHelper
QString toPercent(float costs, const QLocale &locale = QLocale()); QString toPercent(float costs, const QLocale &locale = QLocale());
} }
} } // namespace Internal
} } // namespace Callgrind
#endif // CALLGRINDHELPER_H #endif // CALLGRINDHELPER_H

View File

@@ -43,7 +43,6 @@
#include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzersettings.h> #include <analyzerbase/analyzersettings.h>
#include <analyzerbase/analyzerutils.h> #include <analyzerbase/analyzerutils.h>
#include <analyzerbase/ianalyzeroutputpaneadapter.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
@@ -98,13 +97,13 @@ static QToolButton *createToolButton(QAction *action)
} }
CallgrindTool::CallgrindTool(QObject *parent) CallgrindTool::CallgrindTool(QObject *parent)
: Analyzer::IAnalyzerTool(parent) : Analyzer::IAnalyzerTool(parent)
, m_callgrindWidgetHandler(0) , m_callgrindWidgetHandler(0)
, m_dumpAction(0) , m_dumpAction(0)
, m_resetAction(0) , m_resetAction(0)
, m_pauseAction(0) , m_pauseAction(0)
, m_showCostsOfFunctionAction(0) , m_showCostsOfFunctionAction(0)
, m_toolbarWidget(0) , m_toolbarWidget(0)
{ {
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
@@ -226,12 +225,12 @@ IAnalyzerEngine *CallgrindTool::createEngine(const AnalyzerStartParameters &sp,
{ {
CallgrindEngine *engine = new CallgrindEngine(sp, runConfiguration); 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*)), connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
this, SLOT(engineStarting(const Analyzer::IAnalyzerEngine*))); SLOT(engineStarting(const Analyzer::IAnalyzerEngine*)));
connect(engine, SIGNAL(finished()), connect(engine, SIGNAL(finished()),
this, SLOT(engineFinished())); SLOT(engineFinished()));
connect(this, SIGNAL(dumpRequested()), engine, SLOT(dump())); connect(this, SIGNAL(dumpRequested()), engine, SLOT(dump()));
connect(this, SIGNAL(resetRequested()), engine, SLOT(reset())); connect(this, SIGNAL(resetRequested()), engine, SLOT(reset()));
@@ -299,11 +298,6 @@ QWidget *CallgrindTool::createControlWidget()
return widget; return widget;
} }
CallgrindWidgetHandler *CallgrindTool::callgrindWidgetHandler() const
{
return m_callgrindWidgetHandler;
}
void CallgrindTool::clearErrorView() void CallgrindTool::clearErrorView()
{ {
clearTextMarks(); clearTextMarks();

View File

@@ -85,10 +85,10 @@ public:
virtual QWidget *createControlWidget(); virtual QWidget *createControlWidget();
// For the output pane adapter. // For the output pane adapter.
CallgrindWidgetHandler *callgrindWidgetHandler() const;
void clearErrorView(); void clearErrorView();
virtual bool canRunRemotely() const; virtual bool canRunRemotely() const;
bool needsOutputPane() const { return false; }
signals: signals:
void dumpRequested(); void dumpRequested();

View File

@@ -57,7 +57,7 @@
// QGraphicsView::fitInView(const QRectF &rect, // QGraphicsView::fitInView(const QRectF &rect,
// Qt::AspectRatioMode aspectRatioMode) // Qt::AspectRatioMode aspectRatioMode)
// Bug report here: http://bugreports.qt.nokia.com/browse/QTBUG-11945 // 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; using namespace Valgrind::Callgrind;
@@ -218,7 +218,6 @@ class Visualisation::Private
{ {
public: public:
Private(Visualisation *qq); Private(Visualisation *qq);
~Private();
void handleMousePressEvent(QMouseEvent *event, bool doubleClicked); void handleMousePressEvent(QMouseEvent *event, bool doubleClicked);
qreal sceneHeight() const; qreal sceneHeight() const;
@@ -245,11 +244,6 @@ Visualisation::Private::Private(Visualisation *qq)
qq, SLOT(populateScene())); qq, SLOT(populateScene()));
} }
Visualisation::Private::~Private()
{
}
void Visualisation::Private::handleMousePressEvent(QMouseEvent *event, void Visualisation::Private::handleMousePressEvent(QMouseEvent *event,
bool doubleClicked) bool doubleClicked)
{ {
@@ -466,5 +460,5 @@ void Visualisation::resizeEvent(QResizeEvent *event)
QGraphicsView::resizeEvent(event); QGraphicsView::resizeEvent(event);
} }
} // Internal } // namespace Internal
} // Callgrind } // namespace Callgrind

View File

@@ -88,7 +88,7 @@ private:
Private *d; Private *d;
}; };
} // Internal } // namespace Internal
} // Callgrind } // namespace Callgrind
#endif // VALGRIND_CALLGRIND_CALLGRINDVISUALISATION_H #endif // VALGRIND_CALLGRIND_CALLGRINDVISUALISATION_H

View File

@@ -320,9 +320,11 @@ IAnalyzerTool::ToolMode MemcheckTool::mode() const
return DebugMode; return DebugMode;
} }
class FrameFinder : public ErrorListModel::RelevantFrameFinder { class FrameFinder : public ErrorListModel::RelevantFrameFinder
{
public: public:
Frame findRelevant(const Error &error) const { Frame findRelevant(const Error &error) const
{
const QVector<Stack> stacks = error.stacks(); const QVector<Stack> stacks = error.stacks();
if (stacks.isEmpty()) if (stacks.isEmpty())
return Frame(); return Frame();
@@ -467,7 +469,7 @@ void MemcheckTool::engineStarting(const IAnalyzerEngine *engine)
QMenu *MemcheckTool::filterMenu() const QMenu *MemcheckTool::filterMenu() const
{ {
QTC_ASSERT(m_suppressionSeparator, return 0; ) QTC_ASSERT(m_suppressionSeparator, return 0);
foreach (QWidget *w, m_suppressionSeparator->associatedWidgets()) foreach (QWidget *w, m_suppressionSeparator->associatedWidgets())
if (QMenu *menu = qobject_cast<QMenu *>(w)) if (QMenu *menu = qobject_cast<QMenu *>(w))
return menu; return menu;
@@ -491,7 +493,8 @@ void MemcheckTool::parserError(const Valgrind::XmlProtocol::Error &error)
void MemcheckTool::internalParserError(const QString &errorString) 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() void MemcheckTool::clearErrorView()

View File

@@ -64,6 +64,7 @@ class AnalyzerSettings;
namespace Memcheck { namespace Memcheck {
namespace Internal { namespace Internal {
class MemCheckOutputPaneAdapter; class MemCheckOutputPaneAdapter;
class MemcheckErrorView; class MemcheckErrorView;
class FrameFinder; class FrameFinder;
@@ -71,6 +72,7 @@ class FrameFinder;
class MemcheckErrorFilterProxyModel : public QSortFilterProxyModel class MemcheckErrorFilterProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
MemcheckErrorFilterProxyModel(QObject *parent = 0); MemcheckErrorFilterProxyModel(QObject *parent = 0);
@@ -80,6 +82,7 @@ public slots:
protected: protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
private: private:
QList<int> m_acceptedKinds; QList<int> m_acceptedKinds;
bool m_filterExternalIssues; bool m_filterExternalIssues;
@@ -88,6 +91,7 @@ private:
class MemcheckTool : public Analyzer::IAnalyzerTool class MemcheckTool : public Analyzer::IAnalyzerTool
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MemcheckTool(QObject *parent = 0); explicit MemcheckTool(QObject *parent = 0);
@@ -96,10 +100,10 @@ public:
ToolMode mode() const; ToolMode mode() const;
void initialize(); void initialize();
virtual void extensionsInitialized() {} void extensionsInitialized() {}
virtual Analyzer::IAnalyzerOutputPaneAdapter *outputPaneAdapter(); Analyzer::IAnalyzerOutputPaneAdapter *outputPaneAdapter();
virtual Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp, Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0); ProjectExplorer::RunConfiguration *runConfiguration = 0);
// For the output pane adapter. // For the output pane adapter.
@@ -107,7 +111,8 @@ public:
QWidget *createPaneToolBarWidget(); QWidget *createPaneToolBarWidget();
void clearErrorView(); void clearErrorView();
virtual bool canRunRemotely() const; bool canRunRemotely() const;
bool needsOutputPane() const { return true; }
private slots: private slots:
void settingsDestroyed(QObject *settings); void settingsDestroyed(QObject *settings);

View File

@@ -36,16 +36,17 @@
#include "qmlprofilerplugin.h" #include "qmlprofilerplugin.h"
#include "qmlprofilerconstants.h" #include "qmlprofilerconstants.h"
#include "qmlprofilerattachdialog.h" #include "qmlprofilerattachdialog.h"
#include "qmlprofilersummaryview.h"
#include "tracewindow.h" #include "tracewindow.h"
#include "timelineview.h"
#include <qmljsdebugclient/qdeclarativedebugclient_p.h> #include <qmljsdebugclient/qdeclarativedebugclient_p.h>
#include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerconstants.h> #include <analyzerbase/analyzerconstants.h>
#include <analyzerbase/ianalyzeroutputpaneadapter.h> #include <analyzerbase/ianalyzeroutputpaneadapter.h>
#include "timelineview.h"
#include "canvas/qdeclarativecanvas_p.h" #include "canvas/qdeclarativecanvas_p.h"
#include "canvas/qdeclarativecontext2d_p.h" #include "canvas/qdeclarativecontext2d_p.h"
#include "canvas/qdeclarativetiledcanvas_p.h" #include "canvas/qdeclarativetiledcanvas_p.h"
@@ -69,10 +70,8 @@
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>
#include <QtGui/QLabel> #include <QtGui/QLabel>
#include <QtGui/QToolButton>
#include <QtGui/QTabWidget> #include <QtGui/QTabWidget>
#include "qmlprofilersummaryview.h" #include <QtGui/QToolButton>
using namespace Analyzer; using namespace Analyzer;
using namespace QmlProfiler::Internal; using namespace QmlProfiler::Internal;
@@ -96,7 +95,6 @@ public:
virtual void goToNext() { /*TODO*/ } virtual void goToNext() { /*TODO*/ }
virtual void goToPrev() { /*TODO*/ } virtual void goToPrev() { /*TODO*/ }
private: private:
QmlProfilerTool *m_tool; QmlProfilerTool *m_tool;
}; };
@@ -402,6 +400,7 @@ void QmlProfilerTool::attach()
connectClient(); connectClient();
AnalyzerManager::instance()->showMode(); AnalyzerManager::instance()->showMode();
AnalyzerManager::instance()->popupOutputPane();
} else { } else {
stopRecording(); stopRecording();
} }

View File

@@ -43,6 +43,7 @@ namespace Internal {
class QmlProfilerTool : public Analyzer::IAnalyzerTool class QmlProfilerTool : public Analyzer::IAnalyzerTool
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QmlProfilerTool(QObject *parent = 0); explicit QmlProfilerTool(QObject *parent = 0);
~QmlProfilerTool(); ~QmlProfilerTool();
@@ -62,6 +63,7 @@ public:
QWidget *createTimeLineWidget(); QWidget *createTimeLineWidget();
bool canRunRemotely() const; bool canRunRemotely() const;
bool needsOutputPane() const { return false; }
void clearDisplay(); void clearDisplay();

View File

@@ -187,7 +187,7 @@ void ValgrindEngine::receiveProcessError(const QString &error, QProcess::Process
///FIXME: get a better API for this into Qt Creator ///FIXME: get a better API for this into Qt Creator
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); 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) { foreach (Core::IOutputPane *pane, panes) {
if (pane->displayName() == tr("Application Output")) { if (pane->displayName() == tr("Application Output")) {
pane->popup(false); pane->popup(false);