Commit 3c14ceeb authored by hjk's avatar hjk
Browse files

Analyzer: Rename AbstractAnalyzerSubConfig to ISettingsAspect



More in line with IRunConfigurationAspect

Change-Id: I50a038de004733b6b19d345b30a63cc2db02875a
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent cd460a36
......@@ -46,7 +46,7 @@ namespace Internal {
AnalyzerRunConfigWidget::AnalyzerRunConfigWidget(AnalyzerRunConfigurationAspect *aspect)
{
m_aspect = aspect;
m_config = aspect->customSubConfig();
m_config = aspect->projectSettings();
QWidget *globalSetting = new QWidget;
QHBoxLayout *globalSettingLayout = new QHBoxLayout(globalSetting);
......
......@@ -59,7 +59,7 @@ private slots:
private:
QWidget *m_configWidget;
AnalyzerRunConfigurationAspect *m_aspect;
AbstractAnalyzerSubConfig *m_config;
ISettingsAspect *m_config;
QComboBox *m_settingsCombo;
QPushButton *m_restoreButton;
Utils::DetailsWidget *m_details;
......
......@@ -46,34 +46,33 @@ static const char useGlobalC[] = "Analyzer.Project.UseGlobal";
namespace Analyzer {
AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect(
AbstractAnalyzerSubConfig *customConfiguration,
AbstractAnalyzerSubConfig *globalConfiguration)
AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect(ISettingsAspect *projectSettings,
ISettingsAspect *globalSettings)
{
m_useGlobalSettings = true;
m_customConfiguration = customConfiguration;
m_globalConfiguration = globalConfiguration;
m_projectSettings = projectSettings;
m_globalSettings = globalSettings;
}
AbstractAnalyzerSubConfig *AnalyzerRunConfigurationAspect::currentConfig() const
ISettingsAspect *AnalyzerRunConfigurationAspect::currentSettings() const
{
return m_useGlobalSettings ? m_globalConfiguration : m_customConfiguration;
return m_useGlobalSettings ? m_globalSettings : m_projectSettings;
}
AnalyzerRunConfigurationAspect::~AnalyzerRunConfigurationAspect()
{
delete m_customConfiguration;
delete m_projectSettings;
}
void AnalyzerRunConfigurationAspect::fromMap(const QVariantMap &map)
{
m_customConfiguration->fromMap(map);
m_projectSettings->fromMap(map);
m_useGlobalSettings = map.value(QLatin1String(useGlobalC), true).toBool();
}
void AnalyzerRunConfigurationAspect::toMap(QVariantMap &map) const
{
m_customConfiguration->toMap(map);
m_projectSettings->toMap(map);
map.insert(QLatin1String(useGlobalC), m_useGlobalSettings);
}
......@@ -82,7 +81,7 @@ AnalyzerRunConfigurationAspect *AnalyzerRunConfigurationAspect::clone(
{
Q_UNUSED(parent)
AnalyzerRunConfigurationAspect *other
= new AnalyzerRunConfigurationAspect(m_customConfiguration->clone(), m_globalConfiguration);
= new AnalyzerRunConfigurationAspect(m_projectSettings->clone(), m_globalSettings);
other->m_useGlobalSettings = m_useGlobalSettings;
return other;
}
......@@ -94,11 +93,11 @@ void AnalyzerRunConfigurationAspect::setUsingGlobalSettings(bool value)
void AnalyzerRunConfigurationAspect::resetCustomToGlobalSettings()
{
AbstractAnalyzerSubConfig *global = globalSubConfig();
ISettingsAspect *global = globalSettings();
QTC_ASSERT(global, return);
QVariantMap map;
global->toMap(map);
m_customConfiguration->fromMap(map);
m_projectSettings->fromMap(map);
}
ProjectExplorer::RunConfigWidget *AnalyzerRunConfigurationAspect::createConfigurationWidget()
......
......@@ -45,33 +45,28 @@ namespace Analyzer {
* If global and project-specific settings differ for your tool,
* create one subclass for each.
*/
class ANALYZER_EXPORT AbstractAnalyzerSubConfig : public QObject
class ANALYZER_EXPORT ISettingsAspect : public QObject
{
Q_OBJECT
public:
AbstractAnalyzerSubConfig() {}
ISettingsAspect() {}
/// convert current configuration into map for storage
/// Converts current object into map for storage.
virtual void toMap(QVariantMap &map) const = 0;
/// read configuration from @p map
/// Read object state from @p map.
virtual void fromMap(const QVariantMap &map) = 0;
/// create a configuration widget for this configuration
/// Create a configuration widget for this settings aspect.
virtual QWidget *createConfigWidget(QWidget *parent) = 0;
/// clones s AbstractAnalyzerSubConfig
virtual AbstractAnalyzerSubConfig *clone() = 0;
/// Clones the object.
virtual ISettingsAspect *clone() = 0;
};
/**
* Settings associated with a single project/run configuration
*
* To access your custom configuration use:
* @code
* ProjectExplorer::RunConfiguration *rc = ...;
* rc->extraAspect<AnalyzerRunConfigurationAspect>()->subConfig<YourProjectConfig>()->...
* @endcode
*/
class ANALYZER_EXPORT AnalyzerRunConfigurationAspect
: public ProjectExplorer::IRunConfigurationAspect
......@@ -79,8 +74,8 @@ class ANALYZER_EXPORT AnalyzerRunConfigurationAspect
Q_OBJECT
public:
AnalyzerRunConfigurationAspect(AbstractAnalyzerSubConfig *customConfiguration,
AbstractAnalyzerSubConfig *globalConfiguration);
AnalyzerRunConfigurationAspect(ISettingsAspect *projectSettings,
ISettingsAspect *globalSettings);
~AnalyzerRunConfigurationAspect();
......@@ -90,9 +85,9 @@ public:
void setUsingGlobalSettings(bool value);
void resetCustomToGlobalSettings();
AbstractAnalyzerSubConfig *customSubConfig() const { return m_customConfiguration; }
AbstractAnalyzerSubConfig *globalSubConfig() const { return m_globalConfiguration; }
AbstractAnalyzerSubConfig *currentConfig() const;
ISettingsAspect *projectSettings() const { return m_projectSettings; }
ISettingsAspect *globalSettings() const { return m_globalSettings; }
ISettingsAspect *currentSettings() const;
ProjectExplorer::RunConfigWidget *createConfigurationWidget();
protected:
......@@ -101,8 +96,8 @@ protected:
private:
bool m_useGlobalSettings;
AbstractAnalyzerSubConfig *m_customConfiguration;
AbstractAnalyzerSubConfig *m_globalConfiguration;
ISettingsAspect *m_projectSettings;
ISettingsAspect *m_globalSettings;
};
} // namespace Analyzer
......
......@@ -548,7 +548,7 @@ AnalyzerRunControl *CallgrindToolPrivate::createRunControl(const AnalyzerStartPa
if (runConfiguration) {
if (AnalyzerRunConfigurationAspect *analyzerAspect
= runConfiguration->extraAspect<AnalyzerRunConfigurationAspect>(ANALYZER_VALGRIND_SETTINGS)) {
if (const ValgrindBaseSettings *settings = qobject_cast<ValgrindBaseSettings *>(analyzerAspect->currentConfig())) {
if (const ValgrindBaseSettings *settings = qobject_cast<ValgrindBaseSettings *>(analyzerAspect->currentSettings())) {
m_visualisation->setMinimumInclusiveCostRatio(settings->visualisationMinimumInclusiveCostRatio() / 100.0);
m_proxyModel->setMinimumInclusiveCostRatio(settings->minimumInclusiveCostRatio() / 100.0);
m_dataModel->setVerboseToolTipsEnabled(settings->enableEventToolTips());
......
......@@ -232,7 +232,7 @@ void MemcheckTool::maybeActiveRunConfigurationChanged()
if (Target *target = project->activeTarget())
if (RunConfiguration *rc = target->activeRunConfiguration())
if (AnalyzerRunConfigurationAspect *aspect = rc->extraAspect<AnalyzerRunConfigurationAspect>(ANALYZER_VALGRIND_SETTINGS))
settings = qobject_cast<ValgrindBaseSettings *>(aspect->customSubConfig());
settings = qobject_cast<ValgrindBaseSettings *>(aspect->projectSettings());
if (!settings) // fallback to global settings
settings = ValgrindPlugin::globalSettings();
......
......@@ -65,7 +65,7 @@ ValgrindRunControl::ValgrindRunControl(const AnalyzerStartParameters &sp,
{
if (runConfiguration)
if (AnalyzerRunConfigurationAspect *aspect = runConfiguration->extraAspect<AnalyzerRunConfigurationAspect>(ANALYZER_VALGRIND_SETTINGS))
m_settings = qobject_cast<ValgrindBaseSettings *>(aspect->customSubConfig());
m_settings = qobject_cast<ValgrindBaseSettings *>(aspect->projectSettings());
if (!m_settings)
m_settings = ValgrindPlugin::globalSettings();
......
......@@ -282,7 +282,7 @@ void ValgrindGlobalSettings::fromMap(const QVariantMap &map)
setIfPresent(map, QLatin1String(callgrindShortenTemplates), &m_shortenTemplates);
}
AbstractAnalyzerSubConfig *ValgrindGlobalSettings::clone()
ISettingsAspect *ValgrindGlobalSettings::clone()
{
ValgrindGlobalSettings *other = new ValgrindGlobalSettings;
QVariantMap data;
......@@ -461,7 +461,7 @@ void ValgrindProjectSettings::fromMap(const QVariantMap &map)
setIfPresent(map, QLatin1String(removedSuppressionFilesC), &m_disabledGlobalSuppressionFiles);
}
AbstractAnalyzerSubConfig *ValgrindProjectSettings::clone()
ISettingsAspect *ValgrindProjectSettings::clone()
{
ValgrindProjectSettings *other = new ValgrindProjectSettings;
QVariantMap data;
......
......@@ -46,7 +46,7 @@ const char ANALYZER_VALGRIND_SETTINGS[] = "Analyzer.Valgrind.Settings";
/**
* Valgrind settings shared for global and per-project.
*/
class ValgrindBaseSettings : public Analyzer::AbstractAnalyzerSubConfig
class ValgrindBaseSettings : public Analyzer::ISettingsAspect
{
Q_OBJECT
......@@ -170,7 +170,7 @@ public:
QWidget *createConfigWidget(QWidget *parent);
void toMap(QVariantMap &map) const;
void fromMap(const QVariantMap &map);
virtual AbstractAnalyzerSubConfig *clone();
virtual ISettingsAspect *clone();
/*
* Global memcheck settings
......@@ -230,7 +230,7 @@ public:
QWidget *createConfigWidget(QWidget *parent);
void toMap(QVariantMap &map) const;
void fromMap(const QVariantMap &map);
virtual AbstractAnalyzerSubConfig *clone();
virtual ISettingsAspect *clone();
/**
* Per-project memcheck settings, saves a diff to the global suppression files list
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment