summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Arnaud-Cormos <nicolas@kdab.com>2012-02-04 17:15:04 +0100
committerNicolas Arnaud-Cormos <nicolas@kdab.com>2012-02-04 17:15:04 +0100
commitd2139f1a4b0f43d27a3a40d43a1f9e9da1d33fb8 (patch)
tree51fb16fed1f37fd8dc659e1dc7df6503998780b7
Initialize the GammaRay plugin
-rw-r--r--Gammaray.pluginspec.in20
-rw-r--r--gammaray.pro53
-rw-r--r--gammarayconfigwidget.cpp155
-rw-r--r--gammarayconfigwidget.h81
-rw-r--r--gammarayconfigwidget.ui91
-rw-r--r--gammarayconstants.h60
-rw-r--r--gammarayengine.cpp239
-rw-r--r--gammarayengine.h82
-rw-r--r--gammarayplugin.cpp81
-rw-r--r--gammarayplugin.h57
-rw-r--r--gammarayruncontrolfactory.cpp109
-rw-r--r--gammarayruncontrolfactory.h60
-rw-r--r--gammaraysettings.cpp122
-rw-r--r--gammaraysettings.h93
-rw-r--r--gammaraytool.cpp135
-rw-r--r--gammaraytool.h73
-rw-r--r--gammarayversion.ui60
17 files changed, 1571 insertions, 0 deletions
diff --git a/Gammaray.pluginspec.in b/Gammaray.pluginspec.in
new file mode 100644
index 0000000..0eb17c7
--- /dev/null
+++ b/Gammaray.pluginspec.in
@@ -0,0 +1,20 @@
+<plugin name=\"Gammaray\" version=\"1.0\" compatVersion=\"1.0\">
+ <vendor>KDAB</vendor>
+ <copyright>(C) 2011 Kläralvdalens Datakonsult AB</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>Gammaray Plugin</description>
+ <url>http://www.kdab.com</url>
+ <dependencyList>
+ <dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/>
+ <dependency name=\"AnalyzerBase\" version=\"$$QTCREATOR_VERSION\"/>
+ </dependencyList>
+</plugin>
diff --git a/gammaray.pro b/gammaray.pro
new file mode 100644
index 0000000..b54ad3a
--- /dev/null
+++ b/gammaray.pro
@@ -0,0 +1,53 @@
+TARGET = Gammaray
+TEMPLATE = lib
+
+# DEFINES +=
+
+# QT +=
+
+# Gammaray files
+
+SOURCES += \
+ gammarayplugin.cpp \
+ gammaraytool.cpp \
+ gammarayengine.cpp \
+ gammaraysettings.cpp \
+ gammarayconfigwidget.cpp
+
+HEADERS += \
+ gammarayplugin.h \
+ gammaraytool.h \
+ gammarayengine.h \
+ gammarayconstants.h \
+ gammaraysettings.h \
+ gammarayconfigwidget.h
+
+FORMS += \
+ gammarayconfigwidget.ui \
+ gammarayversion.ui
+
+# Qt Creator linking
+
+## set the QTC_SOURCE environment variable to override the setting here
+QTCREATOR_SOURCES = $$(QTC_SOURCE)
+isEmpty(QTCREATOR_SOURCES):QTCREATOR_SOURCES=/d/dev/qt-creator/src
+
+## set the QTC_BUILD environment variable to override the setting here
+IDE_BUILD_TREE = $$(QTC_BUILD)
+isEmpty(IDE_BUILD_TREE):IDE_BUILD_TREE=/d/dev/qt-creator/build-Debug
+
+## uncomment to build plugin into user config directory
+## <localappdata>/plugins/<ideversion>
+## where <localappdata> is e.g.
+## "%LOCALAPPDATA%\Nokia\qtcreator" on Windows Vista and later
+## "$XDG_DATA_HOME/Nokia/qtcreator" or "~/.local/share/Nokia/qtcreator" on Linux
+## "~/Library/Application Support/Nokia/Qt Creator" on Mac
+USE_USER_DESTDIR = yes
+
+PROVIDER = KDAB
+
+include($$QTCREATOR_SOURCES/src/qtcreatorplugin.pri)
+include($$QTCREATOR_SOURCES/src/plugins/analyzerbase/analyzerbase.pri)
+include($$QTCREATOR_SOURCES/src/plugins/coreplugin/coreplugin.pri)
+
+LIBS += -L$$IDE_PLUGIN_PATH/Nokia
diff --git a/gammarayconfigwidget.cpp b/gammarayconfigwidget.cpp
new file mode 100644
index 0000000..1cb6e1e
--- /dev/null
+++ b/gammarayconfigwidget.cpp
@@ -0,0 +1,155 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "gammarayconfigwidget.h"
+#include "gammaraysettings.h"
+
+#include "ui_gammarayconfigwidget.h"
+#include "ui_gammarayversion.h"
+
+#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtversionmanager.h>
+
+#include <utils/qtcassert.h>
+#include <utils/pathchooser.h>
+
+#include <QtGui/QFileDialog>
+#include <QtGui/QTreeWidget>
+
+using namespace Gammaray;
+
+GammarayConfigWidget::GammarayConfigWidget(GammarayBaseSettings *settings,
+ QWidget *parent)
+ : QWidget(parent),
+ m_settings(settings),
+ m_ui(new Internal::Ui::GammarayConfigWidget),
+ m_versionUi(new Internal::Ui::GammarayVersion)
+{
+ m_ui->setupUi(this);
+
+ QWidget *versionInfoWidget = new QWidget();
+ m_versionUi->setupUi(versionInfoWidget);
+
+ m_ui->qtInfoWidget->setWidget(versionInfoWidget);
+ m_ui->qtInfoWidget->setState(Utils::DetailsWidget::NoSummary);
+
+ m_versionUi->gammarayExeChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
+ m_versionUi->gammarayExeChooser->setPromptDialogTitle(tr("Gammaray Command"));
+
+ m_ui->injectorCombo->addItem(tr("Default"), Constants::DefaultInjector);
+#ifndef Q_OS_WIN
+ m_ui->injectorCombo->addItem(tr("Preload"), Constants::PreloadInjector);
+#else
+ m_ui->injectorCombo->addItem(tr("WinDLL"), Constants::WinDLLInjector);
+#endif
+ m_ui->injectorCombo->addItem(tr("GDB"), Constants::GDBInjector);
+ m_ui->injectorCombo->addItem(tr("Style"), Constants::StyleInjector);
+ QTC_CHECK(m_ui->injectorCombo->count() == Constants::INJECTOR_COUNT);
+
+ initialize();
+ connect(m_ui->injectorCombo, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(selectInjector(int)));
+ connect(m_ui->qtVersionTable, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
+ this, SLOT(selectQtVersion(QTreeWidgetItem*)));
+ connect(m_versionUi->gammarayExeChooser, SIGNAL(changed(QString)),
+ this, SLOT(setGammarayExecutable(QString)));
+}
+
+GammarayConfigWidget::~GammarayConfigWidget()
+{
+ delete m_ui;
+}
+
+void GammarayConfigWidget::initialize()
+{
+ QList<QtSupport::BaseQtVersion *> versions = QtSupport::QtVersionManager::instance()->versions();
+
+ m_ui->qtVersionTable->clear();
+ foreach(QtSupport::BaseQtVersion *version, versions) {
+ QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->qtVersionTable);
+ item->setText(0, version->displayName());
+ item->setText(1, version->qmakeCommand().toString());
+ item->setText(2, m_settings->gammarayForQt(version->qmakeCommand().toString()));
+ }
+ m_ui->qtVersionTable->clearSelection();
+ m_ui->qtInfoWidget->hide();
+ m_versionUi->qtVersionName->clear();
+ m_versionUi->gammarayExeChooser->setPath("");
+
+ changeInjector(m_settings->injector());
+}
+
+void GammarayConfigWidget::selectInjector(int index)
+{
+ const QVariant data = m_ui->injectorCombo->itemData(index);
+
+ bool ok = true;
+ Constants::InjectorType type = static_cast<Constants::InjectorType>(data.toInt());
+ QTC_ASSERT(ok && type >= 0 && type < Constants::INJECTOR_COUNT, return);
+
+ m_settings->setInjector(type);
+}
+
+void GammarayConfigWidget::setGammarayExecutable(QString exec)
+{
+ QTreeWidgetItem *current = m_ui->qtVersionTable->currentItem();
+ if (current) {
+ m_settings->setGammarayForQt(current->text(1), exec);
+ }
+}
+
+void GammarayConfigWidget::selectQtVersion(QTreeWidgetItem *current)
+{
+ if (!current) {
+ m_ui->qtInfoWidget->hide();
+ }
+ else {
+ m_ui->qtInfoWidget->show();
+ m_versionUi->qtVersionName->setText(current->text(0));
+ m_versionUi->gammarayExeChooser->setPath(current->text(2));
+ m_versionUi->gammarayExeChooser->setEnabled(true);
+ }
+}
+
+void GammarayConfigWidget::changeInjector(Constants::InjectorType type)
+ {
+ for (int i = 0; i < m_ui->injectorCombo->count(); ++i) {
+ if (m_ui->injectorCombo->itemData(i).toInt() == type) {
+ m_ui->injectorCombo->setCurrentIndex(i);
+ return;
+ }
+ }
+ // unhandled
+ QTC_CHECK(false && "unhandled injector type");
+ m_ui->injectorCombo->setCurrentIndex(0);
+}
diff --git a/gammarayconfigwidget.h b/gammarayconfigwidget.h
new file mode 100644
index 0000000..77cfe17
--- /dev/null
+++ b/gammarayconfigwidget.h
@@ -0,0 +1,81 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef GAMMARAYCONFIGWIDGET_H
+#define GAMMARAYCONFIGWIDGET_H
+
+#include <QtGui/QWidget>
+
+#include "gammarayconstants.h"
+
+QT_BEGIN_NAMESPACE
+class QTreeWidgetItem;
+QT_END_NAMESPACE
+
+namespace Gammaray {
+
+namespace Internal {
+namespace Ui {
+class GammarayConfigWidget;
+class GammarayVersion;
+}
+}
+
+class GammarayBaseSettings;
+
+class GammarayConfigWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ GammarayConfigWidget(GammarayBaseSettings *settings, QWidget *parent);
+ virtual ~GammarayConfigWidget();
+
+private:
+ void changeInjector(Constants::InjectorType type);
+
+private slots:
+ void initialize();
+ void selectInjector(int);
+ void setGammarayExecutable(QString);
+ void selectQtVersion(QTreeWidgetItem*);
+
+private:
+ GammarayBaseSettings *m_settings;
+ Internal::Ui::GammarayConfigWidget *m_ui;
+ Internal::Ui::GammarayVersion *m_versionUi;
+};
+
+} // namespace Gammaray
+
+#endif // GAMMARAYCONFIGWIDGET_H
diff --git a/gammarayconfigwidget.ui b/gammarayconfigwidget.ui
new file mode 100644
index 0000000..e3331cf
--- /dev/null
+++ b/gammarayconfigwidget.ui
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Gammaray::Internal::GammarayConfigWidget</class>
+ <widget class="QWidget" name="Gammaray::Internal::GammarayConfigWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>669</width>
+ <height>312</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="gammarayOptions">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Generic Settings</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="injectorLabel">
+ <property name="text">
+ <string>Injector type:</string>
+ </property>
+ <property name="buddy">
+ <cstring>injectorCombo</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="injectorCombo"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>GammaRay versions</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QTreeWidget" name="qtVersionTable">
+ <property name="rootIsDecorated">
+ <bool>false</bool>
+ </property>
+ <attribute name="headerStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string>Qt Name</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>qmake Location</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>gammaray Location</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <widget class="Utils::DetailsWidget" name="qtInfoWidget" native="true"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>Utils::DetailsWidget</class>
+ <extends>QWidget</extends>
+ <header location="global">utils/detailswidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/gammarayconstants.h b/gammarayconstants.h
new file mode 100644
index 0000000..440a740
--- /dev/null
+++ b/gammarayconstants.h
@@ -0,0 +1,60 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef GAMMARAYCONSTANTS_H
+#define GAMMARAYCONSTANTS_H
+
+#include <QtCore/QLatin1String>
+#include <QtCore/QMetaType>
+
+namespace Gammaray {
+namespace Constants {
+
+enum InjectorType {
+ DefaultInjector,
+ GDBInjector,
+ StyleInjector,
+#ifndef Q_OS_WIN
+ PreloadInjector,
+#else
+ WinDLLInjector,
+#endif
+ INJECTOR_COUNT
+};
+
+} // namespace Constants
+} // namespace Gammaray
+
+Q_DECLARE_METATYPE(Gammaray::Constants::InjectorType);
+
+#endif // GAMMARAYCONSTANTS_H
diff --git a/gammarayengine.cpp b/gammarayengine.cpp
new file mode 100644
index 0000000..63e0d3e
--- /dev/null
+++ b/gammarayengine.cpp
@@ -0,0 +1,239 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "gammarayengine.h"
+
+#include "gammaraysettings.h"
+
+#include <analyzerbase/analyzermanager.h>
+#include <analyzerbase/analyzerstartparameters.h>
+
+#include <coreplugin/icore.h>
+#include <coreplugin/ioutputpane.h>
+#include <coreplugin/progressmanager/progressmanager.h>
+#include <coreplugin/progressmanager/futureprogress.h>
+
+#include <extensionsystem/pluginmanager.h>
+
+#include <utils/qtcassert.h>
+#include <utils/qtcprocess.h>
+
+#include <projectexplorer/runconfiguration.h>
+#include <projectexplorer/debugginghelper.h>
+#include <projectexplorer/applicationrunconfiguration.h>
+
+#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtversionmanager.h>
+
+#include <QtGui/QApplication>
+#include <QtGui/QMainWindow>
+#include <QtGui/QAction>
+
+#include <QtCore/QFileInfo>
+
+using namespace Analyzer;
+
+using namespace Gammaray;
+
+GammarayEngine::GammarayEngine(IAnalyzerTool *tool,
+ const AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration)
+ : IAnalyzerEngine(tool, sp, runConfiguration), m_settings(0)
+{
+ AnalyzerSettings *settings = 0;
+
+ if (runConfiguration) {
+ settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
+ }
+ if (!settings) {
+ settings = AnalyzerGlobalSettings::instance();
+ }
+
+ m_settings = settings->subConfig<GammarayBaseSettings>();
+ QTC_CHECK(m_settings);
+
+ connect(&m_progressWatcher, SIGNAL(canceled()),
+ this, SLOT(handleProgressCanceled()));
+ connect(&m_progressWatcher, SIGNAL(finished()),
+ this, SLOT(handleProgressFinished()));
+
+ connect(&m_process, SIGNAL(readyReadStandardOutput()),
+ SLOT(receiveStandardOutput()));
+ connect(&m_process, SIGNAL(readyReadStandardError()),
+ SLOT(receiveStandardError()));
+ connect(&m_process, SIGNAL(finished(int)),
+ SLOT(processFinished()));
+ connect(&m_process, SIGNAL(error(QProcess::ProcessError)),
+ SLOT(processError(QProcess::ProcessError)));
+
+ connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), this, SLOT(stopIt()));
+}
+
+GammarayEngine::~GammarayEngine()
+{
+}
+
+void GammarayEngine::handleProgressCanceled()
+{
+ AnalyzerManager::stopTool();
+}
+
+void GammarayEngine::handleProgressFinished()
+{
+ QApplication::alert(Core::ICore::instance()->mainWindow(), 3000);
+}
+
+bool GammarayEngine::start()
+{
+ ProjectExplorer::LocalApplicationRunConfiguration* rc =
+ dynamic_cast<ProjectExplorer::LocalApplicationRunConfiguration*>(runConfiguration());
+ QTC_ASSERT(rc, return false);
+
+ QString exe;
+
+ const Utils::FileName qmakePath = ProjectExplorer::DebuggingHelperLibrary::findSystemQt(rc->environment());
+ QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(qmakePath);
+ exe = m_settings->gammarayForQt(qmakePath.toString());
+ QFileInfo fi(exe);
+
+ if (!version) {
+ emit outputReceived(tr("Could not find Qt Version for QMake binary %1").arg(qmakePath.toString()),
+ Utils::ErrorMessageFormat);
+ finishOnError();
+ return false;
+ } else if (exe.isEmpty() || !fi.exists()) {
+ emit outputReceived(tr("The GammaRay executable is no set for Qt version %1.\n"
+ "Go to Options -> Analyzer -> GammaRay to set it.").arg(version->displayName()),
+ Utils::ErrorMessageFormat);
+ finishOnError();
+ return false;
+ }
+
+ emit starting(this);
+
+ Core::FutureProgress *fp =
+ Core::ICore::instance()->progressManager()->addTask(m_progress.future(),
+ tr("Investigating Application"),
+ "gammaray");
+ fp->setKeepOnFinish(Core::FutureProgress::HideOnFinish);
+ m_progress.reportStarted();
+ m_progressWatcher.setFuture(m_progress.future());
+
+ const AnalyzerStartParameters &sp = startParameters();
+ m_process.setWorkingDirectory(sp.workingDirectory);
+
+ if (!sp.analyzerCmdPrefix.isEmpty()) {
+ exe = sp.analyzerCmdPrefix + ' ' + exe;
+ }
+
+ QString arguments;
+ switch(m_settings->injector()) {
+ case Constants::DefaultInjector:
+ // nothing
+ break;
+ case Constants::GDBInjector:
+ Utils::QtcProcess::addArg(&arguments, "-i gdb");
+ case Constants::StyleInjector:
+ Utils::QtcProcess::addArg(&arguments, "-i style");
+ break;
+#ifndef Q_OS_WIN
+ case Constants::PreloadInjector:
+ Utils::QtcProcess::addArg(&arguments, "-i preload");
+ break;
+#else
+ case Constants::WinDLLInjector:
+ Utils::QtcProcess::addArg(&arguments, "-i windll");
+ break;
+#endif
+ }
+
+ Utils::QtcProcess::addArg(&arguments, sp.debuggee);
+ Utils::QtcProcess::addArgs(&arguments, sp.debuggeeArgs);
+
+ m_process.setCommand(exe, arguments);
+
+ m_process.setEnvironment(sp.environment);
+
+ m_process.start();
+
+ return true;
+}
+
+void GammarayEngine::stop()
+{
+ m_process.terminate();
+}
+
+void GammarayEngine::stopIt()
+{
+ stop();
+}
+
+void GammarayEngine::receiveStandardOutput()
+{
+ emit outputReceived(m_process.readAllStandardOutput(), Utils::StdOutFormat);
+}
+
+void GammarayEngine::receiveStandardError()
+{
+ emit outputReceived(m_process.readAllStandardError(), Utils::StdErrFormat);
+}
+
+void GammarayEngine::processFinished()
+{
+ emit outputReceived(tr("** Analyzing finished **\n"), Utils::NormalMessageFormat);
+ emit finished();
+
+ m_progress.reportFinished();
+}
+
+void GammarayEngine::processError(QProcess::ProcessError error)
+{
+ Q_UNUSED(error)
+ emit outputReceived(m_process.errorString(), Utils::ErrorMessageFormat);
+}
+
+void GammarayEngine::finishOnError()
+{
+ emit finished();
+
+ ///FIXME: get a better API for this into Qt Creator
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ QList<Core::IOutputPane *> panes = pm->getObjects<Core::IOutputPane>();
+ foreach (Core::IOutputPane *pane, panes) {
+ if (pane->displayName() == tr("Application Output")) {
+ pane->popup(false);
+ break;
+ }
+ }
+}
diff --git a/gammarayengine.h b/gammarayengine.h
new file mode 100644
index 0000000..8b2d9fd
--- /dev/null
+++ b/gammarayengine.h
@@ -0,0 +1,82 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef GAMMARAYENGINE_H
+#define GAMMARAYENGINE_H
+
+#include <analyzerbase/ianalyzerengine.h>
+
+#include <QtCore/QFutureWatcher>
+
+#include <utils/qtcprocess.h>
+
+namespace Gammaray {
+
+class GammarayBaseSettings;
+
+class GammarayEngine : public Analyzer::IAnalyzerEngine
+{
+ Q_OBJECT
+
+public:
+ GammarayEngine(Analyzer::IAnalyzerTool *tool,
+ const Analyzer::AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration);
+ ~GammarayEngine();
+
+ virtual bool start();
+ virtual void stop();
+
+private:
+ void finishOnError();
+
+private slots:
+ void stopIt();
+ void handleProgressCanceled();
+ void handleProgressFinished();
+ void processFinished();
+ void processError(QProcess::ProcessError error);
+
+ void receiveStandardOutput();
+ void receiveStandardError();
+
+private:
+ Utils::QtcProcess m_process;
+ QFutureInterface<void> m_progress;
+ QFutureWatcher<void> m_progressWatcher;
+ GammarayBaseSettings *m_settings;
+};
+
+}
+
+#endif // GAMMARAYENGINE_H
diff --git a/gammarayplugin.cpp b/gammarayplugin.cpp
new file mode 100644
index 0000000..f0d7202
--- /dev/null
+++ b/gammarayplugin.cpp
@@ -0,0 +1,81 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "gammarayplugin.h"
+
+#include "gammaraytool.h"
+
+#include <analyzerbase/analyzermanager.h>
+#include <analyzerbase/analyzersettings.h>
+
+#include <QtCore/QtPlugin>
+#include <QtCore/QDebug>
+
+using namespace Analyzer;
+using namespace Gammaray;
+
+////////////////////////////////////////////////////////////////////////
+//
+// GammarayPlugin
+//
+////////////////////////////////////////////////////////////////////////
+
+GammarayPlugin::GammarayPlugin()
+{
+}
+
+GammarayPlugin::~GammarayPlugin()
+{
+}
+
+bool GammarayPlugin::initialize(const QStringList &/*arguments*/, QString */*errorString*/)
+{
+ StartModes modes;
+ // They are handled the same actually.
+ //modes.append(StartMode(StartRemote));
+ modes.append(StartMode(StartLocal));
+ AnalyzerManager::addTool(new GammarayTool(this), modes);
+
+ return true;
+}
+
+void GammarayPlugin::extensionsInitialized()
+{
+}
+
+ExtensionSystem::IPlugin::ShutdownFlag GammarayPlugin::aboutToShutdown()
+{
+ return SynchronousShutdown;
+}
+
+Q_EXPORT_PLUGIN(GammarayPlugin)
diff --git a/gammarayplugin.h b/gammarayplugin.h
new file mode 100644
index 0000000..59390b5
--- /dev/null
+++ b/gammarayplugin.h
@@ -0,0 +1,57 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef GAMMARAYPLUGIN_H
+#define GAMMARAYPLUGIN_H
+
+#include <extensionsystem/iplugin.h>
+
+namespace Gammaray {
+
+class GammarayPlugin : public ExtensionSystem::IPlugin
+{
+ Q_OBJECT
+
+public:
+ GammarayPlugin();
+ virtual ~GammarayPlugin();
+
+ bool initialize(const QStringList &arguments, QString *errorString);
+ void extensionsInitialized();
+
+ ShutdownFlag aboutToShutdown();
+};
+
+} // namespace Gammaray
+
+#endif // GAMMARAYPLUGIN_H
diff --git a/gammarayruncontrolfactory.cpp b/gammarayruncontrolfactory.cpp
new file mode 100644
index 0000000..25622a9
--- /dev/null
+++ b/gammarayruncontrolfactory.cpp
@@ -0,0 +1,109 @@
+/**************************************************************************
+**
+** 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)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file 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 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "gammarayruncontrolfactory.h"
+
+#include "gammarayconstants.h"
+
+#include <utils/qtcassert.h>
+
+#include <analyzerbase/analyzerstartparameters.h>
+#include <analyzerbase/analyzerruncontrol.h>
+#include <analyzerbase/analyzermanager.h>
+#include <analyzerbase/analyzersettings.h>
+#include <analyzerbase/analyzerrunconfigwidget.h>
+
+#include <projectexplorer/applicationrunconfiguration.h>
+
+using namespace Gammaray;
+using namespace ProjectExplorer;
+using namespace Analyzer;
+
+GammarayRunControlFactory::GammarayRunControlFactory(QObject *parent)
+ : IRunControlFactory(parent)
+{
+ setObjectName(QLatin1String("GammarayRuncontrolFactory"));
+}
+
+QString GammarayRunControlFactory::displayName() const
+{
+ return tr("Gammaray");
+}
+
+bool GammarayRunControlFactory::canRun(RunConfiguration *runConfiguration,
+ const QString &mode) const
+{
+ return
+ mode == Constants::RUNMODE &&
+ dynamic_cast<LocalApplicationRunConfiguration*>(runConfiguration);
+}
+
+RunControl *GammarayRunControlFactory::create(RunConfiguration *runConfiguration,
+ const QString &mode)
+{
+ QTC_ASSERT(canRun(runConfiguration, mode), return 0);
+
+ AnalyzerStartParameters sp;
+ sp.toolId = Constants::TOOLID;
+ sp.startMode = StartLocal;
+
+ LocalApplicationRunConfiguration *rc =
+ dynamic_cast<LocalApplicationRunConfiguration*>(runConfiguration);
+ sp.environment = rc->environment();
+ sp.workingDirectory = rc->workingDirectory();
+ sp.debuggee = rc->executable();
+ sp.debuggeeArgs = rc->commandLineArguments();
+ sp.displayName = rc->displayName();
+
+ IAnalyzerTool *tool = AnalyzerManager::toolFromId(Constants::TOOLID);
+ AnalyzerRunControl *ret = new AnalyzerRunControl(tool, sp, runConfiguration);
+ /// TODO
+ // QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
+ return ret;
+}
+
+RunConfigWidget *
+GammarayRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
+{
+ AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
+ if (!settings) {
+ return 0;
+ }
+
+ AnalyzerRunConfigWidget *ret = new Analyzer::AnalyzerRunConfigWidget;
+ ret->setRunConfiguration(runConfiguration);
+ return ret;
+}
+
+IRunConfigurationAspect *GammarayRunControlFactory::createRunConfigurationAspect()
+{
+ return new AnalyzerProjectSettings;
+}
diff --git a/gammarayruncontrolfactory.h b/gammarayruncontrolfactory.h
new file mode 100644
index 0000000..ec29c25
--- /dev/null
+++ b/gammarayruncontrolfactory.h
@@ -0,0 +1,60 @@
+/**************************************************************************
+**
+** 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)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file 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 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+#ifndef GAMMARAYRUNCONTROLFACTORY_H
+#define GAMMARAYRUNCONTROLFACTORY_H
+
+#include <projectexplorer/runconfiguration.h>
+
+namespace Gammaray {
+
+class GammarayRunControlFactory : public ProjectExplorer::IRunControlFactory
+{
+ Q_OBJECT
+public:
+ GammarayRunControlFactory(QObject *parent = 0);
+
+ virtual QString displayName() const;
+
+ virtual bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
+ const QString &mode) const;
+
+ virtual ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
+ const QString &mode);
+
+ virtual ProjectExplorer::RunConfigWidget *
+ createConfigurationWidget(ProjectExplorer::RunConfiguration *runConfiguration);
+
+ virtual ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect();
+};
+
+}
+
+#endif // GAMMARAYRUNCONTROLFACTORY_H
diff --git a/gammaraysettings.cpp b/gammaraysettings.cpp
new file mode 100644
index 0000000..e00e28c
--- /dev/null
+++ b/gammaraysettings.cpp
@@ -0,0 +1,122 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "gammaraysettings.h"
+#include "gammarayconfigwidget.h"
+
+#include <coreplugin/icore.h>
+#include <utils/qtcassert.h>
+
+#include <QtCore/QSettings>
+#include <QtCore/QDebug>
+
+using namespace Analyzer;
+
+using namespace Gammaray;
+
+namespace {
+static const QLatin1String injectorC("Analyzer.Gammaray.Injector");
+static const QLatin1String gammarayForQtC("Analyzer.Gammaray.GammarayForQt");
+}
+
+QVariantMap GammarayBaseSettings::toMap() const
+{
+ QVariantMap map;
+
+ map.insert(injectorC, m_injector);
+ map.insert(gammarayForQtC, m_gammarayForQt);
+
+ return map;
+}
+
+QVariantMap GammarayBaseSettings::defaults() const
+{
+ QVariantMap map;
+
+ map.insert(injectorC, Constants::DefaultInjector);
+ map.insert(gammarayForQtC, QVariantMap());
+
+ return map;
+}
+
+bool GammarayBaseSettings::fromMap(const QVariantMap &map)
+{
+ int injector = 0;
+ setIfPresent(map, injectorC, &injector);
+ QTC_CHECK(injector >= 0 && injector < Constants::INJECTOR_COUNT);
+ m_injector = static_cast<Constants::InjectorType>(injector);
+
+ setIfPresent(map, gammarayForQtC, &m_gammarayForQt);
+
+ emit changed();
+ return true;
+}
+
+QString GammarayBaseSettings::id() const
+{
+ return "Analyzer.Gammaray.Settings";
+}
+
+QString GammarayBaseSettings::displayName() const
+{
+ return tr("Gammaray");
+}
+
+Constants::InjectorType GammarayBaseSettings::injector() const
+{
+ return m_injector;
+}
+
+QString GammarayBaseSettings::gammarayForQt(const QString &qmakePath) const
+{
+ if (m_gammarayForQt.contains(qmakePath))
+ return m_gammarayForQt.value(qmakePath).toString();
+ return QString();
+}
+
+void GammarayBaseSettings::setInjector(Constants::InjectorType injector)
+{
+ m_injector = injector;
+ emit changed();
+}
+
+void GammarayBaseSettings::setGammarayForQt(const QString &qmakePath, const QString &gammaray)
+{
+ m_gammarayForQt[qmakePath] = gammaray;
+ emit changed();
+}
+
+QWidget *GammarayBaseSettings::createConfigWidget(QWidget *parent)
+{
+ return new GammarayConfigWidget(this, parent);
+}
diff --git a/gammaraysettings.h b/gammaraysettings.h
new file mode 100644
index 0000000..a94fb0e
--- /dev/null
+++ b/gammaraysettings.h
@@ -0,0 +1,93 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef GAMMARAYSETTINGS_H
+#define GAMMARAYSETTINGS_H
+
+#include <analyzerbase/analyzersettings.h>
+
+#include "gammarayconstants.h"
+
+namespace Gammaray {
+
+/**
+ * Gammaray settings shared for global and per-project.
+ */
+class GammarayBaseSettings : public Analyzer::AbstractAnalyzerSubConfig
+{
+ Q_OBJECT
+
+public:
+ GammarayBaseSettings() {}
+
+ virtual QVariantMap toMap() const;
+ virtual QVariantMap defaults() const;
+ virtual bool fromMap(const QVariantMap &map);
+
+ virtual QString id() const;
+ virtual QString displayName() const;
+
+ virtual QWidget *createConfigWidget(QWidget *parent);
+
+ /**
+ * Base gammaray settings
+ */
+public:
+ Constants::InjectorType injector() const;
+ QString gammarayForQt(const QString &qmakePath) const;
+
+public slots:
+ void setInjector(Constants::InjectorType);
+ void setGammarayForQt(const QString &qmakePath, const QString &gammaray);
+
+signals:
+ void changed(); // sent when multiple values have changed simulatenously (e.g. fromMap)
+
+private:
+ Constants::InjectorType m_injector;
+ QVariantMap m_gammarayForQt;
+};
+
+/**
+ * Global gammaray settings
+ */
+typedef GammarayBaseSettings GammarayGlobalSettings;
+
+/**
+ * Per-project gammaray settings.
+ */
+typedef GammarayBaseSettings GammarayProjectSettings;
+
+} // namespace Gammaray
+
+#endif // GAMMARAYSETTINGS_H
diff --git a/gammaraytool.cpp b/gammaraytool.cpp
new file mode 100644
index 0000000..f19e21f
--- /dev/null
+++ b/gammaraytool.cpp
@@ -0,0 +1,135 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "gammaraytool.h"
+
+#include "gammarayengine.h"
+#include "gammarayconstants.h"
+#include "gammaraysettings.h"
+
+#include <analyzerbase/analyzermanager.h>
+#include <analyzerbase/analyzersettings.h>
+
+#include <projectexplorer/applicationrunconfiguration.h>
+
+#include <QtGui/QWidget>
+
+using namespace Analyzer;
+using namespace ProjectExplorer;
+using namespace Gammaray;
+
+GammarayTool::GammarayTool(QObject *parent)
+ : IAnalyzerTool(parent)
+{
+ setObjectName("GammarayTool");
+}
+
+void GammarayTool::startTool(StartMode mode)
+{
+ Q_UNUSED(mode)
+ AnalyzerManager::startLocalTool(this);
+}
+
+IAnalyzerEngine *GammarayTool::createEngine(const AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration)
+{
+ GammarayEngine *engine = new GammarayEngine(this, sp, runConfiguration);
+
+ AnalyzerManager::showStatusMessage(AnalyzerManager::msgToolStarted(displayName()));
+ return engine;
+}
+
+QWidget *GammarayTool::createWidgets()
+{
+ return new QWidget;
+}
+
+void GammarayTool::extensionsInitialized()
+{
+
+}
+
+IAnalyzerTool::ToolMode GammarayTool::toolMode() const
+{
+ return DebugMode;
+}
+
+QString GammarayTool::description() const
+{
+ return tr("Get internal informations from your applications.");
+}
+
+QString GammarayTool::displayName() const
+{
+ return tr("GammaRay");
+}
+
+Core::Id GammarayTool::id() const
+{
+ return "GammaRay";
+}
+
+RunMode GammarayTool::runMode() const
+{
+ (RunMode)0x6825;
+}
+
+bool GammarayTool::canRun(ProjectExplorer::RunConfiguration *runConfiguration, RunMode mode) const
+{
+ Q_UNUSED(mode)
+ return dynamic_cast<LocalApplicationRunConfiguration*>(runConfiguration);
+}
+
+AnalyzerStartParameters GammarayTool::createStartParameters(RunConfiguration *runConfiguration,
+ RunMode mode) const
+{
+ Q_UNUSED(mode)
+
+ AnalyzerStartParameters sp;
+ sp.startMode = StartLocal;
+
+ LocalApplicationRunConfiguration *rc =
+ dynamic_cast<LocalApplicationRunConfiguration*>(runConfiguration);
+ sp.environment = rc->environment();
+ sp.workingDirectory = rc->workingDirectory();
+ sp.debuggee = rc->executable();
+ sp.debuggeeArgs = rc->commandLineArguments();
+ sp.displayName = rc->displayName();
+
+ return sp;
+}
+
+AbstractAnalyzerSubConfig *GammarayTool::createGlobalSettings()
+{
+ return new GammarayGlobalSettings();
+}
diff --git a/gammaraytool.h b/gammaraytool.h
new file mode 100644
index 0000000..c98a77e
--- /dev/null
+++ b/gammaraytool.h
@@ -0,0 +1,73 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+#ifndef GAMMARAYTOOL_H
+#define GAMMARAYTOOL_H
+
+#include <analyzerbase/ianalyzertool.h>
+
+namespace Gammaray {
+
+class GammarayTool : public Analyzer::IAnalyzerTool
+{
+public:
+ explicit GammarayTool(QObject *parent = 0);
+
+ void startTool(Analyzer::StartMode mode);
+
+ Analyzer::IAnalyzerEngine *createEngine(
+ const Analyzer::AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration = 0);
+
+ QWidget *createWidgets();
+ void extensionsInitialized();
+
+ Analyzer::IAnalyzerTool::ToolMode toolMode() const;
+
+ QString description() const;
+ QString displayName() const;
+ Core::Id id() const;
+ ProjectExplorer::RunMode runMode() const;
+
+ bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
+ ProjectExplorer::RunMode mode) const;
+
+ Analyzer::AnalyzerStartParameters createStartParameters(
+ ProjectExplorer::RunConfiguration *runConfiguration,
+ ProjectExplorer::RunMode mode) const;
+
+ Analyzer::AbstractAnalyzerSubConfig *createGlobalSettings();
+};
+
+} // namespace Gammaray
+
+#endif // GAMMARAYTOOL_H
diff --git a/gammarayversion.ui b/gammarayversion.ui
new file mode 100644
index 0000000..b68da48
--- /dev/null
+++ b/gammarayversion.ui
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Gammaray::Internal::GammarayVersion</class>
+ <widget class="QWidget" name="Gammaray::Internal::GammarayVersion">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>275</width>
+ <height>53</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Qt version name:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="qtVersionName">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>gammaray location:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="Utils::PathChooser" name="gammarayExeChooser" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>Utils::PathChooser</class>
+ <extends>QWidget</extends>
+ <header location="global">utils/pathchooser.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>