forked from qt-creator/qt-creator
ISettingsAspect: consolidate data copying in base implementation
Change-Id: I1eec0f54d05b3f7d8679060faccc14ec8a3777f6 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -46,6 +46,15 @@ static const char useGlobalC[] = "Analyzer.Project.UseGlobal";
|
||||
|
||||
namespace Analyzer {
|
||||
|
||||
ISettingsAspect *ISettingsAspect::clone() const
|
||||
{
|
||||
ISettingsAspect *other = create();
|
||||
QVariantMap data;
|
||||
toMap(data);
|
||||
other->fromMap(data);
|
||||
return other;
|
||||
}
|
||||
|
||||
AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect(ISettingsAspect *projectSettings,
|
||||
ISettingsAspect *globalSettings)
|
||||
{
|
||||
|
@@ -59,8 +59,10 @@ public:
|
||||
|
||||
/// Create a configuration widget for this settings aspect.
|
||||
virtual QWidget *createConfigWidget(QWidget *parent) = 0;
|
||||
/// Clones the object.
|
||||
virtual ISettingsAspect *clone() = 0;
|
||||
/// "Virtual default constructor"
|
||||
virtual ISettingsAspect *create() const = 0;
|
||||
/// "Virtual copy constructor"
|
||||
ISettingsAspect *clone() const;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -282,15 +282,6 @@ void ValgrindGlobalSettings::fromMap(const QVariantMap &map)
|
||||
setIfPresent(map, QLatin1String(callgrindShortenTemplates), &m_shortenTemplates);
|
||||
}
|
||||
|
||||
ISettingsAspect *ValgrindGlobalSettings::clone()
|
||||
{
|
||||
ValgrindGlobalSettings *other = new ValgrindGlobalSettings;
|
||||
QVariantMap data;
|
||||
toMap(data);
|
||||
other->fromMap(data);
|
||||
return other;
|
||||
}
|
||||
|
||||
void ValgrindGlobalSettings::toMap(QVariantMap &map) const
|
||||
{
|
||||
ValgrindBaseSettings::toMap(map);
|
||||
@@ -461,15 +452,6 @@ void ValgrindProjectSettings::fromMap(const QVariantMap &map)
|
||||
setIfPresent(map, QLatin1String(removedSuppressionFilesC), &m_disabledGlobalSuppressionFiles);
|
||||
}
|
||||
|
||||
ISettingsAspect *ValgrindProjectSettings::clone()
|
||||
{
|
||||
ValgrindProjectSettings *other = new ValgrindProjectSettings;
|
||||
QVariantMap data;
|
||||
toMap(data);
|
||||
other->fromMap(data);
|
||||
return other;
|
||||
}
|
||||
|
||||
void ValgrindProjectSettings::toMap(QVariantMap &map) const
|
||||
{
|
||||
ValgrindBaseSettings::toMap(map);
|
||||
|
@@ -170,7 +170,8 @@ public:
|
||||
QWidget *createConfigWidget(QWidget *parent);
|
||||
void toMap(QVariantMap &map) const;
|
||||
void fromMap(const QVariantMap &map);
|
||||
virtual ISettingsAspect *clone();
|
||||
ISettingsAspect *create() const { return new ValgrindGlobalSettings; }
|
||||
|
||||
|
||||
/*
|
||||
* Global memcheck settings
|
||||
@@ -230,7 +231,7 @@ public:
|
||||
QWidget *createConfigWidget(QWidget *parent);
|
||||
void toMap(QVariantMap &map) const;
|
||||
void fromMap(const QVariantMap &map);
|
||||
virtual ISettingsAspect *clone();
|
||||
ISettingsAspect *create() const { return new ValgrindProjectSettings; }
|
||||
|
||||
/**
|
||||
* Per-project memcheck settings, saves a diff to the global suppression files list
|
||||
|
Reference in New Issue
Block a user