aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/config/configcommandexecutor.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2021-04-09 11:31:07 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2021-04-09 12:39:14 +0000
commit001bf31623c02ba8249dd066777d014d546eb7f9 (patch)
tree2a4dbf4eda5ca322441fc943111b229e54342932 /src/app/config/configcommandexecutor.cpp
parent8de1becd8e240512ada3e529c6c7bb16599dca2c (diff)
qbs-config: Add convenience command for adding a profile in one go
Task-number: QTCREATORBUG-25463 Change-Id: I2d18ea5f7d53efc0762d34cf4845b49533ca6fbf Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'src/app/config/configcommandexecutor.cpp')
-rw-r--r--src/app/config/configcommandexecutor.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/app/config/configcommandexecutor.cpp b/src/app/config/configcommandexecutor.cpp
index 0a6883aa7..a01058b11 100644
--- a/src/app/config/configcommandexecutor.cpp
+++ b/src/app/config/configcommandexecutor.cpp
@@ -42,6 +42,7 @@
#include "../shared/logging/consolelogger.h"
#include <tools/error.h>
+#include <tools/profile.h>
#include <tools/qttools.h>
#include <tools/settingsrepresentation.h>
@@ -73,6 +74,17 @@ void ConfigCommandExecutor::execute(const ConfigCommand &command)
for (const QString &varName : command.varNames)
m_settings->remove(varName);
break;
+ case ConfigCommand::CfgAddProfile: {
+ Profile profile(command.varValue, m_settings);
+ profile.removeProfile();
+ Q_ASSERT(command.varNames.size() % 2 == 0);
+ for (int i = 0; i < command.varNames.size(); i += 2) {
+ const QString &key = command.varNames.at(i);
+ const QString &rawValue = command.varNames.at(i + 1);
+ profile.setValue(key, representationToSettingsValue(rawValue));
+ }
+ break;
+ }
case ConfigCommand::CfgExport:
exportSettings(command.fileName);
break;