diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index bda3bad535f4d608e8d68d4ee8c6fdd661b5733b..49275df75e31728960eecd25bb8f179865018480 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -72,7 +72,7 @@ const char * const TARGET_KEY_PREFIX("ProjectExplorer.Project.Target."); const char * const TARGET_COUNT_KEY("ProjectExplorer.Project.TargetCount"); const char * const EDITOR_SETTINGS_KEY("ProjectExplorer.Project.EditorSettings"); - +const char * const PLUGIN_SETTINGS_KEY("ProjectExplorer.Project.PluginSettings"); } // namespace namespace ProjectExplorer { @@ -89,6 +89,7 @@ public: EditorConfiguration *m_editorConfiguration; Core::Context m_projectContext; Core::Context m_projectLanguage; + QVariantMap m_pluginSettings; }; ProjectPrivate::ProjectPrivate() : @@ -215,6 +216,7 @@ Target *Project::target(const QString &id) const void Project::saveSettings() { + emit aboutToSaveSettings(); UserFileAccessor accessor; accessor.saveSettings(this, toMap()); } @@ -223,7 +225,10 @@ bool Project::restoreSettings() { UserFileAccessor accessor; QVariantMap map(accessor.restoreSettings(this)); - return fromMap(map); + bool ok = fromMap(map); + if (ok) + emit settingsLoaded(); + return ok; } QList<BuildConfigWidget*> Project::subConfigWidgets() @@ -253,6 +258,7 @@ QVariantMap Project::toMap() const map.insert(QString::fromLatin1(TARGET_KEY_PREFIX) + QString::number(i), ts.at(i)->toMap()); map.insert(QLatin1String(EDITOR_SETTINGS_KEY), d->m_editorConfiguration->toMap()); + map.insert(QLatin1String(PLUGIN_SETTINGS_KEY), d->m_pluginSettings); return map; } @@ -278,6 +284,9 @@ bool Project::fromMap(const QVariantMap &map) d->m_editorConfiguration->fromMap(values); } + if (map.contains(QLatin1String(PLUGIN_SETTINGS_KEY))) + d->m_pluginSettings = map.value(QLatin1String(PLUGIN_SETTINGS_KEY)).toMap(); + bool ok; int maxI(map.value(QLatin1String(TARGET_COUNT_KEY), 0).toInt(&ok)); if (!ok || maxI < 0) @@ -355,4 +364,14 @@ Core::Context Project::projectLanguage() const return d->m_projectLanguage; } +QVariant Project::namedSettings(const QString &name) const +{ + return d->m_pluginSettings.value(name); +} + +void Project::setNamedSettings(const QString &name, QVariant &value) +{ + d->m_pluginSettings.insert(name, value); +} + } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index 99ea476e0dac9446b4b2d6dc3c5a8e2c27159a8f..15d11a369fe3cff1a61d3e8a61e4b71d27b235a9 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -114,6 +114,9 @@ public: virtual Core::Context projectContext() const; virtual Core::Context projectLanguage() const; + QVariant namedSettings(const QString &name) const; + void setNamedSettings(const QString &name, QVariant &value); + signals: void fileListChanged(); @@ -127,6 +130,9 @@ signals: void environmentChanged(); void buildConfigurationEnabledChanged(); + void settingsLoaded(); + void aboutToSaveSettings(); + protected: // restore all data from the map. //