forked from qt-creator/qt-creator
Move SettingsAccessor from ProjectExplorer into Utils
Change-Id: I83e9d7ef81f8c0af7220ce2777723db53ef2e02a Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2017 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of Qt Creator.
|
** This file is part of Qt Creator.
|
||||||
@@ -25,16 +25,14 @@
|
|||||||
|
|
||||||
#include "settingsaccessor.h"
|
#include "settingsaccessor.h"
|
||||||
|
|
||||||
#include <utils/persistentsettings.h>
|
#include "persistentsettings.h"
|
||||||
#include <utils/qtcassert.h>
|
#include "qtcassert.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
|
|
||||||
using namespace Utils;
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const char ORIGINAL_VERSION_KEY[] = "OriginalVersion";
|
const char ORIGINAL_VERSION_KEY[] = "OriginalVersion";
|
||||||
@@ -55,7 +53,7 @@ static QString generateSuffix(const QString &alt1, const QString &alt2)
|
|||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace Utils {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Performs a simple renaming of the listed keys in \a changes recursively on \a map.
|
* Performs a simple renaming of the listed keys in \a changes recursively on \a map.
|
||||||
@@ -457,7 +455,7 @@ SettingsAccessor::IssueInfo SettingsAccessor::findIssues(const QVariantMap &data
|
|||||||
QByteArray readId = settingsIdFromMap(data);
|
QByteArray readId = settingsIdFromMap(data);
|
||||||
if (!readId.isEmpty() && readId != settingsId()) {
|
if (!readId.isEmpty() && readId != settingsId()) {
|
||||||
result.title = differentEnvironmentMsg(d->m_displayName);
|
result.title = differentEnvironmentMsg(d->m_displayName);
|
||||||
result.message = QApplication::translate("ProjectExplorer::EnvironmentIdAccessor",
|
result.message = QApplication::translate("Utils::EnvironmentIdAccessor",
|
||||||
"<p>No .user settings file created by this instance "
|
"<p>No .user settings file created by this instance "
|
||||||
"of %1 was found.</p>"
|
"of %1 was found.</p>"
|
||||||
"<p>Did you work with this project on another machine or "
|
"<p>Did you work with this project on another machine or "
|
||||||
@@ -485,7 +483,7 @@ QVariant SettingsAccessor::retrieveSharedSettings() const
|
|||||||
|
|
||||||
QString SettingsAccessor::differentEnvironmentMsg(const QString &projectName)
|
QString SettingsAccessor::differentEnvironmentMsg(const QString &projectName)
|
||||||
{
|
{
|
||||||
return QApplication::translate("ProjectExplorer::EnvironmentIdAccessor",
|
return QApplication::translate("Utils::EnvironmentIdAccessor",
|
||||||
"Settings File for \"%1\" from a different Environment?")
|
"Settings File for \"%1\" from a different Environment?")
|
||||||
.arg(projectName);
|
.arg(projectName);
|
||||||
}
|
}
|
||||||
@@ -719,9 +717,9 @@ QVariantMap SettingsAccessor::readSharedSettings(QWidget *parent) const
|
|||||||
|
|
||||||
QMessageBox msgBox(
|
QMessageBox msgBox(
|
||||||
QMessageBox::Question,
|
QMessageBox::Question,
|
||||||
QApplication::translate("ProjectExplorer::SettingsAccessor",
|
QApplication::translate("Utils::SettingsAccessor",
|
||||||
"Unsupported Shared Settings File"),
|
"Unsupported Shared Settings File"),
|
||||||
QApplication::translate("ProjectExplorer::SettingsAccessor",
|
QApplication::translate("Utils::SettingsAccessor",
|
||||||
"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?")
|
||||||
@@ -796,4 +794,4 @@ QVariantMap SettingsAccessor::readFile(const FileName &path) const
|
|||||||
return prepareSettings(reader.restoreValues());
|
return prepareSettings(reader.restoreValues());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace Utils
|
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2017 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of Qt Creator.
|
** This file is part of Qt Creator.
|
||||||
@@ -25,19 +25,21 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include "utils_global.h"
|
||||||
|
|
||||||
|
#include "fileutils.h"
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace Utils {
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// VersionUpgrader:
|
// VersionUpgrader:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// Handles updating a QVariantMap from version() - 1 to version()
|
// Handles updating a QVariantMap from version() - 1 to version()
|
||||||
class VersionUpgrader
|
class QTCREATOR_UTILS_EXPORT VersionUpgrader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~VersionUpgrader() = default;
|
virtual ~VersionUpgrader() = default;
|
||||||
@@ -54,7 +56,7 @@ protected:
|
|||||||
|
|
||||||
class SettingsAccessorPrivate;
|
class SettingsAccessorPrivate;
|
||||||
|
|
||||||
class SettingsAccessor
|
class QTCREATOR_UTILS_EXPORT SettingsAccessor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit SettingsAccessor(const Utils::FileName &baseFile);
|
explicit SettingsAccessor(const Utils::FileName &baseFile);
|
||||||
@@ -149,4 +151,4 @@ private:
|
|||||||
friend class SettingsAccessorPrivate;
|
friend class SettingsAccessorPrivate;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace Utils
|
@@ -28,6 +28,7 @@ SOURCES += \
|
|||||||
$$PWD/environmentdialog.cpp \
|
$$PWD/environmentdialog.cpp \
|
||||||
$$PWD/qtcprocess.cpp \
|
$$PWD/qtcprocess.cpp \
|
||||||
$$PWD/reloadpromptutils.cpp \
|
$$PWD/reloadpromptutils.cpp \
|
||||||
|
$$PWD/settingsaccessor.cpp \
|
||||||
$$PWD/shellcommand.cpp \
|
$$PWD/shellcommand.cpp \
|
||||||
$$PWD/shellcommandpage.cpp \
|
$$PWD/shellcommandpage.cpp \
|
||||||
$$PWD/settingsselector.cpp \
|
$$PWD/settingsselector.cpp \
|
||||||
@@ -132,6 +133,7 @@ HEADERS += \
|
|||||||
$$PWD/qtcprocess.h \
|
$$PWD/qtcprocess.h \
|
||||||
$$PWD/utils_global.h \
|
$$PWD/utils_global.h \
|
||||||
$$PWD/reloadpromptutils.h \
|
$$PWD/reloadpromptutils.h \
|
||||||
|
$$PWD/settingsaccessor.h \
|
||||||
$$PWD/settingsselector.h \
|
$$PWD/settingsselector.h \
|
||||||
$$PWD/shellcommand.h \
|
$$PWD/shellcommand.h \
|
||||||
$$PWD/shellcommandpage.h \
|
$$PWD/shellcommandpage.h \
|
||||||
|
@@ -198,6 +198,8 @@ Project {
|
|||||||
"savefile.cpp",
|
"savefile.cpp",
|
||||||
"savefile.h",
|
"savefile.h",
|
||||||
"scopedswap.h",
|
"scopedswap.h",
|
||||||
|
"settingsaccessor.cpp",
|
||||||
|
"settingsaccessor.h",
|
||||||
"settingsselector.cpp",
|
"settingsselector.cpp",
|
||||||
"settingsselector.h",
|
"settingsselector.h",
|
||||||
"settingsutils.h",
|
"settingsutils.h",
|
||||||
|
@@ -103,7 +103,6 @@ HEADERS += projectexplorer.h \
|
|||||||
gcctoolchainfactories.h \
|
gcctoolchainfactories.h \
|
||||||
appoutputpane.h \
|
appoutputpane.h \
|
||||||
codestylesettingspropertiespage.h \
|
codestylesettingspropertiespage.h \
|
||||||
settingsaccessor.h \
|
|
||||||
deployablefile.h \
|
deployablefile.h \
|
||||||
devicesupport/idevice.h \
|
devicesupport/idevice.h \
|
||||||
devicesupport/desktopdevice.h \
|
devicesupport/desktopdevice.h \
|
||||||
@@ -245,7 +244,6 @@ SOURCES += projectexplorer.cpp \
|
|||||||
processparameters.cpp \
|
processparameters.cpp \
|
||||||
appoutputpane.cpp \
|
appoutputpane.cpp \
|
||||||
codestylesettingspropertiespage.cpp \
|
codestylesettingspropertiespage.cpp \
|
||||||
settingsaccessor.cpp \
|
|
||||||
devicesupport/idevice.cpp \
|
devicesupport/idevice.cpp \
|
||||||
devicesupport/desktopdevice.cpp \
|
devicesupport/desktopdevice.cpp \
|
||||||
devicesupport/desktopdevicefactory.cpp \
|
devicesupport/desktopdevicefactory.cpp \
|
||||||
|
@@ -131,7 +131,6 @@ Project {
|
|||||||
"sessionmodel.cpp", "sessionmodel.h",
|
"sessionmodel.cpp", "sessionmodel.h",
|
||||||
"sessionview.cpp", "sessionview.h",
|
"sessionview.cpp", "sessionview.h",
|
||||||
"sessiondialog.cpp", "sessiondialog.h", "sessiondialog.ui",
|
"sessiondialog.cpp", "sessiondialog.h", "sessiondialog.ui",
|
||||||
"settingsaccessor.cpp", "settingsaccessor.h",
|
|
||||||
"showineditortaskhandler.cpp", "showineditortaskhandler.h",
|
"showineditortaskhandler.cpp", "showineditortaskhandler.h",
|
||||||
"showoutputtaskhandler.cpp", "showoutputtaskhandler.h",
|
"showoutputtaskhandler.cpp", "showoutputtaskhandler.h",
|
||||||
"subscription.cpp", "subscription.h",
|
"subscription.cpp", "subscription.h",
|
||||||
|
@@ -25,9 +25,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "settingsaccessor.h"
|
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/settingsaccessor.h>
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
@@ -38,7 +37,7 @@ namespace ProjectExplorer {
|
|||||||
class Project;
|
class Project;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class UserFileAccessor : public SettingsAccessor
|
class UserFileAccessor : public Utils::SettingsAccessor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UserFileAccessor(Project *project);
|
UserFileAccessor(Project *project);
|
||||||
|
Reference in New Issue
Block a user