Commit 0c397dd1 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

SettingsAccessor: Add QWidget *parent parameter to saveSettings



The PersistentSettings::writeFile needs it, and SettingsAccessor
should not hardcode it to Core::ICore::mainWindow()

Change-Id: I6ca99e9cd861fd81337028055fe0ed4d158b152f
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 7309b6a2
......@@ -38,6 +38,7 @@
#include <coreplugin/idocument.h>
#include <coreplugin/icontext.h>
#include <coreplugin/icore.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/kitmanager.h>
#include <limits>
......@@ -303,7 +304,7 @@ void Project::saveSettings()
emit aboutToSaveSettings();
if (!d->m_accessor)
d->m_accessor = new Internal::UserFileAccessor(this);
d->m_accessor->saveSettings(toMap());
d->m_accessor->saveSettings(toMap(), Core::ICore::mainWindow());
}
bool Project::restoreSettings()
......
......@@ -561,7 +561,7 @@ QVariantMap SettingsAccessor::restoreSettings() const
return userSettings.m_map;
}
bool SettingsAccessor::saveSettings(const QVariantMap &map) const
bool SettingsAccessor::saveSettings(const QVariantMap &map, QWidget *parent) const
{
if (map.isEmpty())
return false;
......@@ -574,7 +574,7 @@ bool SettingsAccessor::saveSettings(const QVariantMap &map) const
if (shared.isValid())
trackUserStickySettings(settings.m_map, shared.toMap());
return m_userFileAcessor.writeFile(&settings);
return m_userFileAcessor.writeFile(&settings, parent);
}
void SettingsAccessor::addVersionUpgrader(VersionUpgrader *handler)
......@@ -922,7 +922,7 @@ bool SettingsAccessor::FileAccessor::readFile(SettingsData *settings) const
return true;
}
bool SettingsAccessor::FileAccessor::writeFile(const SettingsData *settings) const
bool SettingsAccessor::FileAccessor::writeFile(const SettingsData *settings, QWidget *parent) const
{
if (!m_writer || m_writer->fileName() != settings->fileName()) {
delete m_writer;
......@@ -941,7 +941,7 @@ bool SettingsAccessor::FileAccessor::writeFile(const SettingsData *settings) con
if (m_environmentSpecific)
data.insert(QLatin1String(ENVIRONMENT_ID_KEY), SettingsAccessor::creatorId());
return m_writer->save(data, Core::ICore::mainWindow());
return m_writer->save(data, parent);
}
// -------------------------------------------------------------------------
......
......@@ -51,7 +51,7 @@ public:
Project *project() const;
QVariantMap restoreSettings() const;
bool saveSettings(const QVariantMap &map) const;
bool saveSettings(const QVariantMap &data, QWidget *parent) const;
void addVersionUpgrader(Internal::VersionUpgrader *handler); // Takes ownership of the handler!
private:
......@@ -99,7 +99,7 @@ private:
~FileAccessor();
bool readFile(SettingsData *settings) const;
bool writeFile(const SettingsData *settings) const;
bool writeFile(const SettingsData *settings, QWidget *parent) const;
QString suffix() const { return m_suffix; }
......
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