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

@@ -54,8 +54,6 @@
using namespace Analyzer;
using namespace Analyzer::Internal;
static const char lastActiveToolC[] = "Analyzer.Plugin.LastActiveTool";
AnalyzerPlugin *AnalyzerPlugin::m_instance = 0;
@@ -113,34 +111,11 @@ bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorStri
void AnalyzerPlugin::extensionsInitialized()
{
const QList<IAnalyzerTool *> tools = d->m_manager->tools();
if (tools.isEmpty())
return;
const QSettings *settings = Core::ICore::instance()->settings();
const QString lastActiveToolId =
settings->value(QLatin1String(lastActiveToolC), QString()).toString();
IAnalyzerTool *lastActiveTool = 0;
foreach (IAnalyzerTool *tool, tools) {
tool->extensionsInitialized();
if (tool->id() == lastActiveToolId)
lastActiveTool = tool;
}
if (!lastActiveTool)
lastActiveTool = tools.back();
if (lastActiveTool)
d->m_manager->selectTool(lastActiveTool);
d->m_manager->extensionsInitialized();
}
ExtensionSystem::IPlugin::ShutdownFlag AnalyzerPlugin::aboutToShutdown()
{
if (const IAnalyzerTool *tool = d->m_manager->currentTool()) {
QSettings *settings = Core::ICore::instance()->settings();
settings->setValue(QLatin1String(lastActiveToolC), tool->id());
}
d->m_manager->shutdown();
return SynchronousShutdown;
}