ProjectExplorer: Refactor file settings acessor

This is the first patch of a series. The final goal is to introduce
shared settings into Creator.

This particular patch shouldn't affect functionality, but it changes
a bit the design of the settings acessor and prepares the code for
the upcoming commits.

In addition it also makes restoring the settings slightly more
robust, since it will try to load a compatible "old" file from the
quick check before it actually performs the more expensive check.

NOTE: Files userfileacessor.* will be renamed in a following
commit to settingsacessor.*. It's not done right now because I
think it will make the review easier on gerrit.

Reviewed-by: Tobias Hunger
Change-Id: I950c813936afb6c55c770e0d6f061eb27b37c47b
Reviewed-on: http://codereview.qt-project.org/5081
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Leandro Melo
2011-09-15 11:32:15 +02:00
committed by Leandro T. C. Melo
parent d8dedb439c
commit 4c4b3be3e6
3 changed files with 335 additions and 199 deletions

View File

@@ -217,14 +217,12 @@ Target *Project::target(const QString &id) const
void Project::saveSettings()
{
emit aboutToSaveSettings();
UserFileAccessor accessor;
accessor.saveSettings(this, toMap());
SettingsAccessor::instance()->saveSettings(this, toMap());
}
bool Project::restoreSettings()
{
UserFileAccessor accessor;
QVariantMap map(accessor.restoreSettings(this));
QVariantMap map(SettingsAccessor::instance()->restoreSettings(this));
bool ok = fromMap(map);
if (ok)
emit settingsLoaded();