forked from qt-creator/qt-creator
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: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
#include <projectexplorer/buildmanager.h>
|
#include <projectexplorer/buildmanager.h>
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@@ -303,7 +304,7 @@ void Project::saveSettings()
|
|||||||
emit aboutToSaveSettings();
|
emit aboutToSaveSettings();
|
||||||
if (!d->m_accessor)
|
if (!d->m_accessor)
|
||||||
d->m_accessor = new Internal::UserFileAccessor(this);
|
d->m_accessor = new Internal::UserFileAccessor(this);
|
||||||
d->m_accessor->saveSettings(toMap());
|
d->m_accessor->saveSettings(toMap(), Core::ICore::mainWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Project::restoreSettings()
|
bool Project::restoreSettings()
|
||||||
|
|||||||
@@ -561,7 +561,7 @@ QVariantMap SettingsAccessor::restoreSettings() const
|
|||||||
return userSettings.m_map;
|
return userSettings.m_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SettingsAccessor::saveSettings(const QVariantMap &map) const
|
bool SettingsAccessor::saveSettings(const QVariantMap &map, QWidget *parent) const
|
||||||
{
|
{
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
@@ -574,7 +574,7 @@ bool SettingsAccessor::saveSettings(const QVariantMap &map) const
|
|||||||
if (shared.isValid())
|
if (shared.isValid())
|
||||||
trackUserStickySettings(settings.m_map, shared.toMap());
|
trackUserStickySettings(settings.m_map, shared.toMap());
|
||||||
|
|
||||||
return m_userFileAcessor.writeFile(&settings);
|
return m_userFileAcessor.writeFile(&settings, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsAccessor::addVersionUpgrader(VersionUpgrader *handler)
|
void SettingsAccessor::addVersionUpgrader(VersionUpgrader *handler)
|
||||||
@@ -922,7 +922,7 @@ bool SettingsAccessor::FileAccessor::readFile(SettingsData *settings) const
|
|||||||
return true;
|
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()) {
|
if (!m_writer || m_writer->fileName() != settings->fileName()) {
|
||||||
delete m_writer;
|
delete m_writer;
|
||||||
@@ -941,7 +941,7 @@ bool SettingsAccessor::FileAccessor::writeFile(const SettingsData *settings) con
|
|||||||
|
|
||||||
if (m_environmentSpecific)
|
if (m_environmentSpecific)
|
||||||
data.insert(QLatin1String(ENVIRONMENT_ID_KEY), SettingsAccessor::creatorId());
|
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;
|
Project *project() const;
|
||||||
|
|
||||||
QVariantMap restoreSettings() 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!
|
void addVersionUpgrader(Internal::VersionUpgrader *handler); // Takes ownership of the handler!
|
||||||
private:
|
private:
|
||||||
@@ -99,7 +99,7 @@ private:
|
|||||||
~FileAccessor();
|
~FileAccessor();
|
||||||
|
|
||||||
bool readFile(SettingsData *settings) const;
|
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; }
|
QString suffix() const { return m_suffix; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user