forked from qt-creator/qt-creator
Make sensible use of global analyzer settings
Project settings now have the option to use the global settings (on by default), or custom ones. Task-number: QTCREATORBUG-5445 Change-Id: I6602b53a6e7823150773e8461ef9db39b7546e98 Reviewed-on: http://codereview.qt.nokia.com/2163 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -34,13 +34,12 @@
|
|||||||
|
|
||||||
#include "analyzerrunconfigwidget.h"
|
#include "analyzerrunconfigwidget.h"
|
||||||
|
|
||||||
#include "analyzersettings.h"
|
|
||||||
|
|
||||||
#include <utils/detailswidget.h>
|
#include <utils/detailswidget.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtGui/QGroupBox>
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
@@ -52,6 +51,29 @@ AnalyzerRunConfigWidget::AnalyzerRunConfigWidget()
|
|||||||
new QVBoxLayout(mainWidget);
|
new QVBoxLayout(mainWidget);
|
||||||
m_detailsWidget->setWidget(mainWidget);
|
m_detailsWidget->setWidget(mainWidget);
|
||||||
|
|
||||||
|
QWidget *globalSetting = new QWidget(mainWidget);
|
||||||
|
QHBoxLayout *globalSettingLayout = new QHBoxLayout(globalSetting);
|
||||||
|
mainWidget->layout()->addWidget(globalSetting);
|
||||||
|
QLabel *label = new QLabel(displayName(), globalSetting);
|
||||||
|
globalSettingLayout->addWidget(label);
|
||||||
|
m_settingsCombo = new QComboBox(globalSetting);
|
||||||
|
m_settingsCombo->addItems(QStringList()
|
||||||
|
<< QApplication::translate("ProjectExplorer::Internal::EditorSettingsPropertiesPage", "Global")
|
||||||
|
<< QApplication::translate("ProjectExplorer::Internal::EditorSettingsPropertiesPage", "Custom")
|
||||||
|
);
|
||||||
|
globalSettingLayout->addWidget(m_settingsCombo);
|
||||||
|
connect(m_settingsCombo, SIGNAL(activated(int)), this, SLOT(chooseSettings(int)));
|
||||||
|
m_restoreButton = new QPushButton(
|
||||||
|
QApplication::translate("ProjectExplorer::Internal::EditorSettingsPropertiesPage", "Restore Global"),
|
||||||
|
globalSetting);
|
||||||
|
globalSettingLayout->addWidget(m_restoreButton);
|
||||||
|
connect(m_restoreButton, SIGNAL(clicked()), this, SLOT(restoreGlobal()));
|
||||||
|
globalSettingLayout->addStretch(2);
|
||||||
|
|
||||||
|
m_subConfigWidget = new QWidget(mainWidget);
|
||||||
|
mainWidget->layout()->addWidget(m_subConfigWidget);
|
||||||
|
new QVBoxLayout(m_subConfigWidget);
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->addWidget(m_detailsWidget);
|
layout->addWidget(m_detailsWidget);
|
||||||
@@ -66,23 +88,39 @@ void AnalyzerRunConfigWidget::setRunConfiguration(ProjectExplorer::RunConfigurat
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(rc, return);
|
QTC_ASSERT(rc, return);
|
||||||
|
|
||||||
AnalyzerProjectSettings *settings = rc->extraAspect<AnalyzerProjectSettings>();
|
m_settings = rc->extraAspect<AnalyzerProjectSettings>();
|
||||||
QTC_ASSERT(settings, return);
|
QTC_ASSERT(m_settings, return);
|
||||||
|
|
||||||
// update summary text
|
// update summary text
|
||||||
QStringList tools;
|
QStringList tools;
|
||||||
foreach (AbstractAnalyzerSubConfig *config, settings->subConfigs()) {
|
foreach (AbstractAnalyzerSubConfig *config, m_settings->subConfigs()) {
|
||||||
tools << QString("<strong>%1</strong>").arg(config->displayName());
|
tools << QString("<strong>%1</strong>").arg(config->displayName());
|
||||||
}
|
}
|
||||||
m_detailsWidget->setSummaryText(tr("Available settings: %1").arg(tools.join(", ")));
|
m_detailsWidget->setSummaryText(tr("Available settings: %1").arg(tools.join(", ")));
|
||||||
|
|
||||||
// add group boxes for each sub config
|
// add group boxes for each sub config
|
||||||
QLayout *layout = m_detailsWidget->widget()->layout();
|
QLayout *layout = m_subConfigWidget->layout();
|
||||||
foreach (AbstractAnalyzerSubConfig *config, settings->subConfigs()) {
|
foreach (AbstractAnalyzerSubConfig *config, m_settings->customSubConfigs()) {
|
||||||
(void) new QGroupBox(config->displayName());
|
|
||||||
QWidget *widget = config->createConfigWidget(this);
|
QWidget *widget = config->createConfigWidget(this);
|
||||||
layout->addWidget(widget);
|
layout->addWidget(widget);
|
||||||
}
|
}
|
||||||
|
m_subConfigWidget->setEnabled(!m_settings->isUsingGlobalSettings());
|
||||||
|
m_settingsCombo->setCurrentIndex(m_settings->isUsingGlobalSettings() ? 0 : 1);
|
||||||
|
m_restoreButton->setEnabled(!m_settings->isUsingGlobalSettings());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnalyzerRunConfigWidget::chooseSettings(int setting)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_settings, return);
|
||||||
|
m_settings->setUsingGlobalSettings(setting == 0);
|
||||||
|
m_subConfigWidget->setEnabled(!m_settings->isUsingGlobalSettings());
|
||||||
|
m_restoreButton->setEnabled(!m_settings->isUsingGlobalSettings());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnalyzerRunConfigWidget::restoreGlobal()
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_settings, return);
|
||||||
|
m_settings->resetCustomToGlobalSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
|||||||
@@ -35,8 +35,13 @@
|
|||||||
#ifndef ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
|
#ifndef ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
|
||||||
#define ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
|
#define ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
|
||||||
|
|
||||||
|
#include "analyzerbase_global.h"
|
||||||
|
#include "analyzersettings.h"
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <analyzerbase/analyzerbase_global.h>
|
|
||||||
|
#include <QtGui/QComboBox>
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
class DetailsWidget;
|
class DetailsWidget;
|
||||||
@@ -57,8 +62,16 @@ public:
|
|||||||
|
|
||||||
void setRunConfiguration(ProjectExplorer::RunConfiguration *rc);
|
void setRunConfiguration(ProjectExplorer::RunConfiguration *rc);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void chooseSettings(int setting);
|
||||||
|
void restoreGlobal();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Utils::DetailsWidget *m_detailsWidget;
|
Utils::DetailsWidget *m_detailsWidget;
|
||||||
|
QWidget *m_subConfigWidget;
|
||||||
|
AnalyzerProjectSettings *m_settings;
|
||||||
|
QComboBox *m_settingsCombo;
|
||||||
|
QPushButton *m_restoreButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
using namespace Analyzer::Internal;
|
using namespace Analyzer::Internal;
|
||||||
|
|
||||||
static const char groupC[] = "Analyzer";
|
static const char groupC[] = "Analyzer";
|
||||||
|
static const char useGlobalC[] = "Analyzer.Project.UseGlobal";
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
@@ -57,15 +58,6 @@ AnalyzerSettings::AnalyzerSettings(QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AnalyzerSettings::fromMap(const QVariantMap &map)
|
|
||||||
{
|
|
||||||
bool ret = true;
|
|
||||||
foreach (AbstractAnalyzerSubConfig *config, subConfigs()) {
|
|
||||||
ret = ret && config->fromMap(map);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap AnalyzerSettings::defaults() const
|
QVariantMap AnalyzerSettings::defaults() const
|
||||||
{
|
{
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
@@ -75,10 +67,29 @@ QVariantMap AnalyzerSettings::defaults() const
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AnalyzerSettings::fromMap(const QVariantMap &map)
|
||||||
|
{
|
||||||
|
return fromMap(map, &m_subConfigs);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AnalyzerSettings::fromMap(const QVariantMap &map, QList<AbstractAnalyzerSubConfig *> *subConfigs)
|
||||||
|
{
|
||||||
|
bool ret = true;
|
||||||
|
foreach (AbstractAnalyzerSubConfig *config, *subConfigs) {
|
||||||
|
ret = ret && config->fromMap(map);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap AnalyzerSettings::toMap() const
|
QVariantMap AnalyzerSettings::toMap() const
|
||||||
|
{
|
||||||
|
return toMap(m_subConfigs);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap AnalyzerSettings::toMap(const QList<AbstractAnalyzerSubConfig *> &subConfigs) const
|
||||||
{
|
{
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
foreach (AbstractAnalyzerSubConfig *config, subConfigs()) {
|
foreach (AbstractAnalyzerSubConfig *config, subConfigs) {
|
||||||
map.unite(config->toMap());
|
map.unite(config->toMap());
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
@@ -102,6 +113,7 @@ AnalyzerGlobalSettings *AnalyzerGlobalSettings::instance()
|
|||||||
AnalyzerGlobalSettings::~AnalyzerGlobalSettings()
|
AnalyzerGlobalSettings::~AnalyzerGlobalSettings()
|
||||||
{
|
{
|
||||||
m_instance = 0;
|
m_instance = 0;
|
||||||
|
qDeleteAll(m_subConfigs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerGlobalSettings::readSettings()
|
void AnalyzerGlobalSettings::readSettings()
|
||||||
@@ -134,30 +146,36 @@ void AnalyzerGlobalSettings::writeSettings() const
|
|||||||
void AnalyzerGlobalSettings::registerSubConfigs
|
void AnalyzerGlobalSettings::registerSubConfigs
|
||||||
(AnalyzerSubConfigFactory globalCreator, AnalyzerSubConfigFactory projectCreator)
|
(AnalyzerSubConfigFactory globalCreator, AnalyzerSubConfigFactory projectCreator)
|
||||||
{
|
{
|
||||||
m_projectSubConfigs.append(projectCreator);
|
m_projectSubConfigFactories.append(projectCreator);
|
||||||
|
|
||||||
AbstractAnalyzerSubConfig *config = globalCreator();
|
AbstractAnalyzerSubConfig *config = globalCreator();
|
||||||
config->setParent(this);
|
m_subConfigs.append(config);
|
||||||
AnalyzerPlugin::instance()->addAutoReleasedObject(new AnalyzerOptionsPage(config));
|
AnalyzerPlugin::instance()->addAutoReleasedObject(new AnalyzerOptionsPage(config));
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<AnalyzerSubConfigFactory> AnalyzerGlobalSettings::projectSubConfigs() const
|
QList<AnalyzerSubConfigFactory> AnalyzerGlobalSettings::projectSubConfigFactories() const
|
||||||
{
|
{
|
||||||
return m_projectSubConfigs;
|
return m_projectSubConfigFactories;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerProjectSettings::AnalyzerProjectSettings(QObject *parent)
|
AnalyzerProjectSettings::AnalyzerProjectSettings(QObject *parent)
|
||||||
: AnalyzerSettings(parent)
|
: AnalyzerSettings(parent), m_useGlobalSettings(true)
|
||||||
{
|
{
|
||||||
// add sub configs
|
// add sub configs
|
||||||
foreach (AnalyzerSubConfigFactory factory, AnalyzerGlobalSettings::instance()->projectSubConfigs())
|
foreach (AnalyzerSubConfigFactory factory, AnalyzerGlobalSettings::instance()->projectSubConfigFactories()) {
|
||||||
factory()->setParent(this);
|
AbstractAnalyzerSubConfig *config = factory();
|
||||||
|
m_customConfigurations.append(config);
|
||||||
|
}
|
||||||
|
|
||||||
// take defaults from global settings
|
m_subConfigs = AnalyzerGlobalSettings::instance()->subConfigs();
|
||||||
AnalyzerGlobalSettings *gs = AnalyzerGlobalSettings::instance();
|
resetCustomToGlobalSettings();
|
||||||
fromMap(gs->toMap());
|
}
|
||||||
|
|
||||||
|
AnalyzerProjectSettings::~AnalyzerProjectSettings()
|
||||||
|
{
|
||||||
|
qDeleteAll(m_customConfigurations);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AnalyzerProjectSettings::displayName() const
|
QString AnalyzerProjectSettings::displayName() const
|
||||||
@@ -167,12 +185,35 @@ QString AnalyzerProjectSettings::displayName() const
|
|||||||
|
|
||||||
bool AnalyzerProjectSettings::fromMap(const QVariantMap &map)
|
bool AnalyzerProjectSettings::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
return AnalyzerSettings::fromMap(map);
|
if (!AnalyzerSettings::fromMap(map, &m_customConfigurations))
|
||||||
|
return false;
|
||||||
|
m_useGlobalSettings = map.value(QLatin1String(useGlobalC), true).toBool();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap AnalyzerProjectSettings::toMap() const
|
QVariantMap AnalyzerProjectSettings::toMap() const
|
||||||
{
|
{
|
||||||
return AnalyzerSettings::toMap();
|
QVariantMap map = AnalyzerSettings::toMap(m_customConfigurations);
|
||||||
|
map.insert(QLatin1String(useGlobalC), m_useGlobalSettings);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnalyzerProjectSettings::setUsingGlobalSettings(bool value)
|
||||||
|
{
|
||||||
|
if (value == m_useGlobalSettings)
|
||||||
|
return;
|
||||||
|
m_useGlobalSettings = value;
|
||||||
|
if (m_useGlobalSettings) {
|
||||||
|
m_subConfigs = AnalyzerGlobalSettings::instance()->subConfigs();
|
||||||
|
} else {
|
||||||
|
m_subConfigs = m_customConfigurations;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnalyzerProjectSettings::resetCustomToGlobalSettings()
|
||||||
|
{
|
||||||
|
AnalyzerGlobalSettings *gs = AnalyzerGlobalSettings::instance();
|
||||||
|
AnalyzerSettings::fromMap(gs->toMap(), &m_customConfigurations);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
|||||||
@@ -95,12 +95,16 @@ public:
|
|||||||
template<class T>
|
template<class T>
|
||||||
T *subConfig() const
|
T *subConfig() const
|
||||||
{
|
{
|
||||||
return findChild<T *>();
|
foreach (AbstractAnalyzerSubConfig *subConfig, subConfigs()) {
|
||||||
|
if (T *config = qobject_cast<T *>(subConfig))
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<AbstractAnalyzerSubConfig *> subConfigs() const
|
QList<AbstractAnalyzerSubConfig *> subConfigs() const
|
||||||
{
|
{
|
||||||
return findChildren<AbstractAnalyzerSubConfig *>();
|
return m_subConfigs;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap defaults() const;
|
QVariantMap defaults() const;
|
||||||
@@ -109,7 +113,11 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual bool fromMap(const QVariantMap &map);
|
virtual bool fromMap(const QVariantMap &map);
|
||||||
|
|
||||||
|
QVariantMap toMap(const QList<AbstractAnalyzerSubConfig *> &subConfigs) const;
|
||||||
|
bool fromMap(const QVariantMap &map, QList<AbstractAnalyzerSubConfig *> *subConfigs);
|
||||||
|
|
||||||
AnalyzerSettings(QObject *parent);
|
AnalyzerSettings(QObject *parent);
|
||||||
|
QList<AbstractAnalyzerSubConfig *> m_subConfigs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -137,12 +145,12 @@ public:
|
|||||||
void readSettings();
|
void readSettings();
|
||||||
|
|
||||||
void registerSubConfigs(AnalyzerSubConfigFactory globalFactory, AnalyzerSubConfigFactory projectFactory);
|
void registerSubConfigs(AnalyzerSubConfigFactory globalFactory, AnalyzerSubConfigFactory projectFactory);
|
||||||
QList<AnalyzerSubConfigFactory> projectSubConfigs() const;
|
QList<AnalyzerSubConfigFactory> projectSubConfigFactories() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AnalyzerGlobalSettings(QObject *parent);
|
AnalyzerGlobalSettings(QObject *parent);
|
||||||
static AnalyzerGlobalSettings *m_instance;
|
static AnalyzerGlobalSettings *m_instance;
|
||||||
QList<AnalyzerSubConfigFactory> m_projectSubConfigs;
|
QList<AnalyzerSubConfigFactory> m_projectSubConfigFactories;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -161,12 +169,23 @@ class ANALYZER_EXPORT AnalyzerProjectSettings
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
AnalyzerProjectSettings(QObject *parent = 0);
|
AnalyzerProjectSettings(QObject *parent = 0);
|
||||||
|
~AnalyzerProjectSettings();
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
virtual QVariantMap toMap() const;
|
virtual QVariantMap toMap() const;
|
||||||
|
|
||||||
|
bool isUsingGlobalSettings() const { return m_useGlobalSettings; }
|
||||||
|
void setUsingGlobalSettings(bool value);
|
||||||
|
void resetCustomToGlobalSettings();
|
||||||
|
|
||||||
|
QList<AbstractAnalyzerSubConfig *> customSubConfigs() const { return m_customConfigurations; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool fromMap(const QVariantMap &map);
|
virtual bool fromMap(const QVariantMap &map);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_useGlobalSettings;
|
||||||
|
QList<AbstractAnalyzerSubConfig *> m_customConfigurations;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
|||||||
@@ -54,11 +54,14 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
|
|||||||
m_ui(new Ui::ValgrindConfigWidget)
|
m_ui(new Ui::ValgrindConfigWidget)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
m_model = new QStandardItemModel(this);
|
||||||
|
|
||||||
m_ui->valgrindExeChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
m_ui->valgrindExeChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||||
m_ui->valgrindExeChooser->setPromptDialogTitle(tr("Valgrind Command"));
|
m_ui->valgrindExeChooser->setPromptDialogTitle(tr("Valgrind Command"));
|
||||||
|
|
||||||
m_ui->valgrindExeChooser->setPath(m_settings->valgrindExecutable());
|
updateUi();
|
||||||
|
connect(m_settings, SIGNAL(changed()), this, SLOT(updateUi()));
|
||||||
|
|
||||||
connect(m_ui->valgrindExeChooser, SIGNAL(changed(QString)),
|
connect(m_ui->valgrindExeChooser, SIGNAL(changed(QString)),
|
||||||
m_settings, SLOT(setValgrindExecutable(QString)));
|
m_settings, SLOT(setValgrindExecutable(QString)));
|
||||||
connect(m_settings, SIGNAL(valgrindExecutableChanged(QString)),
|
connect(m_settings, SIGNAL(valgrindExecutableChanged(QString)),
|
||||||
@@ -74,43 +77,36 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
|
|||||||
//
|
//
|
||||||
// Callgrind
|
// Callgrind
|
||||||
//
|
//
|
||||||
m_ui->enableCacheSim->setChecked(m_settings->enableCacheSim());
|
|
||||||
connect(m_ui->enableCacheSim, SIGNAL(toggled(bool)),
|
connect(m_ui->enableCacheSim, SIGNAL(toggled(bool)),
|
||||||
m_settings, SLOT(setEnableCacheSim(bool)));
|
m_settings, SLOT(setEnableCacheSim(bool)));
|
||||||
connect(m_settings, SIGNAL(enableCacheSimChanged(bool)),
|
connect(m_settings, SIGNAL(enableCacheSimChanged(bool)),
|
||||||
m_ui->enableCacheSim, SLOT(setChecked(bool)));
|
m_ui->enableCacheSim, SLOT(setChecked(bool)));
|
||||||
|
|
||||||
m_ui->enableBranchSim->setChecked(m_settings->enableBranchSim());
|
|
||||||
connect(m_ui->enableBranchSim, SIGNAL(toggled(bool)),
|
connect(m_ui->enableBranchSim, SIGNAL(toggled(bool)),
|
||||||
m_settings, SLOT(setEnableBranchSim(bool)));
|
m_settings, SLOT(setEnableBranchSim(bool)));
|
||||||
connect(m_settings, SIGNAL(enableBranchSimChanged(bool)),
|
connect(m_settings, SIGNAL(enableBranchSimChanged(bool)),
|
||||||
m_ui->enableBranchSim, SLOT(setChecked(bool)));
|
m_ui->enableBranchSim, SLOT(setChecked(bool)));
|
||||||
|
|
||||||
m_ui->collectSystime->setChecked(m_settings->collectSystime());
|
|
||||||
connect(m_ui->collectSystime, SIGNAL(toggled(bool)),
|
connect(m_ui->collectSystime, SIGNAL(toggled(bool)),
|
||||||
m_settings, SLOT(setCollectSystime(bool)));
|
m_settings, SLOT(setCollectSystime(bool)));
|
||||||
connect(m_settings, SIGNAL(collectSystimeChanged(bool)),
|
connect(m_settings, SIGNAL(collectSystimeChanged(bool)),
|
||||||
m_ui->collectSystime, SLOT(setChecked(bool)));
|
m_ui->collectSystime, SLOT(setChecked(bool)));
|
||||||
|
|
||||||
m_ui->collectBusEvents->setChecked(m_settings->collectBusEvents());
|
|
||||||
connect(m_ui->collectBusEvents, SIGNAL(toggled(bool)),
|
connect(m_ui->collectBusEvents, SIGNAL(toggled(bool)),
|
||||||
m_settings, SLOT(setCollectBusEvents(bool)));
|
m_settings, SLOT(setCollectBusEvents(bool)));
|
||||||
connect(m_settings, SIGNAL(collectBusEventsChanged(bool)),
|
connect(m_settings, SIGNAL(collectBusEventsChanged(bool)),
|
||||||
m_ui->collectBusEvents, SLOT(setChecked(bool)));
|
m_ui->collectBusEvents, SLOT(setChecked(bool)));
|
||||||
|
|
||||||
m_ui->enableEventToolTips->setChecked(m_settings->enableEventToolTips());
|
|
||||||
connect(m_ui->enableEventToolTips, SIGNAL(toggled(bool)),
|
connect(m_ui->enableEventToolTips, SIGNAL(toggled(bool)),
|
||||||
m_settings, SLOT(setEnableEventToolTips(bool)));
|
m_settings, SLOT(setEnableEventToolTips(bool)));
|
||||||
connect(m_settings, SIGNAL(enableEventToolTipsChanged(bool)),
|
connect(m_settings, SIGNAL(enableEventToolTipsChanged(bool)),
|
||||||
m_ui->enableEventToolTips, SLOT(setChecked(bool)));
|
m_ui->enableEventToolTips, SLOT(setChecked(bool)));
|
||||||
|
|
||||||
m_ui->minimumInclusiveCostRatio->setValue(m_settings->minimumInclusiveCostRatio());
|
|
||||||
connect(m_ui->minimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
|
connect(m_ui->minimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
|
||||||
m_settings, SLOT(setMinimumInclusiveCostRatio(double)));
|
m_settings, SLOT(setMinimumInclusiveCostRatio(double)));
|
||||||
connect(m_settings, SIGNAL(minimumInclusiveCostRatioChanged(double)),
|
connect(m_settings, SIGNAL(minimumInclusiveCostRatioChanged(double)),
|
||||||
m_ui->minimumInclusiveCostRatio, SLOT(setValue(double)));
|
m_ui->minimumInclusiveCostRatio, SLOT(setValue(double)));
|
||||||
|
|
||||||
m_ui->visualisationMinimumInclusiveCostRatio->setValue(m_settings->visualisationMinimumInclusiveCostRatio());
|
|
||||||
connect(m_ui->visualisationMinimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
|
connect(m_ui->visualisationMinimumInclusiveCostRatio, SIGNAL(valueChanged(double)),
|
||||||
m_settings, SLOT(setVisualisationMinimumInclusiveCostRatio(double)));
|
m_settings, SLOT(setVisualisationMinimumInclusiveCostRatio(double)));
|
||||||
connect(m_settings, SIGNAL(visualisationMinimumInclusiveCostRatioChanged(double)),
|
connect(m_settings, SIGNAL(visualisationMinimumInclusiveCostRatioChanged(double)),
|
||||||
@@ -119,8 +115,6 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
|
|||||||
//
|
//
|
||||||
// Memcheck
|
// Memcheck
|
||||||
//
|
//
|
||||||
m_model = new QStandardItemModel(this);
|
|
||||||
|
|
||||||
m_ui->suppressionList->setModel(m_model);
|
m_ui->suppressionList->setModel(m_model);
|
||||||
m_ui->suppressionList->setSelectionMode(QAbstractItemView::MultiSelection);
|
m_ui->suppressionList->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||||
|
|
||||||
@@ -129,11 +123,9 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
|
|||||||
connect(m_ui->removeSuppression, SIGNAL(clicked()),
|
connect(m_ui->removeSuppression, SIGNAL(clicked()),
|
||||||
this, SLOT(slotRemoveSuppression()));
|
this, SLOT(slotRemoveSuppression()));
|
||||||
|
|
||||||
m_ui->numCallers->setValue(m_settings->numCallers());
|
|
||||||
connect(m_ui->numCallers, SIGNAL(valueChanged(int)), m_settings, SLOT(setNumCallers(int)));
|
connect(m_ui->numCallers, SIGNAL(valueChanged(int)), m_settings, SLOT(setNumCallers(int)));
|
||||||
connect(m_settings, SIGNAL(numCallersChanged(int)), m_ui->numCallers, SLOT(setValue(int)));
|
connect(m_settings, SIGNAL(numCallersChanged(int)), m_ui->numCallers, SLOT(setValue(int)));
|
||||||
|
|
||||||
m_ui->trackOrigins->setChecked(m_settings->trackOrigins());
|
|
||||||
connect(m_ui->trackOrigins, SIGNAL(toggled(bool)),
|
connect(m_ui->trackOrigins, SIGNAL(toggled(bool)),
|
||||||
m_settings, SLOT(setTrackOrigins(bool)));
|
m_settings, SLOT(setTrackOrigins(bool)));
|
||||||
connect(m_settings, SIGNAL(trackOriginsChanged(bool)),
|
connect(m_settings, SIGNAL(trackOriginsChanged(bool)),
|
||||||
@@ -144,10 +136,6 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
|
|||||||
connect(m_settings, SIGNAL(suppressionFilesAdded(QStringList)),
|
connect(m_settings, SIGNAL(suppressionFilesAdded(QStringList)),
|
||||||
this, SLOT(slotSuppressionsAdded(QStringList)));
|
this, SLOT(slotSuppressionsAdded(QStringList)));
|
||||||
|
|
||||||
m_model->clear();
|
|
||||||
foreach (const QString &file, m_settings->suppressionFiles())
|
|
||||||
m_model->appendRow(new QStandardItem(file));
|
|
||||||
|
|
||||||
connect(m_ui->suppressionList->selectionModel(),
|
connect(m_ui->suppressionList->selectionModel(),
|
||||||
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
this, SLOT(slotSuppressionSelectionChanged()));
|
this, SLOT(slotSuppressionSelectionChanged()));
|
||||||
@@ -169,6 +157,23 @@ ValgrindConfigWidget::~ValgrindConfigWidget()
|
|||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ValgrindConfigWidget::updateUi()
|
||||||
|
{
|
||||||
|
m_ui->valgrindExeChooser->setPath(m_settings->valgrindExecutable());
|
||||||
|
m_ui->enableCacheSim->setChecked(m_settings->enableCacheSim());
|
||||||
|
m_ui->enableBranchSim->setChecked(m_settings->enableBranchSim());
|
||||||
|
m_ui->collectSystime->setChecked(m_settings->collectSystime());
|
||||||
|
m_ui->collectBusEvents->setChecked(m_settings->collectBusEvents());
|
||||||
|
m_ui->enableEventToolTips->setChecked(m_settings->enableEventToolTips());
|
||||||
|
m_ui->minimumInclusiveCostRatio->setValue(m_settings->minimumInclusiveCostRatio());
|
||||||
|
m_ui->visualisationMinimumInclusiveCostRatio->setValue(m_settings->visualisationMinimumInclusiveCostRatio());
|
||||||
|
m_ui->numCallers->setValue(m_settings->numCallers());
|
||||||
|
m_ui->trackOrigins->setChecked(m_settings->trackOrigins());
|
||||||
|
m_model->clear();
|
||||||
|
foreach (const QString &file, m_settings->suppressionFiles())
|
||||||
|
m_model->appendRow(new QStandardItem(file));
|
||||||
|
}
|
||||||
|
|
||||||
void ValgrindConfigWidget::slotAddSuppression()
|
void ValgrindConfigWidget::slotAddSuppression()
|
||||||
{
|
{
|
||||||
QFileDialog dialog;
|
QFileDialog dialog;
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ public Q_SLOTS:
|
|||||||
void slotSuppressionsAdded(const QStringList &files);
|
void slotSuppressionsAdded(const QStringList &files);
|
||||||
void slotSuppressionSelectionChanged();
|
void slotSuppressionSelectionChanged();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ValgrindBaseSettings *m_settings;
|
ValgrindBaseSettings *m_settings;
|
||||||
Ui::ValgrindConfigWidget *m_ui;
|
Ui::ValgrindConfigWidget *m_ui;
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ bool ValgrindBaseSettings::fromMap(const QVariantMap &map)
|
|||||||
setIfPresent(map, QLatin1String(callgrindVisualisationMinimumCostRatioC),
|
setIfPresent(map, QLatin1String(callgrindVisualisationMinimumCostRatioC),
|
||||||
&m_visualisationMinimumInclusiveCostRatio);
|
&m_visualisationMinimumInclusiveCostRatio);
|
||||||
|
|
||||||
|
emit changed();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ public:
|
|||||||
virtual QString id() const;
|
virtual QString id() const;
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void changed(); // sent when multiple values have changed simulatenously (e.g. fromMap)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base valgrind settings
|
* Base valgrind settings
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user