summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/analyzerbase/AnalyzerBase.pluginspec.in20
-rw-r--r--src/plugins/analyzerbase/analyzerbase.pri5
-rw-r--r--src/plugins/analyzerbase/analyzerbase.pro36
-rw-r--r--src/plugins/analyzerbase/analyzerbase.qrc7
-rw-r--r--src/plugins/analyzerbase/analyzerbase_dependencies.pri2
-rw-r--r--src/plugins/analyzerbase/analyzerbase_global.h47
-rw-r--r--src/plugins/analyzerbase/analyzerconstants.h69
-rw-r--r--src/plugins/analyzerbase/analyzermanager.cpp683
-rw-r--r--src/plugins/analyzerbase/analyzermanager.h186
-rw-r--r--src/plugins/analyzerbase/analyzeroptionspage.cpp95
-rw-r--r--src/plugins/analyzerbase/analyzeroptionspage.h72
-rw-r--r--src/plugins/analyzerbase/analyzerplugin.cpp143
-rw-r--r--src/plugins/analyzerbase/analyzerplugin.h69
-rw-r--r--src/plugins/analyzerbase/analyzerrunconfigwidget.cpp77
-rw-r--r--src/plugins/analyzerbase/analyzerrunconfigwidget.h80
-rw-r--r--src/plugins/analyzerbase/analyzerruncontrol.cpp196
-rw-r--r--src/plugins/analyzerbase/analyzerruncontrol.h113
-rw-r--r--src/plugins/analyzerbase/analyzersettings.cpp187
-rw-r--r--src/plugins/analyzerbase/analyzersettings.h197
-rw-r--r--src/plugins/analyzerbase/ianalyzerengine.cpp49
-rw-r--r--src/plugins/analyzerbase/ianalyzerengine.h78
-rw-r--r--src/plugins/analyzerbase/ianalyzertool.cpp56
-rw-r--r--src/plugins/analyzerbase/ianalyzertool.h86
-rw-r--r--src/plugins/analyzerbase/images/analyzer_category.pngbin0 -> 1072 bytes
-rw-r--r--src/plugins/analyzerbase/images/analyzer_mode.pngbin0 -> 1694 bytes
-rw-r--r--src/plugins/analyzerbase/images/analyzer_start_small.pngbin0 -> 729 bytes
-rw-r--r--src/plugins/plugins.pro5
27 files changed, 2558 insertions, 0 deletions
diff --git a/src/plugins/analyzerbase/AnalyzerBase.pluginspec.in b/src/plugins/analyzerbase/AnalyzerBase.pluginspec.in
new file mode 100644
index 0000000000..b64f7d8d06
--- /dev/null
+++ b/src/plugins/analyzerbase/AnalyzerBase.pluginspec.in
@@ -0,0 +1,20 @@
+<plugin name=\"AnalyzerBase\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_VERSION\">
+ <vendor>Nokia Corporation</vendor>
+ <copyright>(C) 2011 Nokia Corporation</copyright>
+ <license>
+Commercial Usage
+
+Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
+
+GNU Lesser General Public License Usage
+
+Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License version 2.1 requirements will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ </license>
+ <category>Code Analyzer</category>
+ <description>Code Analyzer Base Plugin</description>
+ <url>http://qt.nokia.com</url>
+ <dependencyList>
+ <dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/>
+ <dependency name=\"ProjectExplorer\" version=\"$$QTCREATOR_VERSION\"/>
+ </dependencyList>
+</plugin>
diff --git a/src/plugins/analyzerbase/analyzerbase.pri b/src/plugins/analyzerbase/analyzerbase.pri
new file mode 100644
index 0000000000..7d37bb401d
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerbase.pri
@@ -0,0 +1,5 @@
+include(analyzerbase_dependencies.pri)
+
+INCLUDEPATH += $$PWD
+DEPENDPATH += $$PWD
+LIBS *= -l$$qtLibraryName(AnalyzerBase)
diff --git a/src/plugins/analyzerbase/analyzerbase.pro b/src/plugins/analyzerbase/analyzerbase.pro
new file mode 100644
index 0000000000..a2af77de91
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerbase.pro
@@ -0,0 +1,36 @@
+TEMPLATE = lib
+TARGET = AnalyzerBase
+
+DEFINES += ANALYZER_LIBRARY
+
+include(../../qtcreatorplugin.pri)
+include(analyzerbase_dependencies.pri)
+
+QT += network
+
+# AnalyzerBase files
+
+SOURCES += \
+ ianalyzerengine.cpp \
+ ianalyzertool.cpp \
+ analyzerplugin.cpp \
+ analyzerruncontrol.cpp \
+ analyzermanager.cpp \
+ analyzersettings.cpp \
+ analyzeroptionspage.cpp \
+ analyzerrunconfigwidget.cpp
+
+HEADERS += \
+ ianalyzerengine.h \
+ ianalyzertool.h \
+ analyzerbase_global.h \
+ analyzerconstants.h \
+ analyzerplugin.h \
+ analyzerruncontrol.h \
+ analyzermanager.h \
+ analyzersettings.h \
+ analyzeroptionspage.h \
+ analyzerrunconfigwidget.h
+
+RESOURCES += \
+ analyzerbase.qrc
diff --git a/src/plugins/analyzerbase/analyzerbase.qrc b/src/plugins/analyzerbase/analyzerbase.qrc
new file mode 100644
index 0000000000..679ef7db3d
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerbase.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/analyzer_mode.png</file>
+ <file>images/analyzer_category.png</file>
+ <file>images/analyzer_start_small.png</file>
+ </qresource>
+</RCC>
diff --git a/src/plugins/analyzerbase/analyzerbase_dependencies.pri b/src/plugins/analyzerbase/analyzerbase_dependencies.pri
new file mode 100644
index 0000000000..a3a44bbdaa
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerbase_dependencies.pri
@@ -0,0 +1,2 @@
+include(../../plugins/coreplugin/coreplugin.pri)
+include(../../plugins/projectexplorer/projectexplorer.pri) \ No newline at end of file
diff --git a/src/plugins/analyzerbase/analyzerbase_global.h b/src/plugins/analyzerbase/analyzerbase_global.h
new file mode 100644
index 0000000000..fa2f4a5e05
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerbase_global.h
@@ -0,0 +1,47 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef ANALYZERBASE_GLOBAL_H
+#define ANALYZERBASE_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+#if defined(ANALYZER_LIBRARY)
+# define ANALYZER_EXPORT Q_DECL_EXPORT
+#else
+# define ANALYZER_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // ANALYZERBASE_GLOBAL_H
diff --git a/src/plugins/analyzerbase/analyzerconstants.h b/src/plugins/analyzerbase/analyzerconstants.h
new file mode 100644
index 0000000000..6c89899b65
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerconstants.h
@@ -0,0 +1,69 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef ANALYZERCONSTANTS_H
+#define ANALYZERCONSTANTS_H
+
+#include <QtGlobal>
+
+namespace Analyzer {
+namespace Constants {
+
+// modes and their priorities
+const char * const MODE_ANALYZE = "Analyzer.Mode.Analyze";
+const int P_MODE_ANALYZE = 60;
+
+// context
+const char * const C_ANALYZEMODE = "Analyzer.AnalyzeMode";
+
+// menu
+const char * const M_TOOLS_ANALYZER = "Analyzer.Tools.Menu";
+
+const char * const START = "Analyzer.Start";
+const char * const STOP = "Analyzer.Stop";
+
+// options dialog
+const char * const ANALYZER_SETTINGS_CATEGORY = "T.Analyzer";
+const char * const ANALYZER_SETTINGS_TR_CATEGORY =
+ QT_TRANSLATE_NOOP("Analyzer", "Analyzer");
+const char * const ANALYZER_SETTINGS_CATEGORY_ICON =
+ ":/images/analyzer_category.png";
+
+const char * const ANALYZERTASK_ID = "Analyzer.TaskId";
+
+} // namespace Constants
+} // namespace Analyzer
+
+#endif // ANALYZERCONSTANTS_H
diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp
new file mode 100644
index 0000000000..0564f11dac
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzermanager.cpp
@@ -0,0 +1,683 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Andreas Hartmetz, KDAB (andreas.hartmetz@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "analyzermanager.h"
+
+#include "ianalyzertool.h"
+#include "analyzerplugin.h"
+#include "analyzerruncontrol.h"
+#include "analyzeroptionspage.h"
+
+#include <coreplugin/actionmanager/command.h>
+#include <coreplugin/findplaceholder.h>
+#include <coreplugin/minisplitter.h>
+#include <coreplugin/modemanager.h>
+#include <coreplugin/navigationwidget.h>
+#include <coreplugin/outputpane.h>
+#include <coreplugin/rightpane.h>
+#include <coreplugin/actionmanager/actionmanager.h>
+#include <coreplugin/actionmanager/actioncontainer.h>
+#include <coreplugin/icore.h>
+#include <coreplugin/uniqueidmanager.h>
+
+#include <projectexplorer/buildmanager.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/project.h>
+#include <projectexplorer/runconfiguration.h>
+#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/iprojectmanager.h>
+#include <projectexplorer/target.h>
+
+#include <extensionsystem/iplugin.h>
+
+#include <utils/fancymainwindow.h>
+#include <utils/styledbar.h>
+#include <utils/qtcassert.h>
+
+#include <cmakeprojectmanager/cmakeprojectconstants.h>
+#include <qt4projectmanager/qt4projectmanagerconstants.h>
+
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QDockWidget>
+#include <QVariant>
+#include <QAction>
+#include <QMenu>
+#include <QMenuBar>
+#include <QToolButton>
+#include <QComboBox>
+#include <QStackedWidget>
+#include <QDebug>
+#include <QDialog>
+#include <QApplication>
+#include <QLabel>
+#include <QCheckBox>
+#include <QDialogButtonBox>
+
+
+using namespace Core;
+using namespace Analyzer;
+using namespace Analyzer::Internal;
+
+namespace Analyzer {
+namespace Internal {
+
+bool DockWidgetEventFilter::eventFilter(QObject *obj, QEvent *event)
+{
+ switch (event->type()) {
+ case QEvent::Resize:
+ case QEvent::ZOrderChange:
+ emit widgetResized();
+ break;
+ default:
+ break;
+ }
+ return QObject::eventFilter(obj, event);
+}
+
+// AnalyzerMode ////////////////////////////////////////////////////
+
+} // namespace Internal
+} // namespace Analyzer
+
+// AnalyzerManagerPrivate ////////////////////////////////////////////////////
+class AnalyzerManager::AnalyzerManagerPrivate
+{
+public:
+ AnalyzerManagerPrivate(AnalyzerManager *qq);
+ ~AnalyzerManagerPrivate();
+
+ void setupActions();
+ QWidget *createContents();
+ QWidget *createMainWindow();
+
+ void addDock(IAnalyzerTool* tool, Qt::DockWidgetArea area, QDockWidget* dockWidget);
+ void startTool();
+
+ AnalyzerManager *q;
+ AnalyzerMode *m_mode;
+ AnalyzerRunControlFactory *m_runControlFactory;
+ ProjectExplorer::RunControl *m_currentRunControl;
+ bool m_isWaitingForBuild;
+ Utils::FancyMainWindow *m_mainWindow;
+ QList<IAnalyzerTool*> m_tools;
+ QActionGroup *m_toolGroup;
+ QAction *m_startAction;
+ QAction *m_stopAction;
+ QMenu *m_menu;
+ QComboBox *m_toolBox;
+ Utils::StyledSeparator *m_toolBoxSeparator;
+ ActionContainer *m_viewsMenu;
+ typedef QPair<Qt::DockWidgetArea, QDockWidget*> ToolWidgetPair;
+ QMap<IAnalyzerTool*, QList<ToolWidgetPair> > m_toolWidgets;
+ DockWidgetEventFilter *m_resizeEventFilter;
+ QMap<IAnalyzerTool*, QWidget*> m_toolToolbarWidgets;
+ QStackedWidget *m_toolbarStackedWidget;
+ QMap<IAnalyzerTool *, QSettings *> m_defaultSettings;
+};
+
+AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
+ q(qq),
+ m_mode(0),
+ m_runControlFactory(0),
+ m_currentRunControl(0),
+ m_isWaitingForBuild(false),
+ m_mainWindow(0),
+ m_toolGroup(0),
+ m_startAction(0),
+ m_stopAction(0),
+ m_menu(0),
+ m_toolBox(0),
+ m_toolBoxSeparator(0),
+ m_viewsMenu(0),
+ m_resizeEventFilter(new DockWidgetEventFilter(qq)),
+ m_toolbarStackedWidget(0)
+{
+ m_runControlFactory = new AnalyzerRunControlFactory();
+ AnalyzerPlugin::instance()->addAutoReleasedObject(m_runControlFactory);
+ connect(m_runControlFactory, SIGNAL(runControlCreated(AnalyzerRunControl *)),
+ q, SLOT(runControlCreated(AnalyzerRunControl *)));
+
+ setupActions();
+
+ m_mode = new AnalyzerMode(q);
+ m_mode->setWidget(createContents());
+ AnalyzerPlugin::instance()->addAutoReleasedObject(m_mode);
+}
+
+AnalyzerManager::AnalyzerManagerPrivate::~AnalyzerManagerPrivate()
+{
+}
+
+void AnalyzerManager::AnalyzerManagerPrivate::setupActions()
+{
+ Core::ICore *core = Core::ICore::instance();
+ Core::ActionManager *am = core->actionManager();
+ Core::ActionContainer *mtools = am->actionContainer(ProjectExplorer::Constants::M_DEBUG);
+ Core::ActionContainer *mAnalyzermenu = am->createMenu(Constants::M_TOOLS_ANALYZER);
+
+ // Menus
+ m_menu = mAnalyzermenu->menu();
+ m_menu->setTitle(tr("Start &Analyzer"));
+ m_menu->setEnabled(true);
+ mtools->addMenu(mAnalyzermenu);
+
+ m_toolGroup = new QActionGroup(m_menu);
+ connect(m_toolGroup, SIGNAL(triggered(QAction*)),
+ q, SLOT(toolSelected(QAction*)));
+
+ const Core::Context globalcontext(Core::Constants::C_GLOBAL);
+
+ m_startAction = new QAction(tr("Start"), m_menu);
+ m_startAction->setIcon(QIcon(QLatin1String(":/images/analyzer_start_small.png")));
+ Core::Command *command = am->registerAction(m_startAction,
+ Constants::START, globalcontext);
+ mAnalyzermenu->addAction(command);
+ connect(m_startAction, SIGNAL(triggered()), q, SLOT(startTool()));
+
+ m_stopAction = new QAction(tr("Stop"), m_menu);
+ m_stopAction->setEnabled(false);
+ m_stopAction->setIcon(QIcon(QLatin1String(":/debugger/images/debugger_stop_small.png")));
+ command = am->registerAction(m_stopAction, Constants::STOP, globalcontext);
+ mAnalyzermenu->addAction(command);
+ connect(m_stopAction, SIGNAL(triggered()), q, SLOT(stopTool()));
+
+ m_menu->addSeparator();
+
+ m_viewsMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
+}
+
+QWidget *AnalyzerManager::AnalyzerManagerPrivate::createContents()
+{
+ // right-side window with editor, output etc.
+ MiniSplitter *mainWindowSplitter = new MiniSplitter;
+ mainWindowSplitter->addWidget(createMainWindow());
+ mainWindowSplitter->addWidget(new OutputPanePlaceHolder(m_mode, mainWindowSplitter));
+ mainWindowSplitter->setStretchFactor(0, 10);
+ mainWindowSplitter->setStretchFactor(1, 0);
+ mainWindowSplitter->setOrientation(Qt::Vertical);
+
+ // navigation + right-side window
+ MiniSplitter *splitter = new MiniSplitter;
+ splitter->addWidget(new NavigationWidgetPlaceHolder(m_mode));
+ splitter->addWidget(mainWindowSplitter);
+ splitter->setStretchFactor(0, 0);
+ splitter->setStretchFactor(1, 1);
+ return splitter;
+}
+
+static QToolButton *toolButton(QAction *action)
+{
+ QToolButton *button = new QToolButton;
+ button->setDefaultAction(action);
+ return button;
+}
+
+QWidget *AnalyzerManager::AnalyzerManagerPrivate::createMainWindow()
+{
+ m_mainWindow = new Utils::FancyMainWindow();
+ connect(m_mainWindow, SIGNAL(resetLayout()),
+ q, SLOT(resetLayout()));
+ m_mainWindow->setDocumentMode(true);
+ m_mainWindow->setDockNestingEnabled(true);
+ m_mainWindow->setDockActionsVisible(ModeManager::instance()->currentMode()->id() ==
+ Constants::MODE_ANALYZE);
+
+ QBoxLayout *editorHolderLayout = new QVBoxLayout;
+ editorHolderLayout->setMargin(0);
+ editorHolderLayout->setSpacing(0);
+
+ QWidget *editorAndFindWidget = new QWidget;
+ editorAndFindWidget->setLayout(editorHolderLayout);
+ editorHolderLayout->addWidget(new EditorManagerPlaceHolder(m_mode));
+ editorHolderLayout->addWidget(new FindToolBarPlaceHolder(editorAndFindWidget));
+
+ MiniSplitter *documentAndRightPane = new MiniSplitter;
+ documentAndRightPane->addWidget(editorAndFindWidget);
+ documentAndRightPane->addWidget(new RightPanePlaceHolder(m_mode));
+ documentAndRightPane->setStretchFactor(0, 1);
+ documentAndRightPane->setStretchFactor(1, 0);
+
+ Utils::StyledBar *analyzeToolBar = new Utils::StyledBar;
+ analyzeToolBar->setProperty("topBorder", true);
+ QHBoxLayout *analyzeToolBarLayout = new QHBoxLayout(analyzeToolBar);
+ analyzeToolBarLayout->setMargin(0);
+ analyzeToolBarLayout->setSpacing(0);
+ QToolButton* startButton = toolButton(m_startAction);
+ analyzeToolBarLayout->addWidget(startButton);
+ analyzeToolBarLayout->addWidget(toolButton(m_stopAction));
+ analyzeToolBarLayout->addWidget(new Utils::StyledSeparator);
+ m_toolBox = new QComboBox;
+ connect(m_toolBox, SIGNAL(currentIndexChanged(int)),
+ q, SLOT(toolSelected(int)));
+ analyzeToolBarLayout->addWidget(m_toolBox);
+ m_toolBoxSeparator = new Utils::StyledSeparator;
+ analyzeToolBarLayout->addWidget(m_toolBoxSeparator);
+ m_toolbarStackedWidget = new QStackedWidget;
+ analyzeToolBarLayout->addWidget(m_toolbarStackedWidget);
+ analyzeToolBarLayout->addStretch();
+
+ QDockWidget *dock = new QDockWidget(tr("Analyzer Toolbar"));
+ dock->setObjectName(QLatin1String("Analyzer Toolbar"));
+ dock->setWidget(analyzeToolBar);
+ dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
+ dock->setAllowedAreas(Qt::BottomDockWidgetArea);
+ // hide title bar
+ dock->setTitleBarWidget(new QWidget(dock));
+ m_mainWindow->addDockWidget(Qt::BottomDockWidgetArea, dock);
+ m_mainWindow->setToolBarDockWidget(dock);
+
+ QWidget *centralWidget = new QWidget;
+ m_mainWindow->setCentralWidget(centralWidget);
+
+ QVBoxLayout *centralLayout = new QVBoxLayout(centralWidget);
+ centralWidget->setLayout(centralLayout);
+ centralLayout->setMargin(0);
+ centralLayout->setSpacing(0);
+ centralLayout->addWidget(documentAndRightPane);
+ centralLayout->setStretch(0, 1);
+ centralLayout->setStretch(1, 0);
+
+ return m_mainWindow;
+}
+
+void AnalyzerManager::AnalyzerManagerPrivate::addDock(IAnalyzerTool *tool, Qt::DockWidgetArea area,
+ QDockWidget *dockWidget)
+{
+ QTC_ASSERT(tool == q->currentTool(), return)
+
+ dockWidget->setParent(m_mainWindow);
+ m_mainWindow->addDockWidget(area, dockWidget);
+
+ Context globalContext(Core::Constants::C_GLOBAL);
+
+ ActionManager *am = ICore::instance()->actionManager();
+ QAction *toggleViewAction = dockWidget->toggleViewAction();
+ toggleViewAction->setText(dockWidget->windowTitle());
+ Command *cmd = am->registerAction(toggleViewAction, QString("Analyzer." + dockWidget->objectName()),
+ globalContext);
+ cmd->setAttribute(Command::CA_Hide);
+ m_viewsMenu->addAction(cmd);
+
+ /* TODO: save settings
+ connect(dockWidget->toggleViewAction(), SIGNAL(triggered(bool)),
+ SLOT(updateDockWidgetSettings()));
+ connect(dockWidget, SIGNAL(topLevelChanged(bool)),
+ SLOT(updateDockWidgetSettings()));
+ connect(dockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
+ SLOT(updateDockWidgetSettings()));
+ */
+
+ // just add the dock below the toolbar by default
+ m_mainWindow->splitDockWidget(m_mainWindow->toolBarDockWidget(), dockWidget,
+ Qt::Vertical);
+ dockWidget->show();
+}
+
+bool buildTypeAcceppted(IAnalyzerTool::ToolMode toolMode,
+ ProjectExplorer::BuildConfiguration::BuildType buildType)
+{
+ if (toolMode == IAnalyzerTool::AnyMode)
+ return true;
+ else if (buildType == ProjectExplorer::BuildConfiguration::Unknown)
+ return true;
+ else if (buildType == ProjectExplorer::BuildConfiguration::Debug &&
+ toolMode == IAnalyzerTool::DebugMode)
+ return true;
+ else if (buildType == ProjectExplorer::BuildConfiguration::Release &&
+ toolMode == IAnalyzerTool::ReleaseMode)
+ return true;
+ else
+ return false;
+}
+
+void AnalyzerManager::AnalyzerManagerPrivate::startTool()
+{
+ QTC_ASSERT(!m_isWaitingForBuild, return);
+ QTC_ASSERT(!m_currentRunControl, return);
+
+ // make sure our mode is shown
+ ModeManager::instance()->activateMode(m_mode->id());
+
+ ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
+
+ ProjectExplorer::Project *pro = pe->startupProject();
+ // ### not sure if we're supposed to check if the RunConFiguration isEnabled
+ if (!pro || !pro->activeTarget()->activeRunConfiguration()->isEnabled())
+ return;
+
+ ProjectExplorer::BuildConfiguration::BuildType buildType = pro->activeTarget()->activeBuildConfiguration()->buildType();
+ IAnalyzerTool::ToolMode toolMode = q->currentTool()->mode();
+
+ // check the project for whether the build config is in the correct mode
+ // if not, notify the user and urge him to use the correct mode
+ if (!buildTypeAcceppted(toolMode, buildType))
+ {
+ const QString &toolName = q->currentTool()->displayName();
+ const QString &toolMode = q->currentTool()->modeString();
+ const QString currentMode = buildType == ProjectExplorer::BuildConfiguration::Debug ? tr("Debug") : tr("Release");
+
+ QSettings *settings = Core::ICore::instance()->settings();
+ const QString configKey = QString("%1/%2").arg(Constants::MODE_ANALYZE, "AnalyzeCorrectMode");
+ int ret;
+ if (settings->contains(configKey)) {
+ ret = settings->value(configKey, QDialog::Accepted).toInt();
+ } else {
+ QDialog dialog;
+ dialog.setWindowTitle(tr("Run %1 in %2 mode?").arg(toolName).arg(currentMode));
+ QGridLayout *layout = new QGridLayout;
+ QLabel *iconLabel = new QLabel;
+ iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ QIcon icon = dialog.style()->standardIcon(QStyle::SP_MessageBoxInformation);
+ dialog.setWindowIcon(icon);
+ iconLabel->setPixmap(icon.pixmap(QSize(icon.actualSize(QSize(64, 64)))));
+ layout->addWidget(iconLabel, 0, 0);
+ QLabel *textLabel = new QLabel;
+ textLabel->setWordWrap(true);
+ textLabel->setText(tr("You are trying to run %1 on an application in %2 mode. "
+ "%1 is designed to be used in %3 mode.\n\n"
+ "Do you want to continue and run %1 in %2 mode?").arg(toolName).arg(currentMode).arg(toolMode));
+ layout->addWidget(textLabel, 0, 1);
+ QCheckBox *dontAskAgain = new QCheckBox;
+ dontAskAgain->setText(tr("&Do not ask again"));
+ layout->addWidget(dontAskAgain, 1, 0, 1, 2);
+ QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::Cancel);
+ connect(buttons, SIGNAL(accepted()),
+ &dialog, SLOT(accept()));
+ connect(buttons, SIGNAL(rejected()),
+ &dialog, SLOT(reject()));
+ layout->addWidget(buttons, 2, 0, 1, 2);
+ dialog.setLayout(layout);
+ ret = dialog.exec();
+ if (dontAskAgain->isChecked() && ret == QDialog::Accepted)
+ settings->setValue(configKey, ret);
+ }
+ if (ret == QDialog::Rejected)
+ return;
+ }
+
+ m_isWaitingForBuild = true;
+ pe->runProject(pro, Constants::MODE_ANALYZE);
+
+ m_startAction->setEnabled(false);
+ m_stopAction->setEnabled(true);
+ m_toolBox->setEnabled(false);
+ m_toolGroup->setEnabled(false);
+}
+// AnalyzerManager ////////////////////////////////////////////////////
+AnalyzerManager *AnalyzerManager::m_instance = 0;
+
+AnalyzerManager::AnalyzerManager(QObject *parent) :
+ QObject(parent),
+ d(new AnalyzerManagerPrivate(this))
+{
+ m_instance = this;
+
+ connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
+ this, SLOT(modeChanged(Core::IMode*)));
+ ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
+ connect(pe->buildManager(), SIGNAL(buildQueueFinished(bool)),
+ this, SLOT(buildQueueFinished(bool)));
+ connect(pe, SIGNAL(updateRunActions()),
+ this, SLOT(updateRunActions()));
+}
+
+AnalyzerManager::~AnalyzerManager()
+{
+ delete d;
+}
+
+void AnalyzerManager::shutdown()
+{
+ saveToolSettings(currentTool());
+}
+
+AnalyzerManager * AnalyzerManager::instance()
+{
+ return m_instance;
+}
+
+void AnalyzerManager::modeChanged(IMode *mode)
+{
+ d->m_mainWindow->setDockActionsVisible(mode->id() == Constants::MODE_ANALYZE);
+}
+
+void AnalyzerManager::selectTool(IAnalyzerTool* tool)
+{
+ QTC_ASSERT(d->m_tools.contains(tool), return);
+ toolSelected(d->m_tools.indexOf(tool));
+}
+
+void AnalyzerManager::toolSelected(int idx)
+{
+ static bool selectingTool = false;
+ if (selectingTool)
+ return;
+ selectingTool = true;
+
+ IAnalyzerTool* oldTool = currentTool();
+ if (oldTool) {
+ saveToolSettings(oldTool);
+
+ ActionManager *am = ICore::instance()->actionManager();
+
+ foreach(const AnalyzerManagerPrivate::ToolWidgetPair &widget, d->m_toolWidgets.value(oldTool)) {
+ QAction *toggleViewAction = widget.second->toggleViewAction();
+ am->unregisterAction(toggleViewAction, QString("Analyzer." + widget.second->objectName()));
+ d->m_mainWindow->removeDockWidget(widget.second);
+ ///NOTE: QMainWindow (and FancyMainWindow) just look at @c findChildren<QDockWidget*>()
+ ///if we don't do this, all kind of havoc might happen, including:
+ ///- improper saveState/restoreState
+ ///- improper list of qdockwidgets in popup menu
+ ///- ...
+ widget.second->setParent(0);
+ }
+ }
+
+ d->m_toolGroup->actions().at(idx)->setChecked(true);
+ d->m_toolBox->setCurrentIndex(idx);
+
+ IAnalyzerTool* newTool = currentTool();
+
+ if (QWidget *toolbarWidget = d->m_toolToolbarWidgets.value(newTool))
+ d->m_toolbarStackedWidget->setCurrentWidget(toolbarWidget);
+
+ foreach(const AnalyzerManagerPrivate::ToolWidgetPair &widget, d->m_toolWidgets.value(newTool)) {
+ d->addDock(newTool, widget.first, widget.second);
+ }
+ loadToolSettings(newTool);
+
+ selectingTool = false;
+}
+
+void AnalyzerManager::toolSelected(QAction *action)
+{
+ toolSelected(d->m_toolGroup->actions().indexOf(action));
+}
+
+void AnalyzerManager::addTool(IAnalyzerTool *tool)
+{
+ Internal::AnalyzerPlugin *plugin = Internal::AnalyzerPlugin::instance();
+ QAction *action = new QAction(tool->displayName(), d->m_toolGroup);
+ action->setData(d->m_tools.count());
+ action->setCheckable(true);
+
+ d->m_menu->addAction(action);
+ d->m_toolGroup->setVisible(d->m_toolGroup->actions().count() > 1);
+ d->m_tools.append(tool);
+ d->m_toolBox->addItem(tool->displayName());
+ d->m_toolBox->setVisible(d->m_toolBox->count() > 1);
+ d->m_toolBoxSeparator->setVisible(d->m_toolBox->isVisible());
+
+ if (currentTool() != tool)
+ selectTool(tool); // the first tool gets selected automatically due to signal emission from toolbox
+ tool->initialize(plugin);
+
+ QSettings* defaultSettings = new QSettings(this);
+ d->m_defaultSettings[tool] = defaultSettings;
+ d->m_mainWindow->saveSettings(defaultSettings);
+
+ loadToolSettings(tool);
+}
+
+void AnalyzerManager::setToolbar(IAnalyzerTool *tool, QWidget *widget)
+{
+ d->m_toolToolbarWidgets[tool] = widget;
+ d->m_toolbarStackedWidget->addWidget(widget);
+
+ if (currentTool() == tool)
+ d->m_toolbarStackedWidget->setCurrentWidget(widget);
+}
+
+QDockWidget *AnalyzerManager::createDockWidget(IAnalyzerTool *tool, const QString &title,
+ QWidget *widget, Qt::DockWidgetArea area)
+{
+ QTC_ASSERT(!widget->objectName().isEmpty(), qt_noop());
+
+ QDockWidget *dockWidget = d->m_mainWindow->addDockForWidget(widget);
+ dockWidget->setWindowTitle(title);
+
+ d->m_toolWidgets[tool] << qMakePair(area, dockWidget);
+ dockWidget->installEventFilter(d->m_resizeEventFilter);
+
+ d->addDock(tool, area, dockWidget);
+
+ return dockWidget;
+}
+
+IAnalyzerTool *AnalyzerManager::currentTool() const
+{
+ QTC_ASSERT(!d->m_tools.isEmpty(), return 0);
+
+ if (!d->m_toolGroup->checkedAction()) {
+ return 0;
+ }
+
+ return d->m_tools.at(d->m_toolGroup->checkedAction()->data().toInt());
+}
+
+QList<IAnalyzerTool *> AnalyzerManager::tools() const
+{
+ return d->m_tools;
+}
+
+void AnalyzerManager::startTool()
+{
+ d->startTool();
+}
+
+void AnalyzerManager::runControlCreated(AnalyzerRunControl *rc)
+{
+ QTC_ASSERT(!d->m_currentRunControl, qt_noop());
+ d->m_currentRunControl = rc;
+ connect(rc, SIGNAL(finished()), this, SLOT(handleToolFinished()));
+}
+
+void AnalyzerManager::buildQueueFinished(bool success)
+{
+ // maybe that wasn't for our build
+ if (!d->m_isWaitingForBuild)
+ return;
+ d->m_isWaitingForBuild = false;
+ if (success)
+ return;
+ // note that the RunControl is started, if it is started, before we get here.
+ QTC_ASSERT(!d->m_currentRunControl, qt_noop());
+ handleToolFinished();
+}
+
+void AnalyzerManager::stopTool()
+{
+ if (d->m_isWaitingForBuild) {
+ QTC_ASSERT(!d->m_currentRunControl, qt_noop());
+ ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
+ pe->buildManager()->cancel();
+ }
+ if (!d->m_currentRunControl)
+ return;
+
+ d->m_currentRunControl->stop();
+ handleToolFinished();
+}
+
+void AnalyzerManager::handleToolFinished()
+{
+ // this may run as a consequence of calling stopMemcheck() or valgrind may have terminated
+ // for a different reason (application exited through user action, segfault, ...), so we
+ // duplicate some code from stopMemcheck().
+ d->m_startAction->setEnabled(true);
+ d->m_stopAction->setEnabled(false);
+ d->m_toolBox->setEnabled(true);
+ d->m_toolGroup->setEnabled(true);
+ d->m_currentRunControl = 0;
+}
+
+Utils::FancyMainWindow *AnalyzerManager::mainWindow() const
+{
+ return d->m_mainWindow;
+}
+
+void AnalyzerManager::resetLayout()
+{
+ d->m_mainWindow->restoreSettings(d->m_defaultSettings.value(currentTool()));
+}
+
+void AnalyzerManager::loadToolSettings(IAnalyzerTool *tool)
+{
+ QSettings *settings = Core::ICore::instance()->settings();
+ settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + tool->id());
+ if (settings->value("ToolSettingsSaved", false).toBool()) {
+ d->m_mainWindow->restoreSettings(settings);
+ }
+ settings->endGroup();
+}
+
+void AnalyzerManager::saveToolSettings(IAnalyzerTool *tool)
+{
+ QSettings *settings = Core::ICore::instance()->settings();
+ settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + tool->id());
+ d->m_mainWindow->saveSettings(settings);
+ settings->setValue("ToolSettingsSaved", true);
+ settings->endGroup();
+}
+
+void AnalyzerManager::updateRunActions()
+{
+ ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
+ ProjectExplorer::Project *project = pe->startupProject();
+ bool startEnabled = !d->m_currentRunControl && pe->canRun(project, Constants::MODE_ANALYZE);
+ d->m_startAction->setEnabled(startEnabled);
+}
diff --git a/src/plugins/analyzerbase/analyzermanager.h b/src/plugins/analyzerbase/analyzermanager.h
new file mode 100644
index 0000000000..033ca16753
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzermanager.h
@@ -0,0 +1,186 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Andreas Hartmetz, KDAB (andreas.hartmetz@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef ANALYZERMANAGER_H
+#define ANALYZERMANAGER_H
+
+#include "analyzerbase_global.h"
+#include "analyzerconstants.h"
+
+#include <coreplugin/coreconstants.h>
+#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/imode.h>
+
+#include <QObject>
+#include <QIcon>
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QDockWidget;
+QT_END_NAMESPACE
+
+namespace Core {
+class IMode;
+}
+
+namespace Utils {
+class FancyMainWindow;
+}
+
+namespace Analyzer {
+
+class IAnalyzerTool;
+
+namespace Internal {
+
+class AnalyzerRunControl;
+
+class DockWidgetEventFilter : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit DockWidgetEventFilter(QObject *parent = 0) : QObject(parent) {}
+
+signals:
+ void widgetResized();
+
+protected:
+ virtual bool eventFilter(QObject *obj, QEvent *event);
+};
+
+class AnalyzerMode : public Core::IMode
+{
+ Q_OBJECT
+
+public:
+ AnalyzerMode(QObject *parent = 0)
+ : Core::IMode(parent)
+ , m_widget(0)
+ {}
+
+ ~AnalyzerMode()
+ {
+ // Make sure the editor manager does not get deleted.
+ if (m_widget) {
+ delete m_widget;
+ m_widget = 0;
+ }
+ Core::EditorManager::instance()->setParent(0);
+ }
+
+ QString displayName() const { return tr("Analyze"); }
+ QIcon icon() const { return QIcon(":/images/analyzer_mode.png"); }
+ int priority() const { return Constants::P_MODE_ANALYZE; }
+ QWidget *widget() { return m_widget; }
+ QString id() const { return QLatin1String(Constants::MODE_ANALYZE); }
+ QString type() const { return Core::Constants::MODE_EDIT_TYPE; }
+ Core::Context context() const
+ {
+ return Core::Context(Core::Constants::C_EDITORMANAGER, Constants::C_ANALYZEMODE,
+ Core::Constants::C_NAVIGATION_PANE);
+ }
+ QString contextHelpId() const { return QString(); }
+ void setWidget(QWidget *widget) { m_widget = widget; }
+
+private:
+ QWidget *m_widget;
+};
+
+}
+
+using Analyzer::Internal::AnalyzerRunControl;
+
+class ANALYZER_EXPORT AnalyzerManager : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit AnalyzerManager(QObject *parent = 0);
+ ~AnalyzerManager();
+
+ static AnalyzerManager *instance();
+
+ void shutdown();
+
+ /**
+ * Register a tool and initialize it.
+ */
+ void addTool(Analyzer::IAnalyzerTool *tool);
+ IAnalyzerTool *currentTool() const;
+ QList<IAnalyzerTool *> tools() const;
+
+ // dockwidgets are registered to the main window
+ QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title, QWidget *widget,
+ Qt::DockWidgetArea area = Qt::TopDockWidgetArea);
+
+ /**
+ * Add the given @p widget into this mode's toolbar.
+ *
+ * It will be shown whenever this tool is selected by the user.
+ *
+ * @Note The manager will take ownership of @p widget.
+ */
+ void setToolbar(Analyzer::IAnalyzerTool *tool, QWidget *widget);
+
+ Utils::FancyMainWindow *mainWindow() const;
+
+ void selectTool(IAnalyzerTool* tool);
+
+private slots:
+ void startTool();
+ void stopTool();
+ void handleToolFinished();
+ void toolSelected(int);
+ void toolSelected(QAction *);
+ void modeChanged(Core::IMode *mode);
+ void runControlCreated(AnalyzerRunControl *);
+ void buildQueueFinished(bool success);
+ void resetLayout();
+ void saveToolSettings(IAnalyzerTool *tool);
+ void loadToolSettings(IAnalyzerTool *tool);
+ void updateRunActions();
+
+private:
+ class AnalyzerManagerPrivate;
+ friend class AnalyzerManagerPrivate;
+ AnalyzerManagerPrivate *const d;
+
+ static AnalyzerManager *m_instance;
+};
+
+} // namespace Analyzer
+
+#endif // ANALYZERMANAGER_H
diff --git a/src/plugins/analyzerbase/analyzeroptionspage.cpp b/src/plugins/analyzerbase/analyzeroptionspage.cpp
new file mode 100644
index 0000000000..127ca8de6f
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzeroptionspage.cpp
@@ -0,0 +1,95 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "analyzerconstants.h"
+
+#include "analyzeroptionspage.h"
+#include "analyzersettings.h"
+
+#include <QCoreApplication>
+#include <QLatin1String>
+#include <QWidget>
+#include <QDebug>
+#include <QIcon>
+
+#include <coreplugin/icore.h>
+
+using namespace Analyzer;
+using namespace Analyzer::Internal;
+
+AnalyzerOptionsPage::AnalyzerOptionsPage(AbstractAnalyzerSubConfig *config, QObject *parent) :
+ Core::IOptionsPage(parent),
+ m_config(config)
+{
+}
+
+QString AnalyzerOptionsPage::id() const
+{
+ return m_config->id();
+}
+
+QString AnalyzerOptionsPage::displayName() const
+{
+ return m_config->displayName();
+}
+
+QString AnalyzerOptionsPage::category() const
+{
+ return QLatin1String(Constants::ANALYZER_SETTINGS_CATEGORY);
+}
+
+QString AnalyzerOptionsPage::displayCategory() const
+{
+ return QCoreApplication::tr("Analyzer", Constants::ANALYZER_SETTINGS_TR_CATEGORY);
+}
+
+QIcon AnalyzerOptionsPage::categoryIcon() const
+{
+ return QIcon(QLatin1String(Constants::ANALYZER_SETTINGS_CATEGORY_ICON));
+}
+
+QWidget *AnalyzerOptionsPage::createPage(QWidget *parent)
+{
+ return m_config->createConfigWidget(parent);
+}
+
+void AnalyzerOptionsPage::apply()
+{
+ AnalyzerGlobalSettings::instance()->writeSettings();
+}
+
+void AnalyzerOptionsPage::finish()
+{
+}
diff --git a/src/plugins/analyzerbase/analyzeroptionspage.h b/src/plugins/analyzerbase/analyzeroptionspage.h
new file mode 100644
index 0000000000..96cf6faee9
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzeroptionspage.h
@@ -0,0 +1,72 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef ANALYZER_INTERNAL_ANALYZEROPTIONSPAGE_H
+#define ANALYZER_INTERNAL_ANALYZEROPTIONSPAGE_H
+
+#include <coreplugin/dialogs/ioptionspage.h>
+
+namespace Analyzer {
+
+class AbstractAnalyzerSubConfig;
+
+namespace Internal {
+
+class AnalyzerOptionsPage : public Core::IOptionsPage
+{
+ Q_OBJECT
+public:
+ explicit AnalyzerOptionsPage(AbstractAnalyzerSubConfig *config, QObject *parent = 0);
+
+ // IOptionsPage implementation
+ QString id() const;
+ QString displayName() const;
+ QString category() const;
+ QString displayCategory() const;
+ QIcon categoryIcon() const;
+
+ QWidget *createPage(QWidget *parent);
+ void apply();
+ void finish();
+
+private:
+ AbstractAnalyzerSubConfig *m_config;
+};
+
+
+} // namespace Internal
+} // namespace Analyzer
+
+#endif // ANALYZER_INTERNAL_ANALYZEROPTIONSPAGE_H
diff --git a/src/plugins/analyzerbase/analyzerplugin.cpp b/src/plugins/analyzerbase/analyzerplugin.cpp
new file mode 100644
index 0000000000..e62e2e4f42
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerplugin.cpp
@@ -0,0 +1,143 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "analyzerplugin.h"
+#include "analyzerconstants.h"
+#include "analyzermanager.h"
+
+#include <coreplugin/imode.h>
+#include <coreplugin/coreconstants.h>
+#include <coreplugin/editormanager/editormanager.h>
+
+#include <extensionsystem/pluginmanager.h>
+#include <projectexplorer/task.h>
+#include <projectexplorer/taskhub.h>
+
+#include <QtPlugin>
+#include <QMessageBox>
+#include <QMainWindow>
+#include <QApplication>
+
+using namespace Analyzer;
+using namespace Analyzer::Internal;
+
+
+AnalyzerPlugin *AnalyzerPlugin::m_instance = 0;
+
+
+// AnalyzerPluginPrivate ////////////////////////////////////////////////////
+class AnalyzerPlugin::AnalyzerPluginPrivate
+{
+public:
+ AnalyzerPluginPrivate(AnalyzerPlugin *qq):
+ q(qq),
+ m_manager(0)
+ {}
+
+ void initialize(const QStringList &arguments, QString *errorString);
+
+ AnalyzerPlugin *q;
+ AnalyzerManager *m_manager;
+};
+
+void AnalyzerPlugin::AnalyzerPluginPrivate::initialize(const QStringList &arguments, QString *errorString)
+{
+ Q_UNUSED(arguments)
+ Q_UNUSED(errorString)
+ m_manager = new AnalyzerManager;
+}
+
+
+// AnalyzerPlugin ////////////////////////////////////////////////////
+AnalyzerPlugin::AnalyzerPlugin()
+ : d(new AnalyzerPluginPrivate(this))
+{
+ m_instance = this;
+}
+
+AnalyzerPlugin::~AnalyzerPlugin()
+{
+ // Unregister objects from the plugin manager's object pool
+ // Delete members
+ delete d;
+}
+
+bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorString)
+{
+ // Register objects in the plugin manager's object pool
+ // Load settings
+ // connect to other plugins' signals
+ // "In the initialize method, a plugin can be sure that the plugins it
+ // depends on have initialized their members."
+
+ Q_UNUSED(arguments)
+ Q_UNUSED(errorString)
+
+ d->initialize(arguments, errorString);
+
+ // Task integration
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ ProjectExplorer::TaskHub *hub = pm->getObject<ProjectExplorer::TaskHub>();
+ //: Category under which Analyzer tasks are listed in build issues view
+ hub->addCategory(QLatin1String(Constants::ANALYZERTASK_ID), tr("Analyzer"));
+
+ ///TODO: select last used tool or default tool
+// d->m_manager->selectTool(memcheckTool);
+
+ return true;
+}
+
+void AnalyzerPlugin::extensionsInitialized()
+{
+ // Retrieve objects from the plugin manager's object pool
+ // "In the extensionsInitialized method, a plugin can be sure that all
+ // plugins that depend on it are completely initialized."
+}
+
+ExtensionSystem::IPlugin::ShutdownFlag AnalyzerPlugin::aboutToShutdown()
+{
+ d->m_manager->shutdown();
+ // Save settings
+ // Disconnect from signals that are not needed during shutdown
+ // Hide UI (if you add UI that is not in the main window directly)
+ return SynchronousShutdown;
+}
+
+AnalyzerPlugin *AnalyzerPlugin::instance()
+{
+ return m_instance;
+}
+
+Q_EXPORT_PLUGIN(AnalyzerPlugin)
diff --git a/src/plugins/analyzerbase/analyzerplugin.h b/src/plugins/analyzerbase/analyzerplugin.h
new file mode 100644
index 0000000000..cbeb1ab1e6
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerplugin.h
@@ -0,0 +1,69 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef ANALYZERPLUGIN_H
+#define ANALYZERPLUGIN_H
+
+#include <extensionsystem/iplugin.h>
+
+namespace Analyzer {
+
+namespace Internal {
+
+class AnalyzerPlugin : public ExtensionSystem::IPlugin
+{
+ Q_OBJECT
+
+public:
+ static AnalyzerPlugin *instance();
+
+ AnalyzerPlugin();
+ ~AnalyzerPlugin();
+
+ bool initialize(const QStringList &arguments, QString *errorString);
+ void extensionsInitialized();
+ ShutdownFlag aboutToShutdown();
+
+private:
+ class AnalyzerPluginPrivate;
+ AnalyzerPluginPrivate *d;
+
+ static AnalyzerPlugin *m_instance;
+};
+
+} // namespace Internal
+} // namespace Analyzer
+
+#endif // ANALYZERPLUGIN_H
diff --git a/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp b/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp
new file mode 100644
index 0000000000..592dc8e584
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp
@@ -0,0 +1,77 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator Instrumentation Tools
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "analyzerrunconfigwidget.h"
+
+#include "analyzersettings.h"
+
+#include <utils/detailswidget.h>
+#include <utils/qtcassert.h>
+
+#include <QStandardItemModel>
+#include <QFileDialog>
+#include <QDebug>
+#include <QVBoxLayout>
+
+using namespace Analyzer;
+using namespace Analyzer::Internal;
+
+AnalyzerRunConfigWidget::AnalyzerRunConfigWidget()
+ : m_detailsWidget(new Utils::DetailsWidget(this))
+ , m_tabWidget(new QTabWidget(this))
+{
+ m_detailsWidget->setWidget(m_tabWidget);
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(m_detailsWidget);
+}
+
+QString AnalyzerRunConfigWidget::displayName() const
+{
+ return tr("Analyzer Settings");
+}
+
+void AnalyzerRunConfigWidget::setRunConfiguration(ProjectExplorer::RunConfiguration *rc)
+{
+ QTC_ASSERT(rc, return);
+ m_tabWidget->clear();
+
+ AnalyzerProjectSettings *settings = rc->extraAspect<AnalyzerProjectSettings>();
+ QTC_ASSERT(settings, return);
+
+ foreach(AbstractAnalyzerSubConfig* config, settings->subConfigs()) {
+ m_tabWidget->addTab(config->createConfigWidget(this), config->displayName());
+ }
+}
diff --git a/src/plugins/analyzerbase/analyzerrunconfigwidget.h b/src/plugins/analyzerbase/analyzerrunconfigwidget.h
new file mode 100644
index 0000000000..f2384846a6
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerrunconfigwidget.h
@@ -0,0 +1,80 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator Instrumentation Tools
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+
+#ifndef ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
+#define ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
+
+#include <projectexplorer/runconfiguration.h>
+
+#include <QTabWidget>
+
+QT_BEGIN_NAMESPACE
+class QStandardItemModel;
+
+namespace Ui {
+class AnalyzerConfigWidget;
+}
+QT_END_NAMESPACE
+
+namespace Utils {
+class DetailsWidget;
+}
+
+namespace Analyzer {
+
+class AnalyzerSettings;
+
+namespace Internal {
+
+class AnalyzerRunConfigWidget : public ProjectExplorer::RunConfigWidget
+{
+ Q_OBJECT
+
+public:
+ AnalyzerRunConfigWidget();
+
+ QString displayName() const;
+ void setRunConfiguration(ProjectExplorer::RunConfiguration *rc);
+
+private:
+ Utils::DetailsWidget *m_detailsWidget;
+ QTabWidget *m_tabWidget;
+};
+
+}
+}
+
+#endif // ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
diff --git a/src/plugins/analyzerbase/analyzerruncontrol.cpp b/src/plugins/analyzerbase/analyzerruncontrol.cpp
new file mode 100644
index 0000000000..eb63041c80
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerruncontrol.cpp
@@ -0,0 +1,196 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Andreas Hartmetz, KDAB (andreas.hartmetz@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "analyzerruncontrol.h"
+#include "analyzerconstants.h"
+#include "ianalyzerengine.h"
+#include "ianalyzertool.h"
+#include "analyzerplugin.h"
+#include "analyzermanager.h"
+#include "analyzerrunconfigwidget.h"
+#include "analyzersettings.h"
+
+#include <extensionsystem/pluginmanager.h>
+#include <projectexplorer/applicationrunconfiguration.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/task.h>
+#include <projectexplorer/taskhub.h>
+#include <coreplugin/ioutputpane.h>
+
+#include <QDebug>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QMessageBox>
+
+using namespace Analyzer;
+using namespace Analyzer::Internal;
+
+// AnalyzerRunControlFactory ////////////////////////////////////////////////////
+AnalyzerRunControlFactory::AnalyzerRunControlFactory(QObject *parent)
+ : IRunControlFactory(parent)
+{
+}
+
+bool AnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
+{
+ if (!qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration))
+ return false;
+ return mode == Constants::MODE_ANALYZE;
+}
+
+ProjectExplorer::RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration,
+ const QString &mode)
+{
+ if (!qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration) ||
+ mode != Constants::MODE_ANALYZE) {
+ return 0;
+ }
+ AnalyzerRunControl *rc = new AnalyzerRunControl(runConfiguration);
+ emit runControlCreated(rc);
+ return rc;
+}
+
+QString AnalyzerRunControlFactory::displayName() const
+{
+ return tr("Analyzer");
+}
+
+ProjectExplorer::IRunConfigurationAspect *AnalyzerRunControlFactory::createRunConfigurationAspect()
+{
+ return new AnalyzerProjectSettings;
+}
+
+ProjectExplorer::RunConfigWidget *AnalyzerRunControlFactory::createConfigurationWidget(RunConfiguration
+ *runConfiguration)
+{
+ ProjectExplorer::LocalApplicationRunConfiguration *localRc =
+ qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration);
+ if (!localRc)
+ return 0;
+ AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
+ if (!settings)
+ return 0;
+
+ AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget;
+ ret->setRunConfiguration(runConfiguration);
+ return ret;
+}
+
+// AnalyzerRunControl ////////////////////////////////////////////////////
+AnalyzerRunControl::AnalyzerRunControl(RunConfiguration *runConfiguration)
+ : RunControl(runConfiguration, Constants::MODE_ANALYZE),
+ m_isRunning(false),
+ m_engine(0)
+{
+ IAnalyzerTool *tool = AnalyzerManager::instance()->currentTool();
+ m_engine = tool->createEngine(runConfiguration);
+
+ connect(m_engine, SIGNAL(standardErrorReceived(QString)),
+ SLOT(receiveStandardError(QString)));
+ connect(m_engine, SIGNAL(standardOutputReceived(QString)),
+ SLOT(receiveStandardOutput(QString)));
+ connect(m_engine, SIGNAL(taskToBeAdded(ProjectExplorer::Task::TaskType,QString,QString,int)),
+ SLOT(addTask(ProjectExplorer::Task::TaskType,QString,QString,int)));
+ connect(m_engine, SIGNAL(finished()),
+ SLOT(engineFinished()));
+}
+
+AnalyzerRunControl::~AnalyzerRunControl()
+{
+ if (m_isRunning)
+ stop();
+}
+
+void AnalyzerRunControl::start()
+{
+ // clear about-to-be-outdated tasks
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ ProjectExplorer::TaskHub *hub = pm->getObject<ProjectExplorer::TaskHub>();
+ hub->clearTasks(Constants::ANALYZERTASK_ID);
+
+ m_isRunning = true;
+ emit started();
+ m_engine->start();
+}
+
+ProjectExplorer::RunControl::StopResult AnalyzerRunControl::stop()
+{
+ m_engine->stop();
+ m_isRunning = false;
+ return AsynchronousStop;
+}
+
+void AnalyzerRunControl::engineFinished()
+{
+ m_isRunning = false;
+ emit finished();
+}
+
+bool AnalyzerRunControl::isRunning() const
+{
+ return m_isRunning;
+}
+
+QString AnalyzerRunControl::displayName() const
+{
+ return AnalyzerManager::instance()->currentTool()->displayName();
+}
+
+void AnalyzerRunControl::receiveStandardOutput(const QString &text)
+{
+ appendMessage(text, ProjectExplorer::StdOutFormat);
+}
+
+void AnalyzerRunControl::receiveStandardError(const QString &text)
+{
+ appendMessage(text, ProjectExplorer::StdErrFormat);
+}
+
+void AnalyzerRunControl::addTask(ProjectExplorer::Task::TaskType type, const QString &description,
+ const QString &file, int line)
+{
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ ProjectExplorer::TaskHub *hub = pm->getObject<ProjectExplorer::TaskHub>();
+ hub->addTask(ProjectExplorer::Task(type, description, file, line, Constants::ANALYZERTASK_ID));
+
+ ///FIXME: get a better API for this into Qt Creator
+ QList<Core::IOutputPane *> panes = pm->getObjects<Core::IOutputPane>();
+ foreach (Core::IOutputPane *pane, panes) {
+ if (pane->displayName() == tr("Build Issues")) {
+ pane->popup(false);
+ break;
+ }
+ }
+}
diff --git a/src/plugins/analyzerbase/analyzerruncontrol.h b/src/plugins/analyzerbase/analyzerruncontrol.h
new file mode 100644
index 0000000000..b3948f6103
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzerruncontrol.h
@@ -0,0 +1,113 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Andreas Hartmetz, KDAB (andreas.hartmetz@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef ANALYZERRUNCONTROL_H
+#define ANALYZERRUNCONTROL_H
+
+#include "analyzerconstants.h"
+
+#include <valgrind/xmlprotocol/parser.h>
+
+#include <projectexplorer/runconfiguration.h>
+#include <projectexplorer/task.h>
+
+#include <QtCore/QScopedPointer>
+
+namespace Analyzer {
+
+class IAnalyzerEngine;
+
+namespace Internal {
+
+class AnalyzerRunControl;
+
+class AnalyzerRunControlFactory: public ProjectExplorer::IRunControlFactory
+{
+ Q_OBJECT
+
+public:
+ AnalyzerRunControlFactory(QObject *parent = 0);
+
+ typedef ProjectExplorer::RunConfiguration RunConfiguration;
+ typedef ProjectExplorer::RunControl RunControl;
+
+ // virtuals from IRunControlFactory
+ bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
+ RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
+ QString displayName() const;
+
+ ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect();
+ ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
+
+signals:
+ void runControlCreated(AnalyzerRunControl *);
+};
+
+
+class AnalyzerRunControl: public ProjectExplorer::RunControl
+{
+ Q_OBJECT
+
+public:
+ typedef ProjectExplorer::RunConfiguration RunConfiguration;
+ // the constructor is likely to gain more arguments later
+ explicit AnalyzerRunControl(RunConfiguration *runConfiguration);
+ ~AnalyzerRunControl();
+
+ // pure virtuals from ProjectExplorer::RunControl
+ void start();
+ StopResult stop();
+ bool isRunning() const;
+ QString displayName() const;
+
+private slots:
+ void receiveStandardOutput(const QString &);
+ void receiveStandardError(const QString &);
+
+ void addTask(ProjectExplorer::Task::TaskType type, const QString &description,
+ const QString &file, int line);
+
+ void engineFinished();
+
+private:
+ bool m_isRunning;
+ IAnalyzerEngine *m_engine;
+};
+
+
+} // namespace Internal
+} // namespace Analyzer
+
+#endif // ANALYZERRUNCONTROL_H
diff --git a/src/plugins/analyzerbase/analyzersettings.cpp b/src/plugins/analyzerbase/analyzersettings.cpp
new file mode 100644
index 0000000000..b6ee5271fa
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzersettings.cpp
@@ -0,0 +1,187 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator Instrumentation Tools
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "analyzersettings.h"
+
+#include "analyzermanager.h"
+#include "ianalyzertool.h"
+#include "analyzerplugin.h"
+#include "analyzeroptionspage.h"
+
+#include <coreplugin/icore.h>
+#include <valgrind/xmlprotocol/error.h>
+#include <utils/qtcassert.h>
+
+#include <QSettings>
+
+using namespace Analyzer;
+using namespace Analyzer::Internal;
+
+static const QLatin1String groupC("Analyzer");
+
+AnalyzerGlobalSettings *AnalyzerGlobalSettings::m_instance = 0;
+
+AbstractAnalyzerSubConfig::AbstractAnalyzerSubConfig()
+{
+
+}
+
+AbstractAnalyzerSubConfig::~AbstractAnalyzerSubConfig()
+{
+}
+
+AnalyzerSettings::AnalyzerSettings()
+{
+}
+
+AnalyzerSettings::~AnalyzerSettings()
+{
+}
+
+bool AnalyzerSettings::fromMap(const QVariantMap &map)
+{
+ bool ret = true;
+ foreach(AbstractAnalyzerSubConfig* config, subConfigs()) {
+ ret = ret && config->fromMap(map);
+ }
+ return ret;
+}
+
+QVariantMap AnalyzerSettings::defaults() const
+{
+ QVariantMap map;
+ foreach(AbstractAnalyzerSubConfig* config, subConfigs()) {
+ map.unite(config->defaults());
+ }
+ return map;
+}
+
+QVariantMap AnalyzerSettings::toMap() const
+{
+ QVariantMap map;
+ foreach(AbstractAnalyzerSubConfig* config, subConfigs()) {
+ map.unite(config->toMap());
+ }
+ return map;
+}
+
+AnalyzerGlobalSettings::AnalyzerGlobalSettings()
+{
+ QTC_ASSERT(!m_instance, return);
+ m_instance = this;
+}
+
+AnalyzerGlobalSettings *AnalyzerGlobalSettings::instance()
+{
+ if (!m_instance)
+ m_instance = new AnalyzerGlobalSettings;
+ return m_instance;
+}
+
+AnalyzerGlobalSettings::~AnalyzerGlobalSettings()
+{
+ qDeleteAll(m_subConfigFactories);
+ m_instance = 0;
+}
+
+void AnalyzerGlobalSettings::readSettings()
+{
+ QSettings *settings = Core::ICore::instance()->settings();
+
+ QVariantMap map;
+
+ settings->beginGroup(groupC);
+ // read the values from config, using the keys from the defaults value map
+ const QVariantMap def = defaults();
+ for (QVariantMap::ConstIterator it = def.constBegin(); it != def.constEnd(); ++it)
+ map.insert(it.key(), settings->value(it.key(), it.value()));
+ settings->endGroup();
+
+ // apply the values to our member variables
+ fromMap(map);
+}
+
+void AnalyzerGlobalSettings::writeSettings() const
+{
+ QSettings *settings = Core::ICore::instance()->settings();
+ settings->beginGroup(groupC);
+ const QVariantMap map = toMap();
+ for (QVariantMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ settings->setValue(it.key(), it.value());
+ settings->endGroup();
+}
+
+void AnalyzerGlobalSettings::registerSubConfigFactory(AbstractAnalyzerSubConfigFactory *factory)
+{
+ m_subConfigFactories << factory;
+
+ AbstractAnalyzerSubConfig *config = factory->createGlobalSubConfig();
+ addSubConfig(config);
+ AnalyzerPlugin::instance()->addAutoReleasedObject(new AnalyzerOptionsPage(config));
+
+ readSettings();
+}
+
+QList<AbstractAnalyzerSubConfigFactory *> AnalyzerGlobalSettings::subConfigFactories() const
+{
+ return m_subConfigFactories;
+}
+
+AnalyzerProjectSettings::AnalyzerProjectSettings()
+{
+ // add sub configs
+ foreach(AbstractAnalyzerSubConfigFactory *factory, AnalyzerGlobalSettings::instance()->subConfigFactories()) {
+ addSubConfig(factory->createProjectSubConfig());
+ }
+
+ // take defaults from global settings
+ AnalyzerGlobalSettings *gs = AnalyzerGlobalSettings::instance();
+ fromMap(gs->toMap());
+}
+
+QString AnalyzerProjectSettings::displayName() const
+{
+ return tr("Analyzer Settings");
+}
+
+bool AnalyzerProjectSettings::fromMap(const QVariantMap& map)
+{
+ return AnalyzerSettings::fromMap(map);
+}
+
+QVariantMap AnalyzerProjectSettings::toMap() const
+{
+ return AnalyzerSettings::toMap();
+}
diff --git a/src/plugins/analyzerbase/analyzersettings.h b/src/plugins/analyzerbase/analyzersettings.h
new file mode 100644
index 0000000000..f5e7cf790b
--- /dev/null
+++ b/src/plugins/analyzerbase/analyzersettings.h
@@ -0,0 +1,197 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef ANALYZER_INTERNAL_ANALYZERSETTINGS_H
+#define ANALYZER_INTERNAL_ANALYZERSETTINGS_H
+
+#include <QObject>
+#include <QVariant>
+
+#include "analyzerbase_global.h"
+
+#include <projectexplorer/runconfiguration.h>
+
+namespace Analyzer {
+
+class AnalyzerSettings;
+
+/**
+ * Utility function to set @p val if @p key is present in @p map.
+ */
+template <typename T> static void setIfPresent(const QVariantMap &map, const QString &key, T *val)
+{
+ if (!map.contains(key))
+ return;
+ *val = map.value(key).value<T>();
+}
+
+/**
+ * Subclass this to add configuration to your analyzer tool.
+ */
+class ANALYZER_EXPORT AbstractAnalyzerSubConfig : public QObject
+{
+ Q_OBJECT
+public:
+ AbstractAnalyzerSubConfig();
+ virtual ~AbstractAnalyzerSubConfig();
+
+ virtual QVariantMap defaults() const = 0;
+ virtual QVariantMap toMap() const = 0;
+ virtual bool fromMap(const QVariantMap &map) = 0;
+
+ virtual QString id() const = 0;
+ virtual QString displayName() const = 0;
+ virtual QWidget* createConfigWidget(QWidget *parent) = 0;
+};
+
+/**
+ * Interface for registering configuration to the Manager.
+ * You probably want to use the template class below.
+ */
+class ANALYZER_EXPORT AbstractAnalyzerSubConfigFactory
+{
+public:
+ AbstractAnalyzerSubConfigFactory(){}
+ ~AbstractAnalyzerSubConfigFactory(){}
+
+ virtual AbstractAnalyzerSubConfig* createGlobalSubConfig() = 0;
+ virtual AbstractAnalyzerSubConfig* createProjectSubConfig() = 0;
+};
+
+/**
+ * Makes it easy to register configuration for a tool:
+ *
+ * @code
+ * manager->registerSubConfigFactory(new AnalyzerSubConfigFactory<MemcheckGlobalSettings, MemcheckProjectSettings>);
+ * @endcode
+ */
+template<class GlobalConfigT, class ProjectConfigT>
+class ANALYZER_EXPORT AnalyzerSubConfigFactory : public AbstractAnalyzerSubConfigFactory
+{
+public:
+ AnalyzerSubConfigFactory(){}
+
+ AbstractAnalyzerSubConfig* createGlobalSubConfig()
+ {
+ return new GlobalConfigT;
+ }
+
+ AbstractAnalyzerSubConfig* createProjectSubConfig()
+ {
+ return new ProjectConfigT;
+ }
+};
+
+/**
+ * Shared interface for the global and per-project settings.
+ *
+ * Use this to get the subConfig for your tool.
+ */
+class ANALYZER_EXPORT AnalyzerSettings : public QObject
+{
+ Q_OBJECT
+public:
+ virtual ~AnalyzerSettings();
+
+ template<class T>
+ T* subConfig() const
+ {
+ return findChild<T*>();
+ }
+
+ QList<AbstractAnalyzerSubConfig*> subConfigs() const
+ {
+ return findChildren<AbstractAnalyzerSubConfig*>();
+ }
+
+ QVariantMap defaults() const;
+ virtual QVariantMap toMap() const;
+
+protected:
+ void addSubConfig(AbstractAnalyzerSubConfig* config)
+ {
+ config->setParent(this);
+ }
+
+ virtual bool fromMap(const QVariantMap &map);
+
+ AnalyzerSettings();
+};
+
+
+// global and local settings are loaded and saved differently, and they also handle suppressions
+// differently.
+/**
+ * Global settings
+ */
+class ANALYZER_EXPORT AnalyzerGlobalSettings : public AnalyzerSettings
+{
+ Q_OBJECT
+public:
+ static AnalyzerGlobalSettings *instance();
+ ~AnalyzerGlobalSettings();
+
+ void writeSettings() const;
+ void readSettings();
+
+ void registerSubConfigFactory(AbstractAnalyzerSubConfigFactory *factory);
+ QList<AbstractAnalyzerSubConfigFactory *> subConfigFactories() const;
+
+private:
+ AnalyzerGlobalSettings();
+ static AnalyzerGlobalSettings *m_instance;
+ QList<AbstractAnalyzerSubConfigFactory *> m_subConfigFactories;
+};
+
+/**
+ * Settings associated with a single project/run configuration
+ */
+class ANALYZER_EXPORT AnalyzerProjectSettings : public AnalyzerSettings, public ProjectExplorer::IRunConfigurationAspect
+{
+ Q_OBJECT
+public:
+ AnalyzerProjectSettings();
+
+ QString displayName() const;
+
+ virtual QVariantMap toMap() const;
+
+protected:
+ virtual bool fromMap(const QVariantMap &map);
+};
+
+}
+
+#endif // ANALYZER_INTERNAL_ANALYZERSETTINGS_H
diff --git a/src/plugins/analyzerbase/ianalyzerengine.cpp b/src/plugins/analyzerbase/ianalyzerengine.cpp
new file mode 100644
index 0000000000..c68eac8d21
--- /dev/null
+++ b/src/plugins/analyzerbase/ianalyzerengine.cpp
@@ -0,0 +1,49 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "ianalyzerengine.h"
+
+using namespace Analyzer;
+
+IAnalyzerEngine::IAnalyzerEngine(ProjectExplorer::RunConfiguration *runConfig)
+ : QObject(),
+ m_runConfig(runConfig)
+{
+}
+
+ProjectExplorer::RunConfiguration *IAnalyzerEngine::runConfiguration() const
+{
+ return m_runConfig;
+}
diff --git a/src/plugins/analyzerbase/ianalyzerengine.h b/src/plugins/analyzerbase/ianalyzerengine.h
new file mode 100644
index 0000000000..3441075151
--- /dev/null
+++ b/src/plugins/analyzerbase/ianalyzerengine.h
@@ -0,0 +1,78 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef IANALYZERENGINE_H
+#define IANALYZERENGINE_H
+
+#include "analyzerbase_global.h"
+
+#include <projectexplorer/task.h>
+
+#include <QObject>
+#include <QString>
+
+namespace ProjectExplorer {
+class RunConfiguration;
+}
+
+namespace Analyzer {
+
+class ANALYZER_EXPORT IAnalyzerEngine : public QObject
+{
+ Q_OBJECT
+public:
+ explicit IAnalyzerEngine(ProjectExplorer::RunConfiguration *runConfiguration);
+
+ virtual void start() = 0;
+ /// trigger async stop
+ virtual void stop() = 0;
+
+ ProjectExplorer::RunConfiguration *runConfiguration() const;
+
+signals:
+ void standardOutputReceived(const QString &);
+ void standardErrorReceived(const QString &);
+ void taskToBeAdded(ProjectExplorer::Task::TaskType type, const QString &description,
+ const QString &file, int line);
+ void finished();
+ void starting(const IAnalyzerEngine *);
+
+private:
+ ProjectExplorer::RunConfiguration *m_runConfig;
+};
+
+} // namespace Analyzer
+
+#endif // IANALYZERENGINE_H
diff --git a/src/plugins/analyzerbase/ianalyzertool.cpp b/src/plugins/analyzerbase/ianalyzertool.cpp
new file mode 100644
index 0000000000..110862dbb8
--- /dev/null
+++ b/src/plugins/analyzerbase/ianalyzertool.cpp
@@ -0,0 +1,56 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "ianalyzertool.h"
+
+using namespace Analyzer;
+
+IAnalyzerTool::IAnalyzerTool(QObject *parent) :
+ QObject(parent)
+{
+}
+
+QString IAnalyzerTool::modeString()
+{
+ switch (mode()) {
+ case IAnalyzerTool::DebugMode:
+ return tr("Debug");
+ case IAnalyzerTool::ReleaseMode:
+ return tr("Release");
+ case IAnalyzerTool::AnyMode:
+ break;
+ }
+ return QString();
+}
diff --git a/src/plugins/analyzerbase/ianalyzertool.h b/src/plugins/analyzerbase/ianalyzertool.h
new file mode 100644
index 0000000000..e069ab9507
--- /dev/null
+++ b/src/plugins/analyzerbase/ianalyzertool.h
@@ -0,0 +1,86 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef IANALYZERTOOL_H
+#define IANALYZERTOOL_H
+
+#include "analyzerbase_global.h"
+
+#include <QObject>
+
+namespace ProjectExplorer {
+class RunConfiguration;
+}
+
+namespace ExtensionSystem {
+class IPlugin;
+}
+
+namespace Analyzer {
+
+class IAnalyzerEngine;
+
+class ANALYZER_EXPORT IAnalyzerTool : public QObject
+{
+ Q_OBJECT
+public:
+ explicit IAnalyzerTool(QObject *parent = 0);
+
+ virtual QString id() const = 0;
+ virtual QString displayName() const = 0;
+
+ /**
+ * The mode in which this tool should be run preferrably
+ *
+ * e.g. memcheck requires debug symbols, hence DebugMode is prefferred.
+ * otoh callgrind should look at optimized code, hence ReleaseMode.
+ */
+ enum ToolMode {
+ DebugMode,
+ ReleaseMode,
+ AnyMode
+ };
+ virtual ToolMode mode() const = 0;
+
+ QString modeString();
+
+ virtual void initialize(ExtensionSystem::IPlugin *plugin) = 0;
+
+ virtual IAnalyzerEngine *createEngine(ProjectExplorer::RunConfiguration *runConfiguration) = 0;
+};
+
+} // namespace Analyzer
+
+#endif // IANALYZERTOOL_H
diff --git a/src/plugins/analyzerbase/images/analyzer_category.png b/src/plugins/analyzerbase/images/analyzer_category.png
new file mode 100644
index 0000000000..ee63ca9a43
--- /dev/null
+++ b/src/plugins/analyzerbase/images/analyzer_category.png
Binary files differ
diff --git a/src/plugins/analyzerbase/images/analyzer_mode.png b/src/plugins/analyzerbase/images/analyzer_mode.png
new file mode 100644
index 0000000000..79d496dd6e
--- /dev/null
+++ b/src/plugins/analyzerbase/images/analyzer_mode.png
Binary files differ
diff --git a/src/plugins/analyzerbase/images/analyzer_start_small.png b/src/plugins/analyzerbase/images/analyzer_start_small.png
new file mode 100644
index 0000000000..8741c7c266
--- /dev/null
+++ b/src/plugins/analyzerbase/images/analyzer_start_small.png
Binary files differ
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 78eea4a09d..86ce393d8a 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -37,6 +37,7 @@ SUBDIRS = plugin_coreplugin \
plugin_bazaar \
plugin_classview \
plugin_tasklist \
+ plugin_analyzerbase \
plugin_qmljstools \
plugin_macros \
debugger/dumper.pro
@@ -242,6 +243,10 @@ plugin_tasklist.subdir = tasklist
plugin_tasklist.depends = plugin_coreplugin
plugin_tasklist.depends += plugin_projectexplorer
+plugin_analyzerbase.subdir = analyzerbase
+plugin_analyzerbase.depends = plugin_coreplugin
+plugin_analyzerbase.depends += plugin_projectexplorer
+
plugin_qmljstools.subdir = qmljstools
plugin_qmljstools.depends = plugin_projectexplorer
plugin_qmljstools.depends += plugin_coreplugin