analyzer: refactor AnalyzerManager

Change-Id: Id925bb638b2757ef079c21192d4e2a8cc8f08694
Reviewed-on: http://codereview.qt.nokia.com/908
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-06-29 16:04:03 +02:00
committed by hjk
parent ee595ceb3e
commit b6c0f3d8a6
10 changed files with 366 additions and 348 deletions

View File

@@ -277,13 +277,10 @@ void QmlProfilerTool::initializeDockWidgets()
Core::Command *command = am->registerAction(d->m_attachAction,
Constants::ATTACH, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
manalyzer->addAction(command, Analyzer::Constants::G_ANALYZER_STARTSTOP);
//manalyzer->addAction(command, Analyzer::Constants::G_ANALYZER_STARTSTOP);
connect(d->m_attachAction, SIGNAL(triggered()), this, SLOT(attach()));
connect(analyzerMgr, SIGNAL(currentToolChanged(Analyzer::IAnalyzerTool*)),
this, SLOT(updateAttachAction()));
updateAttachAction();
updateAttachAction(false);
QDockWidget *summaryDock =
analyzerMgr->createDockWidget(this, tr("Bindings"),
@@ -307,6 +304,15 @@ void QmlProfilerTool::initializeDockWidgets()
mw->tabifyDockWidget(calleeDock, callerDock);
}
void QmlProfilerTool::toolSelected()
{
updateAttachAction(true);
}
void QmlProfilerTool::toolDeselected()
{
updateAttachAction(false);
}
QWidget *QmlProfilerTool::createControlWidget()
{
@@ -475,20 +481,16 @@ void QmlProfilerTool::attach()
}
d->m_isAttached = !d->m_isAttached;
updateAttachAction();
updateAttachAction(true);
}
void QmlProfilerTool::updateAttachAction()
void QmlProfilerTool::updateAttachAction(bool isCurrentTool)
{
if (d->m_attachAction) {
if (d->m_isAttached) {
d->m_attachAction->setText(tr("Detach"));
} else {
d->m_attachAction->setText(tr("Attach..."));
}
}
d->m_attachAction->setEnabled(Analyzer::AnalyzerManager::instance()->currentTool() == this);
if (d->m_isAttached)
d->m_attachAction->setText(tr("Detach"));
else
d->m_attachAction->setText(tr("Attach..."));
d->m_attachAction->setEnabled(isCurrentTool);
}
void QmlProfilerTool::tryToConnect()