summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@digia.com>2014-02-27 12:02:02 +0100
committerTobias Hunger <tobias.hunger@digia.com>2014-03-14 14:12:59 +0100
commitc652a68d41f6798b30b88265382dd28b152ded8a (patch)
tree22ee57c1b2707fd0f0aeda5d6e19022e4eda52eb /src/plugins/projectexplorer
parentfeca0292495b5ed49fabe1d00ac67aceb5aa7c4d (diff)
downloadqt-creator-c652a68d41f6798b30b88265382dd28b152ded8a.tar.gz
SettingsAccessor: Add a QWidget *parent parameter to restoreSettings
Instead of hardcoding Core::ICore::mainWindow() Change-Id: Iec7747945cbcb335ae552a0277a1527f598f1ff7 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/plugins/projectexplorer')
-rw-r--r--src/plugins/projectexplorer/project.cpp2
-rw-r--r--src/plugins/projectexplorer/settingsaccessor.cpp18
-rw-r--r--src/plugins/projectexplorer/settingsaccessor.h6
3 files changed, 13 insertions, 13 deletions
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index 2acf2ed0f4..d96a35624b 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -311,7 +311,7 @@ bool Project::restoreSettings()
{
if (!d->m_accessor)
d->m_accessor = new Internal::UserFileAccessor(this);
- QVariantMap map(d->m_accessor->restoreSettings());
+ QVariantMap map(d->m_accessor->restoreSettings(Core::ICore::mainWindow()));
bool ok = fromMap(map);
if (ok)
emit settingsLoaded();
diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp
index deb455c42b..d9438cfa45 100644
--- a/src/plugins/projectexplorer/settingsaccessor.cpp
+++ b/src/plugins/projectexplorer/settingsaccessor.cpp
@@ -577,13 +577,13 @@ void trackUserStickySettings(QVariantMap &userMap, const QVariantMap &sharedMap)
} // Anonymous
-QVariantMap SettingsAccessor::restoreSettings() const
+QVariantMap SettingsAccessor::restoreSettings(QWidget *parent) const
{
if (m_lastVersion < 0)
return QVariantMap();
- SettingsData userSettings = readUserSettings();
- SettingsData sharedSettings = readSharedSettings();
+ SettingsData userSettings = readUserSettings(parent);
+ SettingsData sharedSettings = readSharedSettings(parent);
userSettings = mergeSettings(userSettings, sharedSettings);
if (!userSettings.isValid())
@@ -696,7 +696,7 @@ void SettingsAccessor::backupUserFile() const
QFile::copy(origName, backupName);
}
-SettingsAccessor::SettingsData SettingsAccessor::readUserSettings() const
+SettingsAccessor::SettingsData SettingsAccessor::readUserSettings(QWidget *parent) const
{
SettingsData result;
QStringList fileList = findSettingsFiles(m_userSuffix);
@@ -708,7 +708,7 @@ SettingsAccessor::SettingsData SettingsAccessor::readUserSettings() const
// Error handling:
if (!result.isValid()) {
QMessageBox::information(
- Core::ICore::mainWindow(),
+ parent,
QApplication::translate("ProjectExplorer::SettingsAccessor",
"No valid Settings found"),
QApplication::translate("ProjectExplorer::SettingsAccessor",
@@ -732,7 +732,7 @@ SettingsAccessor::SettingsData SettingsAccessor::readUserSettings() const
"<p>Do you still want to load the settings file '%1'?</p>")
.arg(result.fileName().toUserOutput()),
QMessageBox::Yes | QMessageBox::No,
- Core::ICore::mainWindow());
+ parent);
msgBox.setDefaultButton(QMessageBox::No);
msgBox.setEscapeButton(QMessageBox::No);
if (msgBox.exec() == QMessageBox::No)
@@ -740,7 +740,7 @@ SettingsAccessor::SettingsData SettingsAccessor::readUserSettings() const
} else if ((result.fileName().toString() != defaultFileName(m_userSuffix))
&& (result.version() < currentVersion())) {
QMessageBox::information(
- Core::ICore::mainWindow(),
+ parent,
QApplication::translate("ProjectExplorer::SettingsAccessor",
"Using Old Settings"),
QApplication::translate("ProjectExplorer::SettingsAccessor",
@@ -758,7 +758,7 @@ SettingsAccessor::SettingsData SettingsAccessor::readUserSettings() const
return result;
}
-SettingsAccessor::SettingsData SettingsAccessor::readSharedSettings() const
+SettingsAccessor::SettingsData SettingsAccessor::readSharedSettings(QWidget *parent) const
{
SettingsData sharedSettings;
QString fn = project()->projectFilePath() + m_sharedSuffix;
@@ -783,7 +783,7 @@ SettingsAccessor::SettingsData SettingsAccessor::readSharedSettings() const
"supported by Qt Creator. "
"Do you want to try loading it anyway?"),
QMessageBox::Yes | QMessageBox::No,
- Core::ICore::mainWindow());
+ parent);
msgBox.setDefaultButton(QMessageBox::No);
msgBox.setEscapeButton(QMessageBox::No);
if (msgBox.exec() == QMessageBox::No)
diff --git a/src/plugins/projectexplorer/settingsaccessor.h b/src/plugins/projectexplorer/settingsaccessor.h
index a6752951ea..e6ed123c26 100644
--- a/src/plugins/projectexplorer/settingsaccessor.h
+++ b/src/plugins/projectexplorer/settingsaccessor.h
@@ -50,7 +50,7 @@ public:
Project *project() const;
- QVariantMap restoreSettings() const;
+ QVariantMap restoreSettings(QWidget *parent) const;
bool saveSettings(const QVariantMap &data, QWidget *parent) const;
void addVersionUpgrader(Internal::VersionUpgrader *handler); // Takes ownership of the handler!
@@ -83,8 +83,8 @@ private:
void upgradeSettings(SettingsData &data, int toVersion) const;
- SettingsData readUserSettings() const;
- SettingsData readSharedSettings() const;
+ SettingsData readUserSettings(QWidget *parent) const;
+ SettingsData readSharedSettings(QWidget *parent) const;
SettingsData findBestSettings(const QStringList &candidates) const;
SettingsData mergeSettings(const SettingsData &user, const SettingsData &shared) const;