Commit 251bff8a authored by hjk's avatar hjk Committed by hjk

analyze: rework 'addDock'

Change-Id: I3ce22c3f75d5cc631ab22e02f8a52af00452c0c3
Reviewed-on: http://codereview.qt.nokia.com/57Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: hjk
parent 39b71920
......@@ -200,7 +200,7 @@ public:
const QString &stopButtonText,
const QString &cancelButtonText) const;
void addDock(IAnalyzerTool *tool, Qt::DockWidgetArea area, QDockWidget *dockWidget);
void addDock(Qt::DockWidgetArea area, QDockWidget *dockWidget);
void startTool();
AnalyzerManager *q;
......@@ -450,11 +450,9 @@ QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeMainWindow()
return m_mainWindow;
}
void AnalyzerManager::AnalyzerManagerPrivate::addDock(IAnalyzerTool *tool, Qt::DockWidgetArea area,
void AnalyzerManager::AnalyzerManagerPrivate::addDock(Qt::DockWidgetArea area,
QDockWidget *dockWidget)
{
QTC_ASSERT(tool == q->currentTool(), return)
dockWidget->setParent(m_mainWindow);
m_mainWindow->addDockWidget(area, dockWidget);
......@@ -467,11 +465,6 @@ void AnalyzerManager::AnalyzerManagerPrivate::addDock(IAnalyzerTool *tool, Qt::D
globalContext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd);
// just add the dock below the toolbar by default
m_mainWindow->splitDockWidget(m_mainWindow->toolBarDockWidget(), dockWidget,
Qt::Vertical);
dockWidget->show();
}
bool buildTypeAccepted(IAnalyzerTool::ToolMode toolMode,
......@@ -687,7 +680,7 @@ void AnalyzerManager::toolSelected(int idx)
d->m_defaultSettings.insert(newTool, d->m_mainWindow->saveSettings());
} else {
foreach (const ToolDockWidgetData &widget, d->m_toolWidgets.value(newTool))
d->addDock(newTool, widget.area, widget.widget);
d->addDock(widget.area, widget.widget);
}
loadToolSettings(newTool);
......@@ -748,7 +741,7 @@ QDockWidget *AnalyzerManager::createDockWidget(IAnalyzerTool *tool, const QStrin
dockWidget->setWindowTitle(title);
d->m_toolWidgets[tool].push_back(ToolDockWidgetData(area, dockWidget));
d->addDock(tool, area, dockWidget);
d->addDock(area, dockWidget);
dockWidget->installEventFilter(d->m_resizeEventFilter);
return dockWidget;
}
......
......@@ -575,15 +575,15 @@ void CallgrindTool::initializeDockWidgets()
void CallgrindToolPrivate::initializeDockWidgets()
{
AnalyzerManager *am = AnalyzerManager::instance();
QWidget *parenWidget = am->mainWindow();
m_visualisation = new Visualisation(parenWidget);
Utils::FancyMainWindow *mw = am->mainWindow();
m_visualisation = new Visualisation(mw);
m_visualisation->setFrameStyle(QFrame::NoFrame);
m_visualisation->setObjectName("Valgrind.CallgrindToolPrivate.Visualisation");
m_visualisation->setModel(m_dataModel);
connect(m_visualisation, SIGNAL(functionActivated(const Valgrind::Callgrind::Function*)),
this, SLOT(visualisationFunctionSelected(const Valgrind::Callgrind::Function*)));
m_callersView = new CostView(parenWidget);
m_callersView = new CostView(mw);
m_callersView->sortByColumn(CallModel::CostColumn);
m_callersView->setObjectName("Valgrind.CallgrindToolPrivate.CallersView");
m_callersView->setFrameStyle(QFrame::NoFrame);
......@@ -595,7 +595,7 @@ void CallgrindToolPrivate::initializeDockWidgets()
connect(m_callersView, SIGNAL(activated(QModelIndex)),
this, SLOT(callerFunctionSelected(QModelIndex)));
m_calleesView = new CostView(parenWidget);
m_calleesView = new CostView(mw);
m_calleesView->sortByColumn(CallModel::CostColumn);
m_calleesView->setObjectName("Valgrind.CallgrindToolPrivate.CalleesView");
m_calleesView->setFrameStyle(QFrame::NoFrame);
......@@ -607,7 +607,7 @@ void CallgrindToolPrivate::initializeDockWidgets()
connect(m_calleesView, SIGNAL(activated(QModelIndex)),
this, SLOT(calleeFunctionSelected(QModelIndex)));
m_flatView = new CostView(parenWidget);
m_flatView = new CostView(mw);
m_flatView->sortByColumn(DataModel::SelfCostColumn);
m_flatView->setFrameStyle(QFrame::NoFrame);
m_flatView->setAttribute(Qt::WA_MacShowFocusRect, false);
......@@ -618,24 +618,27 @@ void CallgrindToolPrivate::initializeDockWidgets()
updateCostFormat();
//QDockWidget *callersDock =
QDockWidget *callersDock =
am->createDockWidget(q, tr("Callers"), m_callersView,
Qt::BottomDockWidgetArea);
QDockWidget *flatDock =
am->createDockWidget(q, tr("Functions"), m_flatView,
Qt::LeftDockWidgetArea);
Qt::BottomDockWidgetArea);
QDockWidget *calleesDock =
am->createDockWidget(q, tr("Callees"), m_calleesView,
Qt::BottomDockWidgetArea);
//QDockWidget *visDock =
QDockWidget *visualizationDock =
am->createDockWidget(q, tr("Visualization"), m_visualisation,
Qt::LeftDockWidgetArea);
Qt::RightDockWidgetArea);
visualizationDock->hide();
am->mainWindow()->splitDockWidget(flatDock, calleesDock, Qt::Vertical);
am->mainWindow()->tabifyDockWidget(flatDock, calleesDock);
mw->splitDockWidget(mw->toolBarDockWidget(), calleesDock, Qt::Vertical);
mw->splitDockWidget(mw->toolBarDockWidget(), callersDock, Qt::Vertical);
mw->splitDockWidget(mw->toolBarDockWidget(), flatDock, Qt::Vertical);
mw->tabifyDockWidget(callersDock, calleesDock);
}
IAnalyzerEngine *CallgrindTool::createEngine(const AnalyzerStartParameters &sp,
......
......@@ -181,7 +181,7 @@ void QmlProfilerTool::extensionsInitialized()
void QmlProfilerTool::initializeDockWidgets()
{
Analyzer::AnalyzerManager *analyzerMgr = Analyzer::AnalyzerManager::instance();
QMainWindow *mw = analyzerMgr->mainWindow();
Utils::FancyMainWindow *mw = analyzerMgr->mainWindow();
d->m_traceWindow = new TraceWindow(mw);
d->m_traceWindow->reset(d->m_client);
......@@ -223,7 +223,7 @@ void QmlProfilerTool::initializeDockWidgets()
analyzerMgr->createDockWidget(this, tr("Timeline"),
d->m_traceWindow, Qt::BottomDockWidgetArea);
//mw->splitDockWidget(flatDock, calleesDock, Qt::Vertical);
mw->splitDockWidget(mw->toolBarDockWidget(), summaryDock, Qt::Vertical);
mw->tabifyDockWidget(summaryDock, timelineDock);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment