diff options
author | hjk <qtc-committer@nokia.com> | 2011-05-20 12:43:29 +0200 |
---|---|---|
committer | hjk <hjk@codereview.qt.nokia.com> | 2011-05-23 14:56:36 +0200 |
commit | cc645911c15e77ca3d290010e58968aa1fb353ca (patch) | |
tree | 75623d71f575b3114bd653de67a1f4790837f22c /src | |
parent | b7d71b07696df3a5d29e6c620a1aec858285e78c (diff) | |
download | qt-creator-cc645911c15e77ca3d290010e58968aa1fb353ca.tar.gz |
qmlprofiler: use dockwidgets instead of tabs in the output pane
Change-Id: I2c33c4309e6568a34517fae2bb37f5e70320cfbe
Reviewed-on: http://codereview.qt.nokia.com/35
Reviewed-by: hjk
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilersummaryview.cpp | 6 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilersummaryview.h | 9 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertool.cpp | 91 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertool.h | 5 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/tracewindow.cpp | 1 |
5 files changed, 43 insertions, 69 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilersummaryview.cpp b/src/plugins/qmlprofiler/qmlprofilersummaryview.cpp index 0806961515..679922f133 100644 --- a/src/plugins/qmlprofiler/qmlprofilersummaryview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilersummaryview.cpp @@ -41,7 +41,8 @@ using namespace QmlProfiler::Internal; -struct BindingData { +struct BindingData +{ QString displayname; QString filename; int line; @@ -56,7 +57,7 @@ struct BindingData { class QmlProfilerSummaryView::QmlProfilerSummaryViewPrivate { public: - QmlProfilerSummaryViewPrivate(QmlProfilerSummaryView *qq):q(qq) {} + QmlProfilerSummaryViewPrivate(QmlProfilerSummaryView *qq) : q(qq) {} ~QmlProfilerSummaryViewPrivate() {} QmlProfilerSummaryView *q; @@ -96,6 +97,7 @@ public: QmlProfilerSummaryView::QmlProfilerSummaryView(QWidget *parent) : QTreeView(parent), d(new QmlProfilerSummaryViewPrivate(this)) { + setObjectName("QmlProfilerSummaryView"); setRootIsDecorated(false); header()->setResizeMode(QHeaderView::Interactive); header()->setMinimumSectionSize(100); diff --git a/src/plugins/qmlprofiler/qmlprofilersummaryview.h b/src/plugins/qmlprofiler/qmlprofilersummaryview.h index 2f2051daf2..546a10a012 100644 --- a/src/plugins/qmlprofiler/qmlprofilersummaryview.h +++ b/src/plugins/qmlprofiler/qmlprofilersummaryview.h @@ -42,6 +42,7 @@ namespace Internal { class QmlProfilerSummaryView : public QTreeView { Q_OBJECT + public: explicit QmlProfilerSummaryView(QWidget *parent = 0); ~QmlProfilerSummaryView(); @@ -51,7 +52,8 @@ signals: public slots: void clean(); - void addRangedEvent(int type, qint64 startTime, qint64 length, const QStringList &data, const QString &fileName, int line); + void addRangedEvent(int type, qint64 startTime, qint64 length, + const QStringList &data, const QString &fileName, int line); void complete(); void jumpToItem(const QModelIndex &index); @@ -70,10 +72,9 @@ private: double mintime); void setHeaderLabels(); QString displayTime(double time) const; - }; -} -} +} // namespace Internal +} // namespace QmlProfiler #endif // QMLPROFILERSUMMARYVIEW_H diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 4b7932b38a..24cc2ccb48 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -45,13 +45,13 @@ #include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzerconstants.h> -#include <analyzerbase/ianalyzeroutputpaneadapter.h> #include "canvas/qdeclarativecanvas_p.h" #include "canvas/qdeclarativecontext2d_p.h" #include "canvas/qdeclarativetiledcanvas_p.h" #include <qmlprojectmanager/qmlprojectrunconfiguration.h> +#include <utils/fancymainwindow.h> #include <utils/fileinprojectfinder.h> #include <utils/qtcassert.h> #include <projectexplorer/projectexplorer.h> @@ -76,29 +76,6 @@ using namespace Analyzer; using namespace QmlProfiler::Internal; -// Adapter for output pane. -class QmlProfilerOutputPaneAdapter : public Analyzer::IAnalyzerOutputPaneAdapter -{ -public: - explicit QmlProfilerOutputPaneAdapter(QmlProfilerTool *mct) : - IAnalyzerOutputPaneAdapter(mct), m_tool(mct) {} - - virtual QWidget *toolBarWidget() { return m_tool->createToolBarWidget(); } - virtual QWidget *paneWidget() { return m_tool->createTimeLineWidget(); } - virtual void clearContents() { m_tool->clearDisplay(); } - virtual void setFocus() { /*TODO*/ } - virtual bool hasFocus() const { return false; /*TODO*/ } - virtual bool canFocus() const { return false; /*TODO*/ } - virtual bool canNavigate() const { return false; /*TODO*/ } - virtual bool canNext() const { return false; /*TODO*/ } - virtual bool canPrevious() const { return false; /*TODO*/ } - virtual void goToNext() { /*TODO*/ } - virtual void goToPrev() { /*TODO*/ } - -private: - QmlProfilerTool *m_tool; -}; - class QmlProfilerTool::QmlProfilerToolPrivate { public: @@ -111,9 +88,7 @@ public: QTimer m_connectionTimer; int m_connectionAttempts; TraceWindow *m_traceWindow; - QTabWidget *m_tabbed; QmlProfilerSummaryView *m_summary; - QmlProfilerOutputPaneAdapter *m_outputPaneAdapter; ProjectExplorer::Project *m_project; Utils::FileInProjectFinder m_projectFinder; ProjectExplorer::RunConfiguration *m_runConfiguration; @@ -131,7 +106,6 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) d->m_client = 0; d->m_connectionAttempts = 0; d->m_traceWindow = 0; - d->m_outputPaneAdapter = 0; d->m_project = 0; d->m_runConfiguration = 0; d->m_isAttached = false; @@ -144,11 +118,7 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) QmlProfilerTool::~QmlProfilerTool() { - if (d->m_client) - delete d->m_client; - delete d->m_tabbed; - - delete d->m_outputPaneAdapter; + delete d->m_client; delete d; } @@ -201,25 +171,32 @@ void QmlProfilerTool::initialize() qmlRegisterType<Context2D>(); qmlRegisterType<CanvasImage>(); qmlRegisterType<CanvasGradient>(); - qmlRegisterType<TimelineView>("Monitor", 1, 0,"TimelineView"); +} - d->m_tabbed = new QTabWidget(); +void QmlProfilerTool::extensionsInitialized() +{ +} + +void QmlProfilerTool::initializeDockWidgets() +{ + Analyzer::AnalyzerManager *analyzerMgr = Analyzer::AnalyzerManager::instance(); + QMainWindow *mw = analyzerMgr->mainWindow(); - d->m_traceWindow = new TraceWindow(d->m_tabbed); + d->m_traceWindow = new TraceWindow(mw); d->m_traceWindow->reset(d->m_client); - connect(d->m_traceWindow, SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int))); + connect(d->m_traceWindow, SIGNAL(gotoSourceLocation(QString,int)),this, SLOT(gotoSourceLocation(QString,int))); connect(d->m_traceWindow, SIGNAL(timeChanged(qreal)), this, SLOT(updateTimer(qreal))); - d->m_summary = new QmlProfilerSummaryView(d->m_tabbed); - d->m_tabbed->addTab(d->m_traceWindow, "timeline"); - d->m_tabbed->addTab(d->m_summary, "summary"); + d->m_summary = new QmlProfilerSummaryView(mw); - connect(d->m_traceWindow,SIGNAL(range(int,qint64,qint64,QStringList,QString,int)), - d->m_summary,SLOT(addRangedEvent(int,qint64,qint64,QStringList,QString,int))); - connect(d->m_traceWindow,SIGNAL(viewUpdated()), d->m_summary, SLOT(complete())); - connect(d->m_summary,SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int))); + connect(d->m_traceWindow, SIGNAL(range(int,qint64,qint64,QStringList,QString,int)), + d->m_summary, SLOT(addRangedEvent(int,qint64,qint64,QStringList,QString,int))); + connect(d->m_traceWindow, SIGNAL(viewUpdated()), + d->m_summary, SLOT(complete())); + connect(d->m_summary, SIGNAL(gotoSourceLocation(QString,int)), + this, SLOT(gotoSourceLocation(QString,int))); Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); @@ -233,25 +210,25 @@ void QmlProfilerTool::initialize() manalyzer->addAction(command, Analyzer::Constants::G_ANALYZER_STARTSTOP); connect(d->m_attachAction, SIGNAL(triggered()), this, SLOT(attach())); - Analyzer::AnalyzerManager *analyzerMgr = Analyzer::AnalyzerManager::instance(); connect(analyzerMgr, SIGNAL(currentToolChanged(Analyzer::IAnalyzerTool*)), this, SLOT(updateAttachAction())); updateAttachAction(); -} -void QmlProfilerTool::extensionsInitialized() -{ -} + QDockWidget *summaryDock = + analyzerMgr->createDockWidget(this, tr("Summary"), + d->m_summary, Qt::BottomDockWidgetArea); -IAnalyzerOutputPaneAdapter *QmlProfilerTool::outputPaneAdapter() -{ - if (!d->m_outputPaneAdapter) - d->m_outputPaneAdapter = new QmlProfilerOutputPaneAdapter(this); - return d->m_outputPaneAdapter; + QDockWidget *timelineDock = + analyzerMgr->createDockWidget(this, tr("Timeline"), + d->m_traceWindow, Qt::BottomDockWidgetArea); + + //mw->splitDockWidget(flatDock, calleesDock, Qt::Vertical); + mw->tabifyDockWidget(summaryDock, timelineDock); } -QWidget *QmlProfilerTool::createToolBarWidget() + +QWidget *QmlProfilerTool::createControlWidget() { // custom toolbar (TODO) QWidget *toolbarWidget = new QWidget; @@ -282,11 +259,6 @@ QWidget *QmlProfilerTool::createToolBarWidget() return toolbarWidget; } -QWidget *QmlProfilerTool::createTimeLineWidget() -{ - return d->m_tabbed; -} - void QmlProfilerTool::connectClient() { QTC_ASSERT(!d->m_client, return;) @@ -304,7 +276,6 @@ void QmlProfilerTool::connectToClient() if (QmlProfilerPlugin::debugOutput) qWarning("QmlProfiler: Connecting to %s:%lld ...", qPrintable(d->m_host), d->m_port); - d->m_client->connectToHost(d->m_host, d->m_port); } diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h index aec6864464..fd590c3e1a 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.h +++ b/src/plugins/qmlprofiler/qmlprofilertool.h @@ -54,13 +54,12 @@ public: void initialize(); void extensionsInitialized(); + void initializeDockWidgets(); Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration = 0); - Analyzer::IAnalyzerOutputPaneAdapter *outputPaneAdapter(); - QWidget *createToolBarWidget(); - QWidget *createTimeLineWidget(); + QWidget *createControlWidget(); bool canRunRemotely() const; bool needsOutputPane() const { return false; } diff --git a/src/plugins/qmlprofiler/tracewindow.cpp b/src/plugins/qmlprofiler/tracewindow.cpp index b4731ae8ea..386ad2ec6e 100644 --- a/src/plugins/qmlprofiler/tracewindow.cpp +++ b/src/plugins/qmlprofiler/tracewindow.cpp @@ -73,6 +73,7 @@ class TracePlugin : public QDeclarativeDebugClient { Q_OBJECT Q_PROPERTY(bool recording READ recording WRITE setRecording NOTIFY recordingChanged) + public: TracePlugin(QDeclarativeDebugConnection *client); |