forked from qt-creator/qt-creator
Analyzer: Cleanup settings handling
More flexible, less over-engineered this way. Change-Id: I3e224a6be85d3a187056d79fd506e8cf6a32c8a9 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -12,7 +12,6 @@ SOURCES += \
|
|||||||
analyzerruncontrol.cpp \
|
analyzerruncontrol.cpp \
|
||||||
analyzermanager.cpp \
|
analyzermanager.cpp \
|
||||||
analyzersettings.cpp \
|
analyzersettings.cpp \
|
||||||
analyzeroptionspage.cpp \
|
|
||||||
analyzerrunconfigwidget.cpp \
|
analyzerrunconfigwidget.cpp \
|
||||||
analyzerutils.cpp \
|
analyzerutils.cpp \
|
||||||
startremotedialog.cpp
|
startremotedialog.cpp
|
||||||
@@ -26,7 +25,6 @@ HEADERS += \
|
|||||||
analyzermanager.h \
|
analyzermanager.h \
|
||||||
analyzersettings.h \
|
analyzersettings.h \
|
||||||
analyzerstartparameters.h \
|
analyzerstartparameters.h \
|
||||||
analyzeroptionspage.h \
|
|
||||||
analyzerrunconfigwidget.h \
|
analyzerrunconfigwidget.h \
|
||||||
analyzerutils.h \
|
analyzerutils.h \
|
||||||
startremotedialog.h
|
startremotedialog.h
|
||||||
|
@@ -18,8 +18,6 @@ QtcPlugin {
|
|||||||
"analyzerconstants.h",
|
"analyzerconstants.h",
|
||||||
"analyzermanager.cpp",
|
"analyzermanager.cpp",
|
||||||
"analyzermanager.h",
|
"analyzermanager.h",
|
||||||
"analyzeroptionspage.cpp",
|
|
||||||
"analyzeroptionspage.h",
|
|
||||||
"analyzerplugin.cpp",
|
"analyzerplugin.cpp",
|
||||||
"analyzerplugin.h",
|
"analyzerplugin.h",
|
||||||
"analyzerrunconfigwidget.cpp",
|
"analyzerrunconfigwidget.cpp",
|
||||||
|
@@ -632,8 +632,8 @@ void AnalyzerManager::extensionsInitialized()
|
|||||||
|
|
||||||
void AnalyzerManager::shutdown()
|
void AnalyzerManager::shutdown()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->m_currentAction, return);
|
if (d->m_currentAction)
|
||||||
d->saveToolSettings(d->m_currentAction);
|
d->saveToolSettings(d->m_currentAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerManager::addAction(AnalyzerAction *action)
|
void AnalyzerManager::addAction(AnalyzerAction *action)
|
||||||
|
@@ -1,64 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** 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, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "analyzeroptionspage.h"
|
|
||||||
#include "analyzersettings.h"
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
using namespace Analyzer;
|
|
||||||
using namespace Analyzer::Internal;
|
|
||||||
|
|
||||||
AnalyzerOptionsPage::AnalyzerOptionsPage(AbstractAnalyzerSubConfig *config, QObject *parent) :
|
|
||||||
Core::IOptionsPage(parent),
|
|
||||||
m_config(config)
|
|
||||||
{
|
|
||||||
setId(m_config->id());
|
|
||||||
setDisplayName(m_config->displayName());
|
|
||||||
setCategory("T.Analyzer");
|
|
||||||
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
|
|
||||||
setCategoryIcon(QLatin1String(":/images/analyzer_category.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *AnalyzerOptionsPage::createPage(QWidget *parent)
|
|
||||||
{
|
|
||||||
return m_config->createConfigWidget(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerOptionsPage::apply()
|
|
||||||
{
|
|
||||||
AnalyzerGlobalSettings::instance()->writeSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerOptionsPage::finish()
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,60 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** 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, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#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);
|
|
||||||
|
|
||||||
QWidget *createPage(QWidget *parent);
|
|
||||||
void apply();
|
|
||||||
void finish();
|
|
||||||
|
|
||||||
private:
|
|
||||||
AbstractAnalyzerSubConfig *m_config;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Analyzer
|
|
||||||
|
|
||||||
#endif // ANALYZER_INTERNAL_ANALYZEROPTIONSPAGE_H
|
|
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "analyzerrunconfigwidget.h"
|
#include "analyzerrunconfigwidget.h"
|
||||||
|
|
||||||
|
#include <utils/detailswidget.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -42,30 +43,15 @@
|
|||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
AnalyzerToolDetailWidget::AnalyzerToolDetailWidget(AbstractAnalyzerSubConfig *config, QWidget *parent)
|
AnalyzerRunConfigWidget::AnalyzerRunConfigWidget(AnalyzerRunConfigurationAspect *aspect)
|
||||||
: Utils::DetailsWidget(parent)
|
|
||||||
{
|
{
|
||||||
QTC_ASSERT(config!=0, return);
|
m_aspect = aspect;
|
||||||
|
m_config = aspect->customSubConfig();
|
||||||
|
|
||||||
// update summary text
|
QWidget *globalSetting = new QWidget;
|
||||||
setSummaryText(tr("<strong>%1</strong> settings").arg(config->displayName()));
|
|
||||||
|
|
||||||
// create config widget
|
|
||||||
QWidget *configWidget = config->createConfigWidget(this);
|
|
||||||
setWidget(configWidget);
|
|
||||||
}
|
|
||||||
|
|
||||||
AnalyzerRunConfigWidget::AnalyzerRunConfigWidget()
|
|
||||||
{
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
|
|
||||||
QWidget *globalSetting = new QWidget(this);
|
|
||||||
QHBoxLayout *globalSettingLayout = new QHBoxLayout(globalSetting);
|
QHBoxLayout *globalSettingLayout = new QHBoxLayout(globalSetting);
|
||||||
globalSettingLayout->setContentsMargins(0, 0, 0, 0);
|
globalSettingLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->addWidget(globalSetting);
|
|
||||||
QLabel *label = new QLabel(tr("Analyzer settings:"), globalSetting);
|
|
||||||
globalSettingLayout->addWidget(label);
|
|
||||||
m_settingsCombo = new QComboBox(globalSetting);
|
m_settingsCombo = new QComboBox(globalSetting);
|
||||||
m_settingsCombo->addItems(QStringList()
|
m_settingsCombo->addItems(QStringList()
|
||||||
<< QApplication::translate("ProjectExplorer::Internal::EditorSettingsPropertiesPage", "Global")
|
<< QApplication::translate("ProjectExplorer::Internal::EditorSettingsPropertiesPage", "Global")
|
||||||
@@ -80,45 +66,41 @@ AnalyzerRunConfigWidget::AnalyzerRunConfigWidget()
|
|||||||
connect(m_restoreButton, SIGNAL(clicked()), this, SLOT(restoreGlobal()));
|
connect(m_restoreButton, SIGNAL(clicked()), this, SLOT(restoreGlobal()));
|
||||||
globalSettingLayout->addStretch(2);
|
globalSettingLayout->addStretch(2);
|
||||||
|
|
||||||
m_subConfigWidget = new QWidget(this);
|
QWidget *innerPane = new QWidget;
|
||||||
QVBoxLayout *subConfigLayout = new QVBoxLayout(m_subConfigWidget);
|
m_configWidget = m_config->createConfigWidget(innerPane);
|
||||||
subConfigLayout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
layout->addWidget(m_subConfigWidget);
|
QVBoxLayout *layout = new QVBoxLayout(innerPane);
|
||||||
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
layout->addWidget(globalSetting);
|
||||||
|
layout->addWidget(m_configWidget);
|
||||||
|
|
||||||
|
m_details = new Utils::DetailsWidget;
|
||||||
|
m_details->setWidget(innerPane);
|
||||||
|
|
||||||
|
QVBoxLayout *outerLayout = new QVBoxLayout(this);
|
||||||
|
outerLayout->addWidget(m_details);
|
||||||
|
outerLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
chooseSettings(m_aspect->isUsingGlobalSettings() ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AnalyzerRunConfigWidget::displayName() const
|
QString AnalyzerRunConfigWidget::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Analyzer Settings");
|
return m_aspect->displayName();
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerRunConfigWidget::setRunConfigurationAspect(AnalyzerRunConfigurationAspect *aspect)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(aspect, return);
|
|
||||||
m_aspect = aspect;
|
|
||||||
|
|
||||||
// add config widget for each sub config
|
|
||||||
foreach (AbstractAnalyzerSubConfig *config, m_aspect->customSubConfigs()) {
|
|
||||||
QWidget *widget = new AnalyzerToolDetailWidget(config);
|
|
||||||
m_subConfigWidget->layout()->addWidget(widget);
|
|
||||||
}
|
|
||||||
setDetailEnabled(!m_aspect->isUsingGlobalSettings());
|
|
||||||
m_settingsCombo->setCurrentIndex(m_aspect->isUsingGlobalSettings() ? 0 : 1);
|
|
||||||
m_restoreButton->setEnabled(!m_aspect->isUsingGlobalSettings());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerRunConfigWidget::setDetailEnabled(bool value)
|
|
||||||
{
|
|
||||||
QList<AnalyzerToolDetailWidget*> details = findChildren<AnalyzerToolDetailWidget*>();
|
|
||||||
foreach (AnalyzerToolDetailWidget *detail, details)
|
|
||||||
detail->widget()->setEnabled(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerRunConfigWidget::chooseSettings(int setting)
|
void AnalyzerRunConfigWidget::chooseSettings(int setting)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_aspect, return);
|
QTC_ASSERT(m_aspect, return);
|
||||||
setDetailEnabled(setting != 0);
|
bool isCustom = (setting == 1);
|
||||||
m_aspect->setUsingGlobalSettings(setting == 0);
|
|
||||||
m_restoreButton->setEnabled(!m_aspect->isUsingGlobalSettings());
|
m_settingsCombo->setCurrentIndex(setting);
|
||||||
|
m_aspect->setUsingGlobalSettings(!isCustom);
|
||||||
|
m_configWidget->setEnabled(isCustom);
|
||||||
|
m_restoreButton->setEnabled(isCustom);
|
||||||
|
m_details->setSummaryText(isCustom
|
||||||
|
? tr("Use <strong>Customized Settings<strong>")
|
||||||
|
: tr("Use <strong>Global Settings<strong>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerRunConfigWidget::restoreGlobal()
|
void AnalyzerRunConfigWidget::restoreGlobal()
|
||||||
|
@@ -33,54 +33,36 @@
|
|||||||
|
|
||||||
#include "analyzersettings.h"
|
#include "analyzersettings.h"
|
||||||
|
|
||||||
#include <utils/detailswidget.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils { class DetailsWidget; }
|
||||||
class DetailsWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
class AbstractAnalyzerSubConfig;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class AnalyzerToolDetailWidget : public Utils::DetailsWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit AnalyzerToolDetailWidget(AbstractAnalyzerSubConfig *config, QWidget *parent=0);
|
|
||||||
};
|
|
||||||
|
|
||||||
class AnalyzerRunConfigWidget : public ProjectExplorer::RunConfigWidget
|
class AnalyzerRunConfigWidget : public ProjectExplorer::RunConfigWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AnalyzerRunConfigWidget();
|
AnalyzerRunConfigWidget(AnalyzerRunConfigurationAspect *aspect);
|
||||||
|
|
||||||
virtual QString displayName() const;
|
QString displayName() const;
|
||||||
|
|
||||||
void setRunConfigurationAspect(AnalyzerRunConfigurationAspect *aspect);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void setDetailEnabled(bool value);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void chooseSettings(int setting);
|
void chooseSettings(int setting);
|
||||||
void restoreGlobal();
|
void restoreGlobal();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *m_subConfigWidget;
|
QWidget *m_configWidget;
|
||||||
AnalyzerRunConfigurationAspect *m_aspect;
|
AnalyzerRunConfigurationAspect *m_aspect;
|
||||||
|
AbstractAnalyzerSubConfig *m_config;
|
||||||
QComboBox *m_settingsCombo;
|
QComboBox *m_settingsCombo;
|
||||||
QPushButton *m_restoreButton;
|
QPushButton *m_restoreButton;
|
||||||
|
Utils::DetailsWidget *m_details;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -34,7 +34,6 @@
|
|||||||
#include "analyzerrunconfigwidget.h"
|
#include "analyzerrunconfigwidget.h"
|
||||||
#include "ianalyzertool.h"
|
#include "ianalyzertool.h"
|
||||||
#include "analyzerplugin.h"
|
#include "analyzerplugin.h"
|
||||||
#include "analyzeroptionspage.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -43,168 +42,38 @@
|
|||||||
|
|
||||||
using namespace Analyzer::Internal;
|
using namespace Analyzer::Internal;
|
||||||
|
|
||||||
static const char groupC[] = "Analyzer";
|
|
||||||
static const char useGlobalC[] = "Analyzer.Project.UseGlobal";
|
static const char useGlobalC[] = "Analyzer.Project.UseGlobal";
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
AnalyzerGlobalSettings *AnalyzerGlobalSettings::m_instance = 0;
|
AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect(
|
||||||
|
AbstractAnalyzerSubConfig *customConfiguration,
|
||||||
AnalyzerSettings::AnalyzerSettings(QObject *parent)
|
AbstractAnalyzerSubConfig *globalConfiguration)
|
||||||
: QObject(parent)
|
|
||||||
{
|
{
|
||||||
|
m_useGlobalSettings = true;
|
||||||
|
m_customConfiguration = customConfiguration;
|
||||||
|
m_globalConfiguration = globalConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerSettings::AnalyzerSettings(const AnalyzerSettings *other)
|
AbstractAnalyzerSubConfig *AnalyzerRunConfigurationAspect::currentConfig() const
|
||||||
{
|
{
|
||||||
Q_UNUSED(other);
|
return m_useGlobalSettings ? m_globalConfiguration : m_customConfiguration;
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap AnalyzerSettings::defaults() const
|
|
||||||
{
|
|
||||||
QVariantMap map;
|
|
||||||
foreach (AbstractAnalyzerSubConfig *config, subConfigs()) {
|
|
||||||
map.unite(config->defaults());
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerSettings::fromMap(const QVariantMap &map)
|
|
||||||
{
|
|
||||||
fromMap(map, &m_subConfigs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerSettings::fromMap(const QVariantMap &map, QList<AbstractAnalyzerSubConfig *> *subConfigs)
|
|
||||||
{
|
|
||||||
foreach (AbstractAnalyzerSubConfig *config, *subConfigs)
|
|
||||||
config->fromMap(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap AnalyzerSettings::toMap() const
|
|
||||||
{
|
|
||||||
return toMap(m_subConfigs);
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap AnalyzerSettings::toMap(const QList<AbstractAnalyzerSubConfig *> &subConfigs) const
|
|
||||||
{
|
|
||||||
QVariantMap map;
|
|
||||||
foreach (AbstractAnalyzerSubConfig *config, subConfigs) {
|
|
||||||
map.unite(config->toMap());
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
AnalyzerGlobalSettings::AnalyzerGlobalSettings(QObject *parent)
|
|
||||||
: AnalyzerSettings(parent)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(!m_instance, return);
|
|
||||||
m_instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
AnalyzerGlobalSettings *AnalyzerGlobalSettings::instance()
|
|
||||||
{
|
|
||||||
if (!m_instance)
|
|
||||||
m_instance = new AnalyzerGlobalSettings(AnalyzerPlugin::instance());
|
|
||||||
|
|
||||||
return m_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
AnalyzerGlobalSettings::~AnalyzerGlobalSettings()
|
|
||||||
{
|
|
||||||
m_instance = 0;
|
|
||||||
qDeleteAll(m_subConfigs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerGlobalSettings::readSettings()
|
|
||||||
{
|
|
||||||
QSettings *settings = Core::ICore::settings();
|
|
||||||
|
|
||||||
QVariantMap map;
|
|
||||||
|
|
||||||
settings->beginGroup(QLatin1String(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::settings();
|
|
||||||
settings->beginGroup(QLatin1String(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::registerConfig(AbstractAnalyzerSubConfig *config)
|
|
||||||
{
|
|
||||||
instance()->m_subConfigs.append(config);
|
|
||||||
AnalyzerPlugin::instance()->addAutoReleasedObject(new AnalyzerOptionsPage(config));
|
|
||||||
m_instance->readSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static QList<AnalyzerSubConfigFactory *> &theAnalyzerSubConfigFactories()
|
|
||||||
{
|
|
||||||
static QList<AnalyzerSubConfigFactory *> theFactories;
|
|
||||||
return theFactories;
|
|
||||||
}
|
|
||||||
|
|
||||||
AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect()
|
|
||||||
: AnalyzerSettings((QObject *)0), m_useGlobalSettings(true)
|
|
||||||
{
|
|
||||||
// add sub configs
|
|
||||||
foreach (AnalyzerSubConfigFactory *factory, theAnalyzerSubConfigFactories())
|
|
||||||
m_customConfigurations.append(factory->createProjectSettings());
|
|
||||||
|
|
||||||
m_subConfigs = AnalyzerGlobalSettings::instance()->subConfigs();
|
|
||||||
resetCustomToGlobalSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect(const AnalyzerRunConfigurationAspect *other)
|
|
||||||
: AnalyzerSettings(other), m_useGlobalSettings(other->m_useGlobalSettings)
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (AbstractAnalyzerSubConfig *config, other->m_customConfigurations)
|
|
||||||
m_customConfigurations.append(config->clone());
|
|
||||||
|
|
||||||
if (m_useGlobalSettings)
|
|
||||||
m_subConfigs = AnalyzerGlobalSettings::instance()->subConfigs();
|
|
||||||
else
|
|
||||||
m_subConfigs = m_customConfigurations;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerRunConfigurationAspect::~AnalyzerRunConfigurationAspect()
|
AnalyzerRunConfigurationAspect::~AnalyzerRunConfigurationAspect()
|
||||||
{
|
{
|
||||||
qDeleteAll(m_customConfigurations);
|
delete m_customConfiguration;
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerRunConfigurationAspect::registerConfigFactory(AnalyzerSubConfigFactory *factory)
|
|
||||||
{
|
|
||||||
theAnalyzerSubConfigFactories().append(factory);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AnalyzerRunConfigurationAspect::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Analyzer Settings");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerRunConfigurationAspect::fromMap(const QVariantMap &map)
|
void AnalyzerRunConfigurationAspect::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
AnalyzerSettings::fromMap(map, &m_customConfigurations);
|
m_customConfiguration->fromMap(map);
|
||||||
m_useGlobalSettings = map.value(QLatin1String(useGlobalC), true).toBool();
|
m_useGlobalSettings = map.value(QLatin1String(useGlobalC), true).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap AnalyzerRunConfigurationAspect::toMap() const
|
QVariantMap AnalyzerRunConfigurationAspect::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map = AnalyzerSettings::toMap(m_customConfigurations);
|
QVariantMap map = m_customConfiguration->toMap();
|
||||||
map.insert(QLatin1String(useGlobalC), m_useGlobalSettings);
|
map.insert(QLatin1String(useGlobalC), m_useGlobalSettings);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -213,31 +82,27 @@ AnalyzerRunConfigurationAspect *AnalyzerRunConfigurationAspect::clone(
|
|||||||
ProjectExplorer::RunConfiguration *parent) const
|
ProjectExplorer::RunConfiguration *parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
return new AnalyzerRunConfigurationAspect(this);
|
AnalyzerRunConfigurationAspect *other
|
||||||
|
= new AnalyzerRunConfigurationAspect(m_customConfiguration->clone(), m_globalConfiguration);
|
||||||
|
other->m_useGlobalSettings = m_useGlobalSettings;
|
||||||
|
return other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerRunConfigurationAspect::setUsingGlobalSettings(bool value)
|
void AnalyzerRunConfigurationAspect::setUsingGlobalSettings(bool value)
|
||||||
{
|
{
|
||||||
if (value == m_useGlobalSettings)
|
|
||||||
return;
|
|
||||||
m_useGlobalSettings = value;
|
m_useGlobalSettings = value;
|
||||||
if (m_useGlobalSettings)
|
|
||||||
m_subConfigs = AnalyzerGlobalSettings::instance()->subConfigs();
|
|
||||||
else
|
|
||||||
m_subConfigs = m_customConfigurations;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerRunConfigurationAspect::resetCustomToGlobalSettings()
|
void AnalyzerRunConfigurationAspect::resetCustomToGlobalSettings()
|
||||||
{
|
{
|
||||||
AnalyzerGlobalSettings *gs = AnalyzerGlobalSettings::instance();
|
AbstractAnalyzerSubConfig *global = globalSubConfig();
|
||||||
AnalyzerSettings::fromMap(gs->toMap(), &m_customConfigurations);
|
QTC_ASSERT(global, return);
|
||||||
|
m_customConfiguration->fromMap(global->toMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::RunConfigWidget *AnalyzerRunConfigurationAspect::createConfigurationWidget()
|
ProjectExplorer::RunConfigWidget *AnalyzerRunConfigurationAspect::createConfigurationWidget()
|
||||||
{
|
{
|
||||||
AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget;
|
return new AnalyzerRunConfigWidget(this);
|
||||||
ret->setRunConfigurationAspect(this);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
@@ -62,101 +62,17 @@ class ANALYZER_EXPORT AbstractAnalyzerSubConfig : public QObject
|
|||||||
public:
|
public:
|
||||||
AbstractAnalyzerSubConfig() {}
|
AbstractAnalyzerSubConfig() {}
|
||||||
|
|
||||||
/// return a list of default values
|
|
||||||
virtual QVariantMap defaults() const = 0;
|
|
||||||
/// convert current configuration into map for storage
|
/// convert current configuration into map for storage
|
||||||
virtual QVariantMap toMap() const = 0;
|
virtual QVariantMap toMap() const = 0;
|
||||||
/// read configuration from @p map
|
/// read configuration from @p map
|
||||||
virtual void fromMap(const QVariantMap &map) = 0;
|
virtual void fromMap(const QVariantMap &map) = 0;
|
||||||
|
|
||||||
/// unique ID for this configuration
|
|
||||||
virtual Core::Id id() const = 0;
|
|
||||||
/// user readable display name for this configuration
|
|
||||||
virtual QString displayName() const = 0;
|
|
||||||
/// create a configuration widget for this configuration
|
/// create a configuration widget for this configuration
|
||||||
virtual QWidget *createConfigWidget(QWidget *parent) = 0;
|
virtual QWidget *createConfigWidget(QWidget *parent) = 0;
|
||||||
/// clones s AbstractAnalyzerSubConfig
|
/// clones s AbstractAnalyzerSubConfig
|
||||||
virtual AbstractAnalyzerSubConfig *clone() = 0;
|
virtual AbstractAnalyzerSubConfig *clone() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ANALYZER_EXPORT AnalyzerSubConfigFactory : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
AnalyzerSubConfigFactory() {}
|
|
||||||
|
|
||||||
/// Factory method to create the project tool setting
|
|
||||||
virtual AbstractAnalyzerSubConfig *createProjectSettings() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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:
|
|
||||||
template<class T>
|
|
||||||
T *subConfig() const
|
|
||||||
{
|
|
||||||
foreach (AbstractAnalyzerSubConfig *subConfig, subConfigs()) {
|
|
||||||
if (T *config = qobject_cast<T *>(subConfig))
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<AbstractAnalyzerSubConfig *> subConfigs() const
|
|
||||||
{
|
|
||||||
return m_subConfigs;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap defaults() const;
|
|
||||||
virtual QVariantMap toMap() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void fromMap(const QVariantMap &map);
|
|
||||||
|
|
||||||
QVariantMap toMap(const QList<AbstractAnalyzerSubConfig *> &subConfigs) const;
|
|
||||||
void fromMap(const QVariantMap &map, QList<AbstractAnalyzerSubConfig *> *subConfigs);
|
|
||||||
|
|
||||||
AnalyzerSettings(QObject *parent);
|
|
||||||
AnalyzerSettings(const AnalyzerSettings *other);
|
|
||||||
QList<AbstractAnalyzerSubConfig *> m_subConfigs;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// global and local settings are loaded and saved differently, and they also handle suppressions
|
|
||||||
// differently.
|
|
||||||
/**
|
|
||||||
* Global settings
|
|
||||||
*
|
|
||||||
* To access your custom configuration use:
|
|
||||||
* @code
|
|
||||||
* AnalyzerGlobalSettings::instance()->subConfig<YourGlobalConfig>()->...
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
class ANALYZER_EXPORT AnalyzerGlobalSettings : public AnalyzerSettings
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
static AnalyzerGlobalSettings *instance();
|
|
||||||
~AnalyzerGlobalSettings();
|
|
||||||
|
|
||||||
void writeSettings() const;
|
|
||||||
void readSettings();
|
|
||||||
|
|
||||||
static void registerConfig(AbstractAnalyzerSubConfig *config);
|
|
||||||
|
|
||||||
private:
|
|
||||||
AnalyzerGlobalSettings(QObject *parent);
|
|
||||||
static AnalyzerGlobalSettings *m_instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings associated with a single project/run configuration
|
* Settings associated with a single project/run configuration
|
||||||
@@ -168,18 +84,16 @@ private:
|
|||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
class ANALYZER_EXPORT AnalyzerRunConfigurationAspect
|
class ANALYZER_EXPORT AnalyzerRunConfigurationAspect
|
||||||
: public AnalyzerSettings, public ProjectExplorer::IRunConfigurationAspect
|
: public ProjectExplorer::IRunConfigurationAspect
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AnalyzerRunConfigurationAspect();
|
AnalyzerRunConfigurationAspect(AbstractAnalyzerSubConfig *customConfiguration,
|
||||||
AnalyzerRunConfigurationAspect(const AnalyzerRunConfigurationAspect *other);
|
AbstractAnalyzerSubConfig *globalConfiguration);
|
||||||
|
|
||||||
~AnalyzerRunConfigurationAspect();
|
~AnalyzerRunConfigurationAspect();
|
||||||
|
|
||||||
static void registerConfigFactory(AnalyzerSubConfigFactory *factory);
|
|
||||||
|
|
||||||
QString displayName() const;
|
|
||||||
virtual QVariantMap toMap() const;
|
virtual QVariantMap toMap() const;
|
||||||
AnalyzerRunConfigurationAspect *clone(ProjectExplorer::RunConfiguration *parent) const;
|
AnalyzerRunConfigurationAspect *clone(ProjectExplorer::RunConfiguration *parent) const;
|
||||||
|
|
||||||
@@ -187,7 +101,9 @@ public:
|
|||||||
void setUsingGlobalSettings(bool value);
|
void setUsingGlobalSettings(bool value);
|
||||||
void resetCustomToGlobalSettings();
|
void resetCustomToGlobalSettings();
|
||||||
|
|
||||||
QList<AbstractAnalyzerSubConfig *> customSubConfigs() const { return m_customConfigurations; }
|
AbstractAnalyzerSubConfig *customSubConfig() const { return m_customConfiguration; }
|
||||||
|
AbstractAnalyzerSubConfig *globalSubConfig() const { return m_globalConfiguration; }
|
||||||
|
AbstractAnalyzerSubConfig *currentConfig() const;
|
||||||
ProjectExplorer::RunConfigWidget *createConfigurationWidget();
|
ProjectExplorer::RunConfigWidget *createConfigurationWidget();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -195,7 +111,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_useGlobalSettings;
|
bool m_useGlobalSettings;
|
||||||
QList<AbstractAnalyzerSubConfig *> m_customConfigurations;
|
AbstractAnalyzerSubConfig *m_customConfiguration;
|
||||||
|
AbstractAnalyzerSubConfig *m_globalConfiguration;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
@@ -46,9 +46,7 @@ class RunConfiguration;
|
|||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
class IAnalyzerOutputPaneAdapter;
|
|
||||||
class AnalyzerRunControl;
|
class AnalyzerRunControl;
|
||||||
class AbstractAnalyzerSubConfig;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -277,11 +277,6 @@ bool DebuggerRunConfigurationAspect::isQmlDebuggingSpinboxSuppressed() const
|
|||||||
return dev->canAutoDetectPorts();
|
return dev->canAutoDetectPorts();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DebuggerRunConfigurationAspect::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Debugger settings");
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap DebuggerRunConfigurationAspect::toMap() const
|
QVariantMap DebuggerRunConfigurationAspect::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
@@ -324,6 +319,9 @@ ProjectExplorer::RunConfigWidget *DebuggerRunConfigurationAspect::createConfigur
|
|||||||
|
|
||||||
void DebuggerRunConfigurationAspect::ctor()
|
void DebuggerRunConfigurationAspect::ctor()
|
||||||
{
|
{
|
||||||
|
setId("DebuggerAspect");
|
||||||
|
setDisplayName(tr("Debugger settings"));
|
||||||
|
|
||||||
connect(this, SIGNAL(debuggersChanged()),
|
connect(this, SIGNAL(debuggersChanged()),
|
||||||
m_runConfiguration, SIGNAL(requestRunActionsUpdate()));
|
m_runConfiguration, SIGNAL(requestRunActionsUpdate()));
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,7 @@ namespace Debugger {
|
|||||||
namespace Internal { class DebuggerRunConfigWidget; }
|
namespace Internal { class DebuggerRunConfigWidget; }
|
||||||
|
|
||||||
class DEBUGGER_EXPORT DebuggerRunConfigurationAspect
|
class DEBUGGER_EXPORT DebuggerRunConfigurationAspect
|
||||||
: public QObject, public ProjectExplorer::IRunConfigurationAspect
|
: public ProjectExplorer::IRunConfigurationAspect
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -60,8 +60,6 @@ public:
|
|||||||
DebuggerRunConfigurationAspect *clone(ProjectExplorer::RunConfiguration *parent) const;
|
DebuggerRunConfigurationAspect *clone(ProjectExplorer::RunConfiguration *parent) const;
|
||||||
ProjectExplorer::RunConfigWidget *createConfigurationWidget();
|
ProjectExplorer::RunConfigWidget *createConfigurationWidget();
|
||||||
|
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
bool useCppDebugger() const;
|
bool useCppDebugger() const;
|
||||||
void setUseCppDebugger(bool value);
|
void setUseCppDebugger(bool value);
|
||||||
bool useQmlDebugger() const;
|
bool useQmlDebugger() const;
|
||||||
|
@@ -48,6 +48,8 @@ EnvironmentAspect::EnvironmentAspect(RunConfiguration *rc) :
|
|||||||
m_runConfiguration(rc)
|
m_runConfiguration(rc)
|
||||||
{
|
{
|
||||||
QTC_CHECK(m_runConfiguration);
|
QTC_CHECK(m_runConfiguration);
|
||||||
|
setDisplayName(tr("Run Environment"));
|
||||||
|
setId("EnvironmentAspect");
|
||||||
}
|
}
|
||||||
|
|
||||||
EnvironmentAspect::EnvironmentAspect(const EnvironmentAspect *other, RunConfiguration *parent) :
|
EnvironmentAspect::EnvironmentAspect(const EnvironmentAspect *other, RunConfiguration *parent) :
|
||||||
@@ -64,11 +66,6 @@ QVariantMap EnvironmentAspect::toMap() const
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString EnvironmentAspect::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Run Environment");
|
|
||||||
}
|
|
||||||
|
|
||||||
RunConfigWidget *EnvironmentAspect::createConfigurationWidget()
|
RunConfigWidget *EnvironmentAspect::createConfigurationWidget()
|
||||||
{
|
{
|
||||||
return new EnvironmentAspectWidget(this);
|
return new EnvironmentAspectWidget(this);
|
||||||
|
@@ -41,15 +41,13 @@
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT EnvironmentAspect : public QObject, public IRunConfigurationAspect
|
class PROJECTEXPLORER_EXPORT EnvironmentAspect : public IRunConfigurationAspect
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// from IRunConfigurationAspect:
|
// IRunConfigurationAspect:
|
||||||
QVariantMap toMap() const;
|
QVariantMap toMap() const;
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
RunConfigWidget *createConfigurationWidget();
|
RunConfigWidget *createConfigurationWidget();
|
||||||
|
|
||||||
virtual RunConfiguration *runConfiguration() const { return m_runConfiguration; }
|
virtual RunConfiguration *runConfiguration() const { return m_runConfiguration; }
|
||||||
|
@@ -72,19 +72,29 @@ private:
|
|||||||
inline bool operator==(const ProcessHandle &p1, const ProcessHandle &p2) { return p1.equals(p2); }
|
inline bool operator==(const ProcessHandle &p1, const ProcessHandle &p2) { return p1.equals(p2); }
|
||||||
inline bool operator!=(const ProcessHandle &p1, const ProcessHandle &p2) { return !p1.equals(p2); }
|
inline bool operator!=(const ProcessHandle &p1, const ProcessHandle &p2) { return !p1.equals(p2); }
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IRunConfigurationAspect
|
class PROJECTEXPLORER_EXPORT IRunConfigurationAspect : public QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~IRunConfigurationAspect() {}
|
virtual ~IRunConfigurationAspect() {}
|
||||||
virtual QVariantMap toMap() const = 0;
|
virtual QVariantMap toMap() const = 0;
|
||||||
virtual QString displayName() const = 0;
|
|
||||||
|
|
||||||
virtual IRunConfigurationAspect *clone(RunConfiguration *parent) const = 0;
|
virtual IRunConfigurationAspect *clone(RunConfiguration *parent) const = 0;
|
||||||
virtual RunConfigWidget *createConfigurationWidget();
|
virtual RunConfigWidget *createConfigurationWidget();
|
||||||
|
|
||||||
|
QString displayName() const { return m_displayName; }
|
||||||
|
void setDisplayName(const QString &displayName) { m_displayName = displayName; }
|
||||||
|
|
||||||
|
void setId(Core::Id id) { m_id = id; }
|
||||||
|
Core::Id id() const { return m_id; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class RunConfiguration;
|
friend class RunConfiguration;
|
||||||
virtual void fromMap(const QVariantMap &map) = 0;
|
virtual void fromMap(const QVariantMap &map) = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_displayName;
|
||||||
|
Core::Id m_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Documentation inside.
|
// Documentation inside.
|
||||||
@@ -110,17 +120,23 @@ public:
|
|||||||
QVariantMap toMap() const;
|
QVariantMap toMap() const;
|
||||||
|
|
||||||
QList<IRunConfigurationAspect *> extraAspects() const;
|
QList<IRunConfigurationAspect *> extraAspects() const;
|
||||||
|
|
||||||
template <typename T> T *extraAspect() const
|
template <typename T> T *extraAspect() const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_aspectsInitialized, return 0);
|
QTC_ASSERT(m_aspectsInitialized, return 0);
|
||||||
IRunConfigurationAspect *typeCheck = static_cast<T *>(0);
|
foreach (IRunConfigurationAspect *aspect, m_aspects)
|
||||||
Q_UNUSED(typeCheck);
|
if (T *result = qobject_cast<T *>(aspect))
|
||||||
T *result = 0;
|
return result;
|
||||||
foreach (IRunConfigurationAspect *a, m_aspects) {
|
return 0;
|
||||||
if ((result = dynamic_cast<T *>(a)) != 0)
|
}
|
||||||
break;
|
|
||||||
}
|
template <typename T> T *extraAspect(Core::Id id) const
|
||||||
return result;
|
{
|
||||||
|
QTC_ASSERT(m_aspectsInitialized, return 0);
|
||||||
|
foreach (IRunConfigurationAspect *aspect, m_aspects)
|
||||||
|
if (aspect->id() == id)
|
||||||
|
return qobject_cast<T *>(aspect);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ProjectExplorer::Abi abi() const;
|
virtual ProjectExplorer::Abi abi() const;
|
||||||
|
@@ -64,19 +64,18 @@ QStringList CallgrindRunControl::toolArguments() const
|
|||||||
{
|
{
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
|
|
||||||
ValgrindBaseSettings *callgrindSettings = m_settings->subConfig<ValgrindBaseSettings>();
|
QTC_ASSERT(m_settings, return arguments);
|
||||||
QTC_ASSERT(callgrindSettings, return arguments);
|
|
||||||
|
|
||||||
if (callgrindSettings->enableCacheSim())
|
if (m_settings->enableCacheSim())
|
||||||
arguments << QLatin1String("--cache-sim=yes");
|
arguments << QLatin1String("--cache-sim=yes");
|
||||||
|
|
||||||
if (callgrindSettings->enableBranchSim())
|
if (m_settings->enableBranchSim())
|
||||||
arguments << QLatin1String("--branch-sim=yes");
|
arguments << QLatin1String("--branch-sim=yes");
|
||||||
|
|
||||||
if (callgrindSettings->collectBusEvents())
|
if (m_settings->collectBusEvents())
|
||||||
arguments << QLatin1String("--collect-bus=yes");
|
arguments << QLatin1String("--collect-bus=yes");
|
||||||
|
|
||||||
if (callgrindSettings->collectSystime())
|
if (m_settings->collectSystime())
|
||||||
arguments << QLatin1String("--collect-systime=yes");
|
arguments << QLatin1String("--collect-systime=yes");
|
||||||
|
|
||||||
if (m_markAsPaused)
|
if (m_markAsPaused)
|
||||||
|
@@ -213,12 +213,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static ValgrindGlobalSettings *globalSettings()
|
|
||||||
{
|
|
||||||
return AnalyzerGlobalSettings::instance()->subConfig<ValgrindGlobalSettings>();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CallgrindToolPrivate::CallgrindToolPrivate(CallgrindTool *parent)
|
CallgrindToolPrivate::CallgrindToolPrivate(CallgrindTool *parent)
|
||||||
: q(parent)
|
: q(parent)
|
||||||
, m_dataModel(new DataModel(this))
|
, m_dataModel(new DataModel(this))
|
||||||
@@ -399,7 +393,7 @@ void CallgrindToolPrivate::updateCostFormat()
|
|||||||
m_calleesView->setCostFormat(format);
|
m_calleesView->setCostFormat(format);
|
||||||
m_callersView->setCostFormat(format);
|
m_callersView->setCostFormat(format);
|
||||||
}
|
}
|
||||||
if (ValgrindGlobalSettings *settings = globalSettings())
|
if (ValgrindGlobalSettings *settings = ValgrindPlugin::globalSettings())
|
||||||
settings->setCostFormat(format);
|
settings->setCostFormat(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,8 +577,9 @@ AnalyzerRunControl *CallgrindToolPrivate::createRunControl(const AnalyzerStartPa
|
|||||||
|
|
||||||
// apply project settings
|
// apply project settings
|
||||||
if (runConfiguration) {
|
if (runConfiguration) {
|
||||||
if (const AnalyzerRunConfigurationAspect *analyzerSettings = runConfiguration->extraAspect<AnalyzerRunConfigurationAspect>()) {
|
if (AnalyzerRunConfigurationAspect *analyzerAspect
|
||||||
if (const ValgrindProjectSettings *settings = analyzerSettings->subConfig<ValgrindProjectSettings>()) {
|
= runConfiguration->extraAspect<AnalyzerRunConfigurationAspect>(ANALYZER_VALGRIND_SETTINGS)) {
|
||||||
|
if (const ValgrindBaseSettings *settings = qobject_cast<ValgrindBaseSettings *>(analyzerAspect->currentConfig())) {
|
||||||
m_visualisation->setMinimumInclusiveCostRatio(settings->visualisationMinimumInclusiveCostRatio() / 100.0);
|
m_visualisation->setMinimumInclusiveCostRatio(settings->visualisationMinimumInclusiveCostRatio() / 100.0);
|
||||||
m_proxyModel->setMinimumInclusiveCostRatio(settings->minimumInclusiveCostRatio() / 100.0);
|
m_proxyModel->setMinimumInclusiveCostRatio(settings->minimumInclusiveCostRatio() / 100.0);
|
||||||
m_dataModel->setVerboseToolTipsEnabled(settings->enableEventToolTips());
|
m_dataModel->setVerboseToolTipsEnabled(settings->enableEventToolTips());
|
||||||
@@ -785,7 +780,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ValgrindGlobalSettings *settings = globalSettings();
|
ValgrindGlobalSettings *settings = ValgrindPlugin::globalSettings();
|
||||||
|
|
||||||
// cycle detection
|
// cycle detection
|
||||||
//action = new QAction(QLatin1String("Cycle Detection"), this); ///FIXME: icon
|
//action = new QAction(QLatin1String("Cycle Detection"), this); ///FIXME: icon
|
||||||
|
@@ -99,22 +99,21 @@ QStringList MemcheckRunControl::toolArguments() const
|
|||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("--gen-suppressions=all");
|
arguments << QLatin1String("--gen-suppressions=all");
|
||||||
|
|
||||||
ValgrindBaseSettings *memcheckSettings = m_settings->subConfig<ValgrindBaseSettings>();
|
QTC_ASSERT(m_settings, return arguments);
|
||||||
QTC_ASSERT(memcheckSettings, return arguments);
|
|
||||||
|
|
||||||
if (memcheckSettings->trackOrigins())
|
if (m_settings->trackOrigins())
|
||||||
arguments << QLatin1String("--track-origins=yes");
|
arguments << QLatin1String("--track-origins=yes");
|
||||||
|
|
||||||
foreach (const QString &file, memcheckSettings->suppressionFiles())
|
foreach (const QString &file, m_settings->suppressionFiles())
|
||||||
arguments << QString::fromLatin1("--suppressions=%1").arg(file);
|
arguments << QString::fromLatin1("--suppressions=%1").arg(file);
|
||||||
|
|
||||||
arguments << QString::fromLatin1("--num-callers=%1").arg(memcheckSettings->numCallers());
|
arguments << QString::fromLatin1("--num-callers=%1").arg(m_settings->numCallers());
|
||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList MemcheckRunControl::suppressionFiles() const
|
QStringList MemcheckRunControl::suppressionFiles() const
|
||||||
{
|
{
|
||||||
return m_settings->subConfig<ValgrindBaseSettings>()->suppressionFiles();
|
return m_settings->suppressionFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemcheckRunControl::status(const Status &status)
|
void MemcheckRunControl::status(const Status &status)
|
||||||
|
@@ -494,7 +494,7 @@ QString MemcheckErrorView::defaultSuppressionFile() const
|
|||||||
|
|
||||||
// slot, can (for now) be invoked either when the settings were modified *or* when the active
|
// slot, can (for now) be invoked either when the settings were modified *or* when the active
|
||||||
// settings object has changed.
|
// settings object has changed.
|
||||||
void MemcheckErrorView::settingsChanged(Analyzer::AnalyzerSettings *settings)
|
void MemcheckErrorView::settingsChanged(ValgrindBaseSettings *settings)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(settings, return);
|
QTC_ASSERT(settings, return);
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
|
@@ -33,11 +33,11 @@
|
|||||||
|
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
|
|
||||||
namespace Analyzer { class AnalyzerSettings; }
|
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class ValgrindBaseSettings;
|
||||||
|
|
||||||
class MemcheckErrorView : public QListView
|
class MemcheckErrorView : public QListView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -52,10 +52,10 @@ public:
|
|||||||
|
|
||||||
void setDefaultSuppressionFile(const QString &suppFile);
|
void setDefaultSuppressionFile(const QString &suppFile);
|
||||||
QString defaultSuppressionFile() const;
|
QString defaultSuppressionFile() const;
|
||||||
Analyzer::AnalyzerSettings *settings() const { return m_settings; }
|
ValgrindBaseSettings *settings() const { return m_settings; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void settingsChanged(Analyzer::AnalyzerSettings *settings);
|
void settingsChanged(ValgrindBaseSettings *settings);
|
||||||
void goNext();
|
void goNext();
|
||||||
void goBack();
|
void goBack();
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ private:
|
|||||||
QAction *m_copyAction;
|
QAction *m_copyAction;
|
||||||
QAction *m_suppressAction;
|
QAction *m_suppressAction;
|
||||||
QString m_defaultSuppFile;
|
QString m_defaultSuppFile;
|
||||||
Analyzer::AnalyzerSettings *m_settings;
|
ValgrindBaseSettings *m_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include <analyzerbase/analyzermanager.h>
|
#include <analyzerbase/analyzermanager.h>
|
||||||
#include <analyzerbase/analyzerconstants.h>
|
#include <analyzerbase/analyzerconstants.h>
|
||||||
|
|
||||||
|
#include <valgrind/valgrindsettings.h>
|
||||||
#include <valgrind/xmlprotocol/errorlistmodel.h>
|
#include <valgrind/xmlprotocol/errorlistmodel.h>
|
||||||
#include <valgrind/xmlprotocol/stackmodel.h>
|
#include <valgrind/xmlprotocol/stackmodel.h>
|
||||||
#include <valgrind/xmlprotocol/error.h>
|
#include <valgrind/xmlprotocol/error.h>
|
||||||
@@ -220,20 +221,21 @@ MemcheckTool::MemcheckTool(QObject *parent)
|
|||||||
void MemcheckTool::settingsDestroyed(QObject *settings)
|
void MemcheckTool::settingsDestroyed(QObject *settings)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_settings == settings, return);
|
QTC_ASSERT(m_settings == settings, return);
|
||||||
m_settings = AnalyzerGlobalSettings::instance();
|
m_settings = ValgrindPlugin::globalSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemcheckTool::maybeActiveRunConfigurationChanged()
|
void MemcheckTool::maybeActiveRunConfigurationChanged()
|
||||||
{
|
{
|
||||||
AnalyzerSettings *settings = 0;
|
ValgrindBaseSettings *settings = 0;
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||||
if (Project *project = pe->startupProject())
|
if (Project *project = pe->startupProject())
|
||||||
if (Target *target = project->activeTarget())
|
if (Target *target = project->activeTarget())
|
||||||
if (RunConfiguration *rc = target->activeRunConfiguration())
|
if (RunConfiguration *rc = target->activeRunConfiguration())
|
||||||
settings = rc->extraAspect<AnalyzerRunConfigurationAspect>();
|
if (AnalyzerRunConfigurationAspect *aspect = rc->extraAspect<AnalyzerRunConfigurationAspect>(ANALYZER_VALGRIND_SETTINGS))
|
||||||
|
settings = qobject_cast<ValgrindBaseSettings *>(aspect->customSubConfig());
|
||||||
|
|
||||||
if (!settings) // fallback to global settings
|
if (!settings) // fallback to global settings
|
||||||
settings = AnalyzerGlobalSettings::instance();
|
settings = ValgrindPlugin::globalSettings();
|
||||||
|
|
||||||
if (m_settings == settings)
|
if (m_settings == settings)
|
||||||
return;
|
return;
|
||||||
@@ -247,33 +249,29 @@ void MemcheckTool::maybeActiveRunConfigurationChanged()
|
|||||||
// now make the new settings current, update and connect input widgets
|
// now make the new settings current, update and connect input widgets
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
QTC_ASSERT(m_settings, return);
|
QTC_ASSERT(m_settings, return);
|
||||||
|
|
||||||
connect(m_settings, SIGNAL(destroyed(QObject*)), SLOT(settingsDestroyed(QObject*)));
|
connect(m_settings, SIGNAL(destroyed(QObject*)), SLOT(settingsDestroyed(QObject*)));
|
||||||
|
|
||||||
ValgrindBaseSettings *memcheckSettings = m_settings->subConfig<ValgrindBaseSettings>();
|
|
||||||
QTC_ASSERT(memcheckSettings, return);
|
|
||||||
|
|
||||||
foreach (QAction *action, m_errorFilterActions) {
|
foreach (QAction *action, m_errorFilterActions) {
|
||||||
bool contained = true;
|
bool contained = true;
|
||||||
foreach (const QVariant &v, action->data().toList()) {
|
foreach (const QVariant &v, action->data().toList()) {
|
||||||
bool ok;
|
bool ok;
|
||||||
int kind = v.toInt(&ok);
|
int kind = v.toInt(&ok);
|
||||||
if (ok && !memcheckSettings->visibleErrorKinds().contains(kind))
|
if (ok && !m_settings->visibleErrorKinds().contains(kind))
|
||||||
contained = false;
|
contained = false;
|
||||||
}
|
}
|
||||||
action->setChecked(contained);
|
action->setChecked(contained);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_filterProjectAction->setChecked(!memcheckSettings->filterExternalIssues());
|
m_filterProjectAction->setChecked(!m_settings->filterExternalIssues());
|
||||||
m_errorView->settingsChanged(m_settings);
|
m_errorView->settingsChanged(m_settings);
|
||||||
|
|
||||||
connect(memcheckSettings, SIGNAL(visibleErrorKindsChanged(QList<int>)),
|
connect(m_settings, SIGNAL(visibleErrorKindsChanged(QList<int>)),
|
||||||
m_errorProxyModel, SLOT(setAcceptedKinds(QList<int>)));
|
m_errorProxyModel, SLOT(setAcceptedKinds(QList<int>)));
|
||||||
m_errorProxyModel->setAcceptedKinds(memcheckSettings->visibleErrorKinds());
|
m_errorProxyModel->setAcceptedKinds(m_settings->visibleErrorKinds());
|
||||||
|
|
||||||
connect(memcheckSettings, SIGNAL(filterExternalIssuesChanged(bool)),
|
connect(m_settings, SIGNAL(filterExternalIssuesChanged(bool)),
|
||||||
m_errorProxyModel, SLOT(setFilterExternalIssues(bool)));
|
m_errorProxyModel, SLOT(setFilterExternalIssues(bool)));
|
||||||
m_errorProxyModel->setFilterExternalIssues(memcheckSettings->filterExternalIssues());
|
m_errorProxyModel->setFilterExternalIssues(m_settings->filterExternalIssues());
|
||||||
}
|
}
|
||||||
|
|
||||||
RunMode MemcheckTool::runMode() const
|
RunMode MemcheckTool::runMode() const
|
||||||
@@ -498,9 +496,7 @@ void MemcheckTool::updateErrorFilter()
|
|||||||
QTC_ASSERT(m_errorView, return);
|
QTC_ASSERT(m_errorView, return);
|
||||||
QTC_ASSERT(m_settings, return);
|
QTC_ASSERT(m_settings, return);
|
||||||
|
|
||||||
ValgrindBaseSettings *memcheckSettings = m_settings->subConfig<ValgrindBaseSettings>();
|
m_settings->setFilterExternalIssues(!m_filterProjectAction->isChecked());
|
||||||
QTC_ASSERT(memcheckSettings, return);
|
|
||||||
memcheckSettings->setFilterExternalIssues(!m_filterProjectAction->isChecked());
|
|
||||||
|
|
||||||
QList<int> errorKinds;
|
QList<int> errorKinds;
|
||||||
foreach (QAction *a, m_errorFilterActions) {
|
foreach (QAction *a, m_errorFilterActions) {
|
||||||
@@ -513,7 +509,7 @@ void MemcheckTool::updateErrorFilter()
|
|||||||
errorKinds << kind;
|
errorKinds << kind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memcheckSettings->setVisibleErrorKinds(errorKinds);
|
m_settings->setVisibleErrorKinds(errorKinds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemcheckTool::finished()
|
void MemcheckTool::finished()
|
||||||
|
@@ -48,15 +48,12 @@ class Error;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Analyzer {
|
|
||||||
class AnalyzerSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class MemcheckErrorView;
|
|
||||||
class FrameFinder;
|
class FrameFinder;
|
||||||
|
class MemcheckErrorView;
|
||||||
|
class ValgrindBaseSettings;
|
||||||
|
|
||||||
class MemcheckErrorFilterProxyModel : public QSortFilterProxyModel
|
class MemcheckErrorFilterProxyModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
@@ -109,7 +106,7 @@ private:
|
|||||||
void clearErrorView();
|
void clearErrorView();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Analyzer::AnalyzerSettings *m_settings;
|
ValgrindBaseSettings *m_settings;
|
||||||
QMenu *m_filterMenu;
|
QMenu *m_filterMenu;
|
||||||
|
|
||||||
FrameFinder *m_frameFinder;
|
FrameFinder *m_frameFinder;
|
||||||
|
@@ -222,7 +222,7 @@ void SuppressionDialog::accept()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_settings->subConfig<ValgrindBaseSettings>()->addSuppressionFiles(QStringList(path));
|
m_settings->addSuppressionFiles(QStringList(path));
|
||||||
|
|
||||||
QModelIndexList indices = m_view->selectionModel()->selectedRows();
|
QModelIndexList indices = m_view->selectionModel()->selectedRows();
|
||||||
qSort(indices.begin(), indices.end(), sortIndizesReverse);
|
qSort(indices.begin(), indices.end(), sortIndizesReverse);
|
||||||
|
@@ -42,12 +42,11 @@ class QPlainTextEdit;
|
|||||||
class QDialogButtonBox;
|
class QDialogButtonBox;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Analyzer { class AnalyzerSettings; }
|
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class MemcheckErrorView;
|
class MemcheckErrorView;
|
||||||
|
class ValgrindBaseSettings;
|
||||||
|
|
||||||
class SuppressionDialog : public QDialog
|
class SuppressionDialog : public QDialog
|
||||||
{
|
{
|
||||||
@@ -66,7 +65,7 @@ private:
|
|||||||
void reject();
|
void reject();
|
||||||
|
|
||||||
MemcheckErrorView *m_view;
|
MemcheckErrorView *m_view;
|
||||||
Analyzer::AnalyzerSettings *m_settings;
|
ValgrindBaseSettings *m_settings;
|
||||||
bool m_cleanupIfCanceled;
|
bool m_cleanupIfCanceled;
|
||||||
QList<XmlProtocol::Error> m_errors;
|
QList<XmlProtocol::Error> m_errors;
|
||||||
|
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "valgrindconfigwidget.h"
|
#include "valgrindconfigwidget.h"
|
||||||
#include "valgrindsettings.h"
|
#include "valgrindsettings.h"
|
||||||
|
#include "valgrindplugin.h"
|
||||||
|
|
||||||
#include "ui_valgrindconfigwidget.h"
|
#include "ui_valgrindconfigwidget.h"
|
||||||
|
|
||||||
@@ -173,7 +174,7 @@ void ValgrindConfigWidget::updateUi()
|
|||||||
|
|
||||||
void ValgrindConfigWidget::slotAddSuppression()
|
void ValgrindConfigWidget::slotAddSuppression()
|
||||||
{
|
{
|
||||||
ValgrindGlobalSettings *conf = Analyzer::AnalyzerGlobalSettings::instance()->subConfig<ValgrindGlobalSettings>();
|
ValgrindGlobalSettings *conf = ValgrindPlugin::globalSettings();
|
||||||
QTC_ASSERT(conf, return);
|
QTC_ASSERT(conf, return);
|
||||||
QStringList files = QFileDialog::getOpenFileNames(this,
|
QStringList files = QFileDialog::getOpenFileNames(this,
|
||||||
tr("Valgrind Suppression Files"),
|
tr("Valgrind Suppression Files"),
|
||||||
|
@@ -30,13 +30,14 @@
|
|||||||
|
|
||||||
#include "valgrindengine.h"
|
#include "valgrindengine.h"
|
||||||
#include "valgrindsettings.h"
|
#include "valgrindsettings.h"
|
||||||
|
#include "valgrindplugin.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/ioutputpane.h>
|
#include <coreplugin/ioutputpane.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
#include <coreplugin/progressmanager/futureprogress.h>
|
#include <coreplugin/progressmanager/futureprogress.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <projectexplorer/localapplicationrunconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <analyzerbase/analyzermanager.h>
|
#include <analyzerbase/analyzermanager.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -47,6 +48,7 @@
|
|||||||
using namespace Analyzer;
|
using namespace Analyzer;
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -62,10 +64,11 @@ ValgrindRunControl::ValgrindRunControl(const AnalyzerStartParameters &sp,
|
|||||||
m_isStopping(false)
|
m_isStopping(false)
|
||||||
{
|
{
|
||||||
if (runConfiguration)
|
if (runConfiguration)
|
||||||
m_settings = runConfiguration->extraAspect<AnalyzerRunConfigurationAspect>();
|
if (AnalyzerRunConfigurationAspect *aspect = runConfiguration->extraAspect<AnalyzerRunConfigurationAspect>(ANALYZER_VALGRIND_SETTINGS))
|
||||||
|
m_settings = qobject_cast<ValgrindBaseSettings *>(aspect->customSubConfig());
|
||||||
|
|
||||||
if (!m_settings)
|
if (!m_settings)
|
||||||
m_settings = AnalyzerGlobalSettings::instance();
|
m_settings = ValgrindPlugin::globalSettings();
|
||||||
|
|
||||||
connect(m_progressWatcher, SIGNAL(canceled()),
|
connect(m_progressWatcher, SIGNAL(canceled()),
|
||||||
this, SLOT(handleProgressCanceled()));
|
this, SLOT(handleProgressCanceled()));
|
||||||
@@ -99,7 +102,7 @@ bool ValgrindRunControl::startEngine()
|
|||||||
|
|
||||||
ValgrindRunner *run = runner();
|
ValgrindRunner *run = runner();
|
||||||
run->setWorkingDirectory(sp.workingDirectory);
|
run->setWorkingDirectory(sp.workingDirectory);
|
||||||
QString valgrindExe = m_settings->subConfig<ValgrindBaseSettings>()->valgrindExecutable();
|
QString valgrindExe = m_settings->valgrindExecutable();
|
||||||
if (!sp.analyzerCmdPrefix.isEmpty())
|
if (!sp.analyzerCmdPrefix.isEmpty())
|
||||||
valgrindExe = sp.analyzerCmdPrefix + QLatin1Char(' ') + valgrindExe;
|
valgrindExe = sp.analyzerCmdPrefix + QLatin1Char(' ') + valgrindExe;
|
||||||
run->setValgrindExecutable(valgrindExe);
|
run->setValgrindExecutable(valgrindExe);
|
||||||
@@ -173,7 +176,7 @@ void ValgrindRunControl::receiveProcessOutput(const QByteArray &output, OutputFo
|
|||||||
void ValgrindRunControl::receiveProcessError(const QString &message, QProcess::ProcessError error)
|
void ValgrindRunControl::receiveProcessError(const QString &message, QProcess::ProcessError error)
|
||||||
{
|
{
|
||||||
if (error == QProcess::FailedToStart) {
|
if (error == QProcess::FailedToStart) {
|
||||||
const QString &valgrind = m_settings->subConfig<ValgrindBaseSettings>()->valgrindExecutable();
|
const QString valgrind = m_settings->valgrindExecutable();
|
||||||
if (!valgrind.isEmpty())
|
if (!valgrind.isEmpty())
|
||||||
appendMessage(tr("** Error: \"%1\" could not be started: %2 **\n").arg(valgrind).arg(message), ErrorMessageFormat);
|
appendMessage(tr("** Error: \"%1\" could not be started: %2 **\n").arg(valgrind).arg(message), ErrorMessageFormat);
|
||||||
else
|
else
|
||||||
|
@@ -34,12 +34,11 @@
|
|||||||
#include <analyzerbase/analyzerruncontrol.h>
|
#include <analyzerbase/analyzerruncontrol.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <valgrind/valgrindrunner.h>
|
#include <valgrind/valgrindrunner.h>
|
||||||
|
#include <valgrind/valgrindsettings.h>
|
||||||
|
|
||||||
#include <QFutureInterface>
|
#include <QFutureInterface>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
|
|
||||||
namespace Analyzer { class AnalyzerSettings; }
|
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -62,7 +61,7 @@ protected:
|
|||||||
virtual QStringList toolArguments() const = 0;
|
virtual QStringList toolArguments() const = 0;
|
||||||
virtual Valgrind::ValgrindRunner *runner() = 0;
|
virtual Valgrind::ValgrindRunner *runner() = 0;
|
||||||
|
|
||||||
Analyzer::AnalyzerSettings *m_settings;
|
ValgrindBaseSettings *m_settings;
|
||||||
QFutureInterface<void> *m_progress;
|
QFutureInterface<void> *m_progress;
|
||||||
QFutureWatcher<void> *m_progressWatcher;
|
QFutureWatcher<void> *m_progressWatcher;
|
||||||
|
|
||||||
|
@@ -37,23 +37,42 @@
|
|||||||
#include <analyzerbase/analyzermanager.h>
|
#include <analyzerbase/analyzermanager.h>
|
||||||
#include <analyzerbase/analyzersettings.h>
|
#include <analyzerbase/analyzersettings.h>
|
||||||
|
|
||||||
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <valgrind/valgrindsettings.h>
|
#include <valgrind/valgrindsettings.h>
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
using namespace Analyzer;
|
using namespace Analyzer;
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ProjectSettingsFactory : public AnalyzerSubConfigFactory
|
static ValgrindGlobalSettings *theGlobalSettings = 0;
|
||||||
|
|
||||||
|
class ValgrindOptionsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
AbstractAnalyzerSubConfig *createProjectSettings()
|
public:
|
||||||
|
explicit ValgrindOptionsPage()
|
||||||
{
|
{
|
||||||
return new ValgrindProjectSettings();
|
setId(ANALYZER_VALGRIND_SETTINGS);
|
||||||
|
setDisplayName(tr("Valgrind"));
|
||||||
|
setCategory("T.Analyzer");
|
||||||
|
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
|
||||||
|
setCategoryIcon(QLatin1String(":/images/analyzer_category.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget *createPage(QWidget *parent) {
|
||||||
|
return theGlobalSettings->createConfigWidget(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void apply() {
|
||||||
|
theGlobalSettings->writeSettings();
|
||||||
|
}
|
||||||
|
void finish() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ValgrindAction : public AnalyzerAction
|
class ValgrindAction : public AnalyzerAction
|
||||||
@@ -62,10 +81,19 @@ public:
|
|||||||
ValgrindAction() {}
|
ValgrindAction() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ValgrindPlugin::~ValgrindPlugin()
|
||||||
|
{
|
||||||
|
delete theGlobalSettings;
|
||||||
|
theGlobalSettings = 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||||
{
|
{
|
||||||
AnalyzerGlobalSettings::registerConfig(new ValgrindGlobalSettings());
|
theGlobalSettings = new ValgrindGlobalSettings();
|
||||||
AnalyzerRunConfigurationAspect::registerConfigFactory(new ProjectSettingsFactory());
|
theGlobalSettings->readSettings();
|
||||||
|
|
||||||
|
addAutoReleasedObject(new ValgrindOptionsPage());
|
||||||
|
|
||||||
IAnalyzerTool *memcheckTool = new MemcheckTool(this);
|
IAnalyzerTool *memcheckTool = new MemcheckTool(this);
|
||||||
IAnalyzerTool *callgrindTool = new CallgrindTool(this);
|
IAnalyzerTool *callgrindTool = new CallgrindTool(this);
|
||||||
@@ -122,6 +150,11 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ValgrindGlobalSettings *ValgrindPlugin::globalSettings()
|
||||||
|
{
|
||||||
|
return theGlobalSettings;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Valgrind
|
} // namespace Valgrind
|
||||||
|
|
||||||
|
@@ -37,6 +37,8 @@
|
|||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class ValgrindGlobalSettings;
|
||||||
|
|
||||||
class ValgrindPlugin : public ExtensionSystem::IPlugin
|
class ValgrindPlugin : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -44,9 +46,12 @@ class ValgrindPlugin : public ExtensionSystem::IPlugin
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ValgrindPlugin() {}
|
ValgrindPlugin() {}
|
||||||
|
~ValgrindPlugin();
|
||||||
|
|
||||||
virtual bool initialize(const QStringList &arguments, QString *errorString);
|
bool initialize(const QStringList &arguments, QString *errorString);
|
||||||
virtual void extensionsInitialized() {}
|
void extensionsInitialized() {}
|
||||||
|
|
||||||
|
static ValgrindGlobalSettings *globalSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -28,6 +28,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "valgrindruncontrolfactory.h"
|
#include "valgrindruncontrolfactory.h"
|
||||||
|
#include "valgrindsettings.h"
|
||||||
|
#include "valgrindplugin.h"
|
||||||
|
|
||||||
#include <analyzerbase/ianalyzertool.h>
|
#include <analyzerbase/ianalyzertool.h>
|
||||||
#include <analyzerbase/analyzermanager.h>
|
#include <analyzerbase/analyzermanager.h>
|
||||||
@@ -109,7 +111,11 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
|
|||||||
IRunConfigurationAspect *ValgrindRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc)
|
IRunConfigurationAspect *ValgrindRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc)
|
||||||
{
|
{
|
||||||
Q_UNUSED(rc);
|
Q_UNUSED(rc);
|
||||||
return new AnalyzerRunConfigurationAspect;
|
IRunConfigurationAspect *aspect
|
||||||
|
= new AnalyzerRunConfigurationAspect(new ValgrindProjectSettings(), ValgrindPlugin::globalSettings());
|
||||||
|
aspect->setId(ANALYZER_VALGRIND_SETTINGS);
|
||||||
|
aspect->setDisplayName(tr("Valgrind Settings"));
|
||||||
|
return aspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "valgrindsettings.h"
|
#include "valgrindsettings.h"
|
||||||
|
#include "valgrindplugin.h"
|
||||||
#include "valgrindconfigwidget.h"
|
#include "valgrindconfigwidget.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -75,34 +76,6 @@ namespace Internal {
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
QVariantMap ValgrindBaseSettings::defaults() const
|
|
||||||
{
|
|
||||||
QVariantMap map;
|
|
||||||
|
|
||||||
// General
|
|
||||||
map.insert(QLatin1String(valgrindExeC), QLatin1String("valgrind"));
|
|
||||||
|
|
||||||
// Memcheck
|
|
||||||
map.insert(QLatin1String(numCallersC), 25);
|
|
||||||
map.insert(QLatin1String(trackOriginsC), true);
|
|
||||||
map.insert(QLatin1String(filterExternalIssuesC), true);
|
|
||||||
QVariantList defaultErrorKinds;
|
|
||||||
for (int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
|
|
||||||
defaultErrorKinds << i;
|
|
||||||
map.insert(QLatin1String(visibleErrorKindsC), defaultErrorKinds);
|
|
||||||
|
|
||||||
// Callgrind
|
|
||||||
map.insert(QLatin1String(callgrindEnableCacheSimC), false);
|
|
||||||
map.insert(QLatin1String(callgrindEnableBranchSimC), false);
|
|
||||||
map.insert(QLatin1String(callgrindCollectSystimeC), false);
|
|
||||||
map.insert(QLatin1String(callgrindCollectBusEventsC), false);
|
|
||||||
map.insert(QLatin1String(callgrindEnableEventToolTipsC), true);
|
|
||||||
map.insert(QLatin1String(callgrindMinimumCostRatioC), 0.01);
|
|
||||||
map.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC), 10.0);
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ValgrindBaseSettings::fromMap(const QVariantMap &map)
|
void ValgrindBaseSettings::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
// General
|
// General
|
||||||
@@ -172,11 +145,6 @@ QString ValgrindBaseSettings::valgrindExecutable() const
|
|||||||
return m_valgrindExecutable;
|
return m_valgrindExecutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id ValgrindBaseSettings::id() const
|
|
||||||
{
|
|
||||||
return "Analyzer.Valgrind.Settings";
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ValgrindBaseSettings::displayName() const
|
QString ValgrindBaseSettings::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Valgrind");
|
return tr("Valgrind");
|
||||||
@@ -286,27 +254,16 @@ void ValgrindBaseSettings::setVisualisationMinimumInclusiveCostRatio(
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
ValgrindGlobalSettings::ValgrindGlobalSettings()
|
||||||
|
{
|
||||||
|
readSettings();
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *ValgrindGlobalSettings::createConfigWidget(QWidget *parent)
|
QWidget *ValgrindGlobalSettings::createConfigWidget(QWidget *parent)
|
||||||
{
|
{
|
||||||
return new ValgrindConfigWidget(this, parent, true);
|
return new ValgrindConfigWidget(this, parent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap ValgrindGlobalSettings::defaults() const
|
|
||||||
{
|
|
||||||
QVariantMap map = ValgrindBaseSettings::defaults();
|
|
||||||
|
|
||||||
// Memcheck
|
|
||||||
map.insert(QLatin1String(suppressionFilesC), QStringList());
|
|
||||||
map.insert(QLatin1String(lastSuppressionDirectoryC), QString());
|
|
||||||
map.insert(QLatin1String(lastSuppressionHistoryC), QStringList());
|
|
||||||
|
|
||||||
// Callgrind
|
|
||||||
map.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
|
|
||||||
map.insert(QLatin1String(callgrindCycleDetectionC), true);
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ValgrindGlobalSettings::fromMap(const QVariantMap &map)
|
void ValgrindGlobalSettings::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
ValgrindBaseSettings::fromMap(map);
|
ValgrindBaseSettings::fromMap(map);
|
||||||
@@ -390,6 +347,61 @@ void ValgrindGlobalSettings::setLastSuppressionDialogHistory(const QStringList &
|
|||||||
m_lastSuppressionHistory = history;
|
m_lastSuppressionHistory = history;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char groupC[] = "Analyzer";
|
||||||
|
|
||||||
|
void ValgrindGlobalSettings::readSettings()
|
||||||
|
{
|
||||||
|
QVariantMap defaults;
|
||||||
|
|
||||||
|
// General
|
||||||
|
defaults.insert(QLatin1String(valgrindExeC), QLatin1String("valgrind"));
|
||||||
|
|
||||||
|
// Memcheck
|
||||||
|
defaults.insert(QLatin1String(numCallersC), 25);
|
||||||
|
defaults.insert(QLatin1String(trackOriginsC), true);
|
||||||
|
defaults.insert(QLatin1String(filterExternalIssuesC), true);
|
||||||
|
QVariantList defaultErrorKinds;
|
||||||
|
for (int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
|
||||||
|
defaultErrorKinds << i;
|
||||||
|
defaults.insert(QLatin1String(visibleErrorKindsC), defaultErrorKinds);
|
||||||
|
|
||||||
|
defaults.insert(QLatin1String(suppressionFilesC), QStringList());
|
||||||
|
defaults.insert(QLatin1String(lastSuppressionDirectoryC), QString());
|
||||||
|
defaults.insert(QLatin1String(lastSuppressionHistoryC), QStringList());
|
||||||
|
|
||||||
|
// Callgrind
|
||||||
|
defaults.insert(QLatin1String(callgrindEnableCacheSimC), false);
|
||||||
|
defaults.insert(QLatin1String(callgrindEnableBranchSimC), false);
|
||||||
|
defaults.insert(QLatin1String(callgrindCollectSystimeC), false);
|
||||||
|
defaults.insert(QLatin1String(callgrindCollectBusEventsC), false);
|
||||||
|
defaults.insert(QLatin1String(callgrindEnableEventToolTipsC), true);
|
||||||
|
defaults.insert(QLatin1String(callgrindMinimumCostRatioC), 0.01);
|
||||||
|
defaults.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC), 10.0);
|
||||||
|
|
||||||
|
defaults.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
|
||||||
|
defaults.insert(QLatin1String(callgrindCycleDetectionC), true);
|
||||||
|
|
||||||
|
// Read stored values
|
||||||
|
QSettings *settings = Core::ICore::settings();
|
||||||
|
settings->beginGroup(QLatin1String(groupC));
|
||||||
|
QVariantMap map = defaults;
|
||||||
|
for (QVariantMap::ConstIterator it = defaults.constBegin(); it != defaults.constEnd(); ++it)
|
||||||
|
map.insert(it.key(), settings->value(it.key(), it.value()));
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
fromMap(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ValgrindGlobalSettings::writeSettings() const
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::settings();
|
||||||
|
settings->beginGroup(QLatin1String(groupC));
|
||||||
|
const QVariantMap map = toMap();
|
||||||
|
for (QVariantMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||||
|
settings->setValue(it.key(), it.value());
|
||||||
|
settings->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Callgrind
|
// Callgrind
|
||||||
//
|
//
|
||||||
@@ -401,7 +413,7 @@ CostDelegate::CostFormat ValgrindGlobalSettings::costFormat() const
|
|||||||
void ValgrindGlobalSettings::setCostFormat(CostDelegate::CostFormat format)
|
void ValgrindGlobalSettings::setCostFormat(CostDelegate::CostFormat format)
|
||||||
{
|
{
|
||||||
m_costFormat = format;
|
m_costFormat = format;
|
||||||
AnalyzerGlobalSettings::instance()->writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValgrindGlobalSettings::detectCycles() const
|
bool ValgrindGlobalSettings::detectCycles() const
|
||||||
@@ -412,7 +424,7 @@ bool ValgrindGlobalSettings::detectCycles() const
|
|||||||
void ValgrindGlobalSettings::setDetectCycles(bool on)
|
void ValgrindGlobalSettings::setDetectCycles(bool on)
|
||||||
{
|
{
|
||||||
m_detectCycles = on;
|
m_detectCycles = on;
|
||||||
AnalyzerGlobalSettings::instance()->writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValgrindGlobalSettings::shortenTemplates() const
|
bool ValgrindGlobalSettings::shortenTemplates() const
|
||||||
@@ -423,15 +435,9 @@ bool ValgrindGlobalSettings::shortenTemplates() const
|
|||||||
void ValgrindGlobalSettings::setShortenTemplates(bool on)
|
void ValgrindGlobalSettings::setShortenTemplates(bool on)
|
||||||
{
|
{
|
||||||
m_shortenTemplates = on;
|
m_shortenTemplates = on;
|
||||||
AnalyzerGlobalSettings::instance()->writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
ValgrindGlobalSettings *globalValgrindSettings()
|
|
||||||
{
|
|
||||||
ValgrindGlobalSettings *ret = AnalyzerGlobalSettings::instance()->subConfig<ValgrindGlobalSettings>();
|
|
||||||
QTC_ASSERT(ret, return 0);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -444,17 +450,6 @@ QWidget *ValgrindProjectSettings::createConfigWidget(QWidget *parent)
|
|||||||
return new ValgrindConfigWidget(this, parent, false);
|
return new ValgrindConfigWidget(this, parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap ValgrindProjectSettings::defaults() const
|
|
||||||
{
|
|
||||||
QVariantMap map = ValgrindBaseSettings::defaults();
|
|
||||||
|
|
||||||
// Memcheck
|
|
||||||
map.insert(QLatin1String(addedSuppressionFilesC), QStringList());
|
|
||||||
map.insert(QLatin1String(removedSuppressionFilesC), QStringList());
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ValgrindProjectSettings::fromMap(const QVariantMap &map)
|
void ValgrindProjectSettings::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
ValgrindBaseSettings::fromMap(map);
|
ValgrindBaseSettings::fromMap(map);
|
||||||
@@ -488,7 +483,7 @@ QVariantMap ValgrindProjectSettings::toMap() const
|
|||||||
|
|
||||||
void ValgrindProjectSettings::addSuppressionFiles(const QStringList &suppressions)
|
void ValgrindProjectSettings::addSuppressionFiles(const QStringList &suppressions)
|
||||||
{
|
{
|
||||||
QStringList globalSuppressions = globalValgrindSettings()->suppressionFiles();
|
QStringList globalSuppressions = ValgrindPlugin::globalSettings()->suppressionFiles();
|
||||||
foreach (const QString &s, suppressions) {
|
foreach (const QString &s, suppressions) {
|
||||||
if (m_addedSuppressionFiles.contains(s))
|
if (m_addedSuppressionFiles.contains(s))
|
||||||
continue;
|
continue;
|
||||||
@@ -500,7 +495,7 @@ void ValgrindProjectSettings::addSuppressionFiles(const QStringList &suppression
|
|||||||
|
|
||||||
void ValgrindProjectSettings::removeSuppressionFiles(const QStringList &suppressions)
|
void ValgrindProjectSettings::removeSuppressionFiles(const QStringList &suppressions)
|
||||||
{
|
{
|
||||||
QStringList globalSuppressions = globalValgrindSettings()->suppressionFiles();
|
QStringList globalSuppressions = ValgrindPlugin::globalSettings()->suppressionFiles();
|
||||||
foreach (const QString &s, suppressions) {
|
foreach (const QString &s, suppressions) {
|
||||||
m_addedSuppressionFiles.removeAll(s);
|
m_addedSuppressionFiles.removeAll(s);
|
||||||
if (globalSuppressions.contains(s))
|
if (globalSuppressions.contains(s))
|
||||||
@@ -510,7 +505,7 @@ void ValgrindProjectSettings::removeSuppressionFiles(const QStringList &suppress
|
|||||||
|
|
||||||
QStringList ValgrindProjectSettings::suppressionFiles() const
|
QStringList ValgrindProjectSettings::suppressionFiles() const
|
||||||
{
|
{
|
||||||
QStringList ret = globalValgrindSettings()->suppressionFiles();
|
QStringList ret = ValgrindPlugin::globalSettings()->suppressionFiles();
|
||||||
foreach (const QString &s, m_disabledGlobalSuppressionFiles)
|
foreach (const QString &s, m_disabledGlobalSuppressionFiles)
|
||||||
ret.removeAll(s);
|
ret.removeAll(s);
|
||||||
ret.append(m_addedSuppressionFiles);
|
ret.append(m_addedSuppressionFiles);
|
||||||
|
@@ -41,6 +41,8 @@
|
|||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
const char ANALYZER_VALGRIND_SETTINGS[] = "Analyzer.Valgrind.Settings";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Valgrind settings shared for global and per-project.
|
* Valgrind settings shared for global and per-project.
|
||||||
*/
|
*/
|
||||||
@@ -52,10 +54,7 @@ public:
|
|||||||
ValgrindBaseSettings() {}
|
ValgrindBaseSettings() {}
|
||||||
|
|
||||||
virtual QVariantMap toMap() const;
|
virtual QVariantMap toMap() const;
|
||||||
virtual QVariantMap defaults() const;
|
|
||||||
virtual void fromMap(const QVariantMap &map);
|
virtual void fromMap(const QVariantMap &map);
|
||||||
|
|
||||||
virtual Core::Id id() const;
|
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -167,11 +166,10 @@ class ValgrindGlobalSettings : public ValgrindBaseSettings
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ValgrindGlobalSettings() {}
|
ValgrindGlobalSettings();
|
||||||
|
|
||||||
QWidget *createConfigWidget(QWidget *parent);
|
QWidget *createConfigWidget(QWidget *parent);
|
||||||
QVariantMap toMap() const;
|
QVariantMap toMap() const;
|
||||||
QVariantMap defaults() const;
|
|
||||||
void fromMap(const QVariantMap &map);
|
void fromMap(const QVariantMap &map);
|
||||||
virtual AbstractAnalyzerSubConfig *clone();
|
virtual AbstractAnalyzerSubConfig *clone();
|
||||||
|
|
||||||
@@ -191,6 +189,9 @@ public:
|
|||||||
void setLastSuppressionDialogHistory(const QStringList &history);
|
void setLastSuppressionDialogHistory(const QStringList &history);
|
||||||
QStringList lastSuppressionDialogHistory() const;
|
QStringList lastSuppressionDialogHistory() const;
|
||||||
|
|
||||||
|
void writeSettings() const;
|
||||||
|
void readSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList m_suppressionFiles;
|
QStringList m_suppressionFiles;
|
||||||
QString m_lastSuppressionDirectory;
|
QString m_lastSuppressionDirectory;
|
||||||
@@ -229,7 +230,6 @@ public:
|
|||||||
|
|
||||||
QWidget *createConfigWidget(QWidget *parent);
|
QWidget *createConfigWidget(QWidget *parent);
|
||||||
QVariantMap toMap() const;
|
QVariantMap toMap() const;
|
||||||
QVariantMap defaults() const;
|
|
||||||
void fromMap(const QVariantMap &map);
|
void fromMap(const QVariantMap &map);
|
||||||
virtual AbstractAnalyzerSubConfig *clone();
|
virtual AbstractAnalyzerSubConfig *clone();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user