summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer/userfileaccessor.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-07-30 13:10:38 +0200
committerhjk <hjk@qt.io>2018-08-21 08:00:46 +0000
commit98f3b961c6f0f50612cf94ccac4476a93ded3135 (patch)
tree2e18b3a73c720040cfd5e5af1475ee323cf16185 /src/plugins/projectexplorer/userfileaccessor.cpp
parent9f9c72302f60a872d15c5dd1ffa900961dad9014 (diff)
downloadqt-creator-98f3b961c6f0f50612cf94ccac4476a93ded3135.tar.gz
Unify key names for various fields in stored RunConfigurations
This replaces various versions of the key name of the arguments, working directory, use terminal and use dyld image suffix fields by unified versions ("RunConfiguration.Arguments", "RunConfiguration.WorkingDirectory", "RunConfiguration.UseTerminal", "RunConfiguration.UseDyldImageSuffix"). The different names for the fields are technically not needed (as proven by several cases that already now used the same key), partially outdated ("Qt4ProjectManager.MaemoRunConfiguration.Arguments") make RunConfiguration constructors less uniform and more complex than needed. The "RunConfiguration." prefix in the new names is not needed, but used by several other settings, so having it there looks more uniform now. In (the unexpected case) that different keys would ever be necessary, the default key name could still be overridden by using setSettingsKey from user code. Change-Id: Ifb74ad74e0a9c724c8bf5e71e1bb2424d5d1831b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/userfileaccessor.cpp')
-rw-r--r--src/plugins/projectexplorer/userfileaccessor.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/userfileaccessor.cpp b/src/plugins/projectexplorer/userfileaccessor.cpp
index 84080445c4..a20000ea79 100644
--- a/src/plugins/projectexplorer/userfileaccessor.cpp
+++ b/src/plugins/projectexplorer/userfileaccessor.cpp
@@ -122,6 +122,17 @@ public:
static QVariant process(const QVariant &entry);
};
+// Version 19 makes arguments, working directory and run-in-terminal
+// run configuration fields use the same key in the settings file.
+class UserFileVersion19Upgrader : public VersionUpgrader
+{
+public:
+ UserFileVersion19Upgrader() : VersionUpgrader(19, "4.8-pre2") { }
+ QVariantMap upgrade(const QVariantMap &map) final;
+
+ static QVariant process(const QVariant &entry, const QStringList &path);
+};
+
} // namespace
//
@@ -322,6 +333,7 @@ UserFileAccessor::UserFileAccessor(Project *project) :
addVersionUpgrader(std::make_unique<UserFileVersion16Upgrader>());
addVersionUpgrader(std::make_unique<UserFileVersion17Upgrader>());
addVersionUpgrader(std::make_unique<UserFileVersion18Upgrader>());
+ addVersionUpgrader(std::make_unique<UserFileVersion19Upgrader>());
}
Project *UserFileAccessor::project() const
@@ -773,6 +785,71 @@ QVariant UserFileVersion18Upgrader::process(const QVariant &entry)
}
}
+QVariantMap UserFileVersion19Upgrader::upgrade(const QVariantMap &map)
+{
+ return process(map, QStringList()).toMap();
+}
+
+QVariant UserFileVersion19Upgrader::process(const QVariant &entry, const QStringList &path)
+{
+ static const QStringList argsKeys = {"Qt4ProjectManager.MaemoRunConfiguration.Arguments",
+ "CMakeProjectManager.CMakeRunConfiguration.Arguments",
+ "Ios.run_arguments",
+ "Nim.NimRunConfiguration.ArgumentAspect",
+ "ProjectExplorer.CustomExecutableRunConfiguration.Arguments",
+ "PythonEditor.RunConfiguration.Arguments",
+ "Qbs.RunConfiguration.CommandLineArguments",
+ "Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments",
+ "RemoteLinux.CustomRunConfig.Arguments",
+ "WinRtRunConfigurationArgumentsId",
+ "CommandLineArgs"};
+ static const QStringList wdKeys = {"BareMetal.RunConfig.WorkingDirectory",
+ "CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory",
+ "Nim.NimRunConfiguration.WorkingDirectoryAspect",
+ "ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory",
+ "Qbs.RunConfiguration.WorkingDirectory",
+ "Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory",
+ "RemoteLinux.CustomRunConfig.WorkingDirectory"
+ "RemoteLinux.RunConfig.WorkingDirectory",
+ "WorkingDir"};
+ static const QStringList termKeys = {"CMakeProjectManager.CMakeRunConfiguration.UseTerminal",
+ "Nim.NimRunConfiguration.TerminalAspect",
+ "ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal",
+ "PythonEditor.RunConfiguration.UseTerminal",
+ "Qbs.RunConfiguration.UseTerminal",
+ "Qt4ProjectManager.Qt4RunConfiguration.UseTerminal"};
+ static const QStringList libsKeys = {"Qbs.RunConfiguration.UsingLibraryPaths",
+ "QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath"};
+ static const QStringList dyldKeys = {"Qbs.RunConfiguration.UseDyldImageSuffix",
+ "QmakeProjectManager.QmakeRunConfiguration.UseDyldImageSuffix"};
+ switch (entry.type()) {
+ case QVariant::List:
+ return Utils::transform(entry.toList(),
+ std::bind(&UserFileVersion19Upgrader::process, std::placeholders::_1, path));
+ case QVariant::Map:
+ return Utils::transform<QVariantMap>(
+ entry.toMap().toStdMap(), [&](const std::pair<const QString, QVariant> &item) {
+ if (path.size() == 2 && path.at(1).startsWith("ProjectExplorer.Target.RunConfiguration.")) {
+ if (argsKeys.contains(item.first))
+ return qMakePair(QString("RunConfiguration.Arguments"), item.second);
+ if (wdKeys.contains(item.first))
+ return qMakePair(QString("RunConfiguration.WorkingDirectory"), item.second);
+ if (termKeys.contains(item.first))
+ return qMakePair(QString("RunConfiguration.UseTerminal"), item.second);
+ if (libsKeys.contains(item.first))
+ return qMakePair(QString("RunConfiguration.UseLibrarySearchPath"), item.second);
+ if (dyldKeys.contains(item.first))
+ return qMakePair(QString("RunConfiguration.UseDyldImageSuffix"), item.second);
+ }
+ QStringList newPath = path;
+ newPath.append(item.first);
+ return qMakePair(item.first, UserFileVersion19Upgrader::process(item.second, newPath));
+ });
+ default:
+ return entry;
+ }
+}
+
#if defined(WITH_TESTS)
#include <QTest>