aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorhjk <[email protected]>2011-05-18 15:47:23 +0200
committerhjk <[email protected]>2011-05-18 16:37:19 +0200
commit64eba7e1dd7a6db3b51ecdf4c196ee3ccbdcca6c (patch)
treea0157648567b18f121e92c85cebc177ce18960fc /src/plugins
parent0dc449944d379cdc4ebaa0930ab316bccd0ebd5c (diff)
analyzer: make the callgrind "functions" view a dockwidget again
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/callgrind/callgrindtool.cpp87
-rw-r--r--src/plugins/callgrind/callgrindtool.h5
-rw-r--r--src/plugins/callgrind/callgrindwidgethandler.cpp19
3 files changed, 41 insertions, 70 deletions
diff --git a/src/plugins/callgrind/callgrindtool.cpp b/src/plugins/callgrind/callgrindtool.cpp
index bd60118dd53..53f1a9e2b9a 100644
--- a/src/plugins/callgrind/callgrindtool.cpp
+++ b/src/plugins/callgrind/callgrindtool.cpp
@@ -91,26 +91,6 @@ using namespace Valgrind::Callgrind;
namespace Callgrind {
namespace Internal {
-// Adapter for output pane.
-class CallgrindOutputPaneAdapter : public Analyzer::ListItemViewOutputPaneAdapter
-{
-public:
- explicit CallgrindOutputPaneAdapter(CallgrindTool *mct) :
- ListItemViewOutputPaneAdapter(mct), m_tool(mct) {}
-
- virtual QWidget *toolBarWidget() { return m_tool->createPaneToolBarWidget(); }
- virtual void clearContents() { m_tool->clearErrorView(); }
-
-protected:
- virtual QAbstractItemView *createItemView()
- {
- return m_tool->callgrindWidgetHandler()->flatView();
- }
-
-private:
- CallgrindTool *m_tool;
-};
-
static QToolButton *createToolButton(QAction *action)
{
QToolButton *button = new QToolButton;
@@ -126,7 +106,7 @@ CallgrindTool::CallgrindTool(QObject *parent)
, m_resetAction(0)
, m_pauseAction(0)
, m_showCostsOfFunctionAction(0)
-, m_outputPaneAdapter(0)
+, m_toolbarWidget(0)
{
Core::ICore *core = Core::ICore::instance();
@@ -171,22 +151,45 @@ void CallgrindTool::initializeDockWidgets()
{
AnalyzerManager *am = AnalyzerManager::instance();
- QDockWidget *callersDock =
+ //QDockWidget *callersDock =
am->createDockWidget(this, tr("Callers"),
m_callgrindWidgetHandler->callersView(),
Qt::BottomDockWidgetArea);
+ QDockWidget *flatDock =
+ am->createDockWidget(this, tr("Functions"),
+ m_callgrindWidgetHandler->flatView(),
+ Qt::LeftDockWidgetArea);
+
QDockWidget *calleesDock =
am->createDockWidget(this, tr("Callees"),
m_callgrindWidgetHandler->calleesView(),
Qt::BottomDockWidgetArea);
- QDockWidget *visDock =
- am->createDockWidget(this, tr("Visualization"),
- m_callgrindWidgetHandler->visualisation(), Qt::LeftDockWidgetArea);
+ //QDockWidget *visDock =
+ am->createDockWidget(this, tr("Visualization"),
+ m_callgrindWidgetHandler->visualisation(),
+ Qt::LeftDockWidgetArea);
+
+ am->mainWindow()->splitDockWidget(flatDock, calleesDock, Qt::Vertical);
+ am->mainWindow()->tabifyDockWidget(flatDock, calleesDock);
+
+ m_toolbarWidget = new QWidget;
+ m_toolbarWidget->setObjectName("CallgrindToolBarWidget");
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->setMargin(0);
+ layout->setSpacing(0);
+ m_toolbarWidget->setLayout(layout);
+
+ m_callgrindWidgetHandler->populateActions(layout);
- am->mainWindow()->tabifyDockWidget(callersDock, calleesDock);
- am->mainWindow()->tabifyDockWidget(calleesDock, visDock);
+ CallgrindGlobalSettings *settings = AnalyzerGlobalSettings::instance()->subConfig<CallgrindGlobalSettings>();
+ m_callgrindWidgetHandler->setCostFormat(settings->costFormat());
+ m_callgrindWidgetHandler->enableCycleDetection(settings->detectCycles());
+ connect(m_callgrindWidgetHandler, SIGNAL(costFormatChanged(Callgrind::Internal::CostDelegate::CostFormat)),
+ settings, SLOT(setCostFormat(Callgrind::Internal::CostDelegate::CostFormat)));
+ connect(m_callgrindWidgetHandler, SIGNAL(cycleDetectionEnabled(bool)),
+ settings, SLOT(setDetectCycles(bool)));
}
void CallgrindTool::extensionsInitialized()
@@ -303,28 +306,6 @@ CallgrindWidgetHandler *CallgrindTool::callgrindWidgetHandler() const
return m_callgrindWidgetHandler;
}
-QWidget *CallgrindTool::createPaneToolBarWidget()
-{
- QWidget *toolbarWidget = new QWidget;
- toolbarWidget->setObjectName("CallgrindToolBarWidget");
- QHBoxLayout *layout = new QHBoxLayout;
- layout->setMargin(0);
- layout->setSpacing(0);
- toolbarWidget->setLayout(layout);
-
- m_callgrindWidgetHandler->populateActions(layout);
-
- CallgrindGlobalSettings *settings = AnalyzerGlobalSettings::instance()->subConfig<CallgrindGlobalSettings>();
- m_callgrindWidgetHandler->setCostFormat(settings->costFormat());
- m_callgrindWidgetHandler->enableCycleDetection(settings->detectCycles());
- connect(m_callgrindWidgetHandler, SIGNAL(costFormatChanged(Callgrind::Internal::CostDelegate::CostFormat)),
- settings, SLOT(setCostFormat(Callgrind::Internal::CostDelegate::CostFormat)));
- connect(m_callgrindWidgetHandler, SIGNAL(cycleDetectionEnabled(bool)),
- settings, SLOT(setDetectCycles(bool)));
-
- return toolbarWidget;
-}
-
void CallgrindTool::clearErrorView()
{
clearTextMarks();
@@ -505,18 +486,10 @@ void CallgrindTool::createTextMarks()
}
}
-IAnalyzerOutputPaneAdapter *CallgrindTool::outputPaneAdapter()
-{
- if (!m_outputPaneAdapter)
- m_outputPaneAdapter = new CallgrindOutputPaneAdapter(this);
- return m_outputPaneAdapter;
-}
-
bool CallgrindTool::canRunRemotely() const
{
return true;
}
-
}
}
diff --git a/src/plugins/callgrind/callgrindtool.h b/src/plugins/callgrind/callgrindtool.h
index f7385e81cf3..a7e11a4e868 100644
--- a/src/plugins/callgrind/callgrindtool.h
+++ b/src/plugins/callgrind/callgrindtool.h
@@ -91,14 +91,12 @@ public:
virtual void extensionsInitialized();
virtual void initializeDockWidgets();
- virtual Analyzer::IAnalyzerOutputPaneAdapter *outputPaneAdapter();
virtual Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
virtual QWidget *createControlWidget();
// For the output pane adapter.
CallgrindWidgetHandler *callgrindWidgetHandler() const;
- QWidget *createPaneToolBarWidget();
void clearErrorView();
virtual bool canRunRemotely() const;
@@ -143,8 +141,7 @@ private:
QAction *m_pauseAction;
QAction *m_showCostsOfFunctionAction;
-
- CallgrindOutputPaneAdapter *m_outputPaneAdapter;
+ QWidget *m_toolbarWidget;
QString m_toggleCollectFunction;
};
diff --git a/src/plugins/callgrind/callgrindwidgethandler.cpp b/src/plugins/callgrind/callgrindwidgethandler.cpp
index 8110b074c74..a6639322fec 100644
--- a/src/plugins/callgrind/callgrindwidgethandler.cpp
+++ b/src/plugins/callgrind/callgrindwidgethandler.cpp
@@ -108,15 +108,6 @@ CallgrindWidgetHandler::CallgrindWidgetHandler(QWidget *parent)
m_dataProxy->setSortCaseSensitivity(Qt::CaseInsensitive);
m_dataProxy->setFilterKeyColumn(DataModel::NameColumn);
m_dataProxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
-
- m_flatView = new CostView(parent);
- m_flatView->sortByColumn(DataModel::SelfCostColumn);
- m_flatView->setFrameStyle(QFrame::NoFrame);
- m_flatView->setAttribute(Qt::WA_MacShowFocusRect, false);
- m_flatView->setModel(m_dataProxy);
- m_flatView->setObjectName("Valgrind.CallgrindWidgetHandler.FlatView");
- connect(m_flatView, SIGNAL(activated(QModelIndex)),
- this, SLOT(dataFunctionSelected(QModelIndex)));
}
void CallgrindWidgetHandler::ensureDockWidgets()
@@ -154,6 +145,16 @@ void CallgrindWidgetHandler::ensureDockWidgets()
m_calleesView->hideColumn(CallModel::CallerColumn);
connect(m_calleesView, SIGNAL(activated(QModelIndex)),
this, SLOT(calleeFunctionSelected(QModelIndex)));
+
+ m_flatView = new CostView(parenWidget);
+ m_flatView->sortByColumn(DataModel::SelfCostColumn);
+ m_flatView->setFrameStyle(QFrame::NoFrame);
+ m_flatView->setAttribute(Qt::WA_MacShowFocusRect, false);
+ m_flatView->setModel(m_dataProxy);
+ m_flatView->setObjectName("Valgrind.CallgrindWidgetHandler.FlatView");
+ connect(m_flatView, SIGNAL(activated(QModelIndex)),
+ this, SLOT(dataFunctionSelected(QModelIndex)));
+
updateCostFormat();
}