ProjectExplorer: Do not depend on app_version.h in settingsaccessor

Change-Id: I673a1946ecfc9ef7e60eeae549eff7e08741d756
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2017-11-15 16:15:20 +01:00
parent cf5d926221
commit 94e818dc82
3 changed files with 11 additions and 9 deletions

View File

@@ -25,8 +25,6 @@
#include "settingsaccessor.h" #include "settingsaccessor.h"
#include <app/app_version.h>
#include <utils/persistentsettings.h> #include <utils/persistentsettings.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -117,6 +115,7 @@ public:
std::unique_ptr<PersistentSettingsWriter> m_writer; std::unique_ptr<PersistentSettingsWriter> m_writer;
QByteArray m_settingsId; QByteArray m_settingsId;
QString m_displayName; QString m_displayName;
QString m_applicationDisplayName;
QString m_userSuffix; QString m_userSuffix;
QString m_sharedSuffix; QString m_sharedSuffix;
@@ -448,7 +447,7 @@ SettingsAccessor::IssueInfo SettingsAccessor::findIssues(const QVariantMap &data
"version of %2 was used are ignored, and " "version of %2 was used are ignored, and "
"changes made now will <b>not</b> be propagated to " "changes made now will <b>not</b> be propagated to "
"the newer version.</p>").arg(path.toUserOutput()) "the newer version.</p>").arg(path.toUserOutput())
.arg(Core::Constants::IDE_DISPLAY_NAME); .arg(d->m_applicationDisplayName);
result.buttons.insert(QMessageBox::Ok, Continue); result.buttons.insert(QMessageBox::Ok, Continue);
} }
@@ -464,7 +463,7 @@ SettingsAccessor::IssueInfo SettingsAccessor::findIssues(const QVariantMap &data
"<p>Did you work with this project on another machine or " "<p>Did you work with this project on another machine or "
"using a different settings path before?</p>" "using a different settings path before?</p>"
"<p>Do you still want to load the settings file \"%2\"?</p>") "<p>Do you still want to load the settings file \"%2\"?</p>")
.arg(Core::Constants::IDE_DISPLAY_NAME) .arg(d->m_applicationDisplayName)
.arg(path.toUserOutput()); .arg(path.toUserOutput());
result.defaultButton = QMessageBox::No; result.defaultButton = QMessageBox::No;
result.escapeButton = QMessageBox::No; result.escapeButton = QMessageBox::No;
@@ -596,6 +595,11 @@ void SettingsAccessor::setDisplayName(const QString &dn)
d->m_displayName = dn; d->m_displayName = dn;
} }
void SettingsAccessor::setApplicationDisplayName(const QString &dn)
{
d->m_applicationDisplayName = dn;
}
/* Will always return the default name first (if applicable) */ /* Will always return the default name first (if applicable) */
FileNameList SettingsAccessor::settingsFiles(const QString &suffix) const FileNameList SettingsAccessor::settingsFiles(const QString &suffix) const
{ {
@@ -721,7 +725,7 @@ QVariantMap SettingsAccessor::readSharedSettings(QWidget *parent) const
"The version of your .shared file is not " "The version of your .shared file is not "
"supported by %1. " "supported by %1. "
"Do you want to try loading it anyway?") "Do you want to try loading it anyway?")
.arg(Core::Constants::IDE_DISPLAY_NAME), .arg(d->m_applicationDisplayName),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes | QMessageBox::No,
parent); parent);
msgBox.setDefaultButton(QMessageBox::No); msgBox.setDefaultButton(QMessageBox::No);

View File

@@ -112,6 +112,7 @@ public:
protected: protected:
void setSettingsId(const QByteArray &id); void setSettingsId(const QByteArray &id);
void setDisplayName(const QString &dn); void setDisplayName(const QString &dn);
void setApplicationDisplayName(const QString &dn);
QVariantMap readFile(const Utils::FileName &path) const; QVariantMap readFile(const Utils::FileName &path) const;
QVariantMap upgradeSettings(const QVariantMap &data) const; QVariantMap upgradeSettings(const QVariantMap &data) const;

View File

@@ -42,10 +42,6 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <QApplication>
#include <QDir>
#include <QRegExp>
using namespace Utils; using namespace Utils;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal; using namespace ProjectExplorer::Internal;
@@ -357,6 +353,7 @@ UserFileAccessor::UserFileAccessor(Project *project) :
{ {
setSettingsId(ProjectExplorerPlugin::projectExplorerSettings().environmentId.toByteArray()); setSettingsId(ProjectExplorerPlugin::projectExplorerSettings().environmentId.toByteArray());
setDisplayName(project->displayName()); setDisplayName(project->displayName());
setApplicationDisplayName(Core::Constants::IDE_DISPLAY_NAME);
// Register Upgraders: // Register Upgraders:
addVersionUpgrader(std::make_unique<UserFileVersion1Upgrader>(this)); addVersionUpgrader(std::make_unique<UserFileVersion1Upgrader>(this));