summaryrefslogtreecommitdiff
path: root/src/app/qbs-setup-qt
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-05-14 12:20:33 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-06-01 07:19:24 +0000
commit40746dae36452398649481fecad9cdc5f25cc80f (patch)
treec97c73364bdd5dfd3069b7a0b062fcee8ef38182 /src/app/qbs-setup-qt
parent78e19d1f234bb1ba9957c877e57d128f09d1459a (diff)
downloadqbs-40746dae36452398649481fecad9cdc5f25cc80f.tar.gz
Add support for system-level settings
In addition to the traditional per-user settings, there is now also a system-wide settings file affecting all users. The file's platform- specific default location can be overridden at build time. The qbs-config tool can write these settings via the new --system option. [ChangeLog] Introduced the concept of system-level qbs settings Change-Id: Ie6f675a74e96ce1fa7b2dd0712f6106071e848a6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/app/qbs-setup-qt')
-rw-r--r--src/app/qbs-setup-qt/commandlineparser.cpp11
-rw-r--r--src/app/qbs-setup-qt/commandlineparser.h4
-rw-r--r--src/app/qbs-setup-qt/main.cpp1
3 files changed, 12 insertions, 4 deletions
diff --git a/src/app/qbs-setup-qt/commandlineparser.cpp b/src/app/qbs-setup-qt/commandlineparser.cpp
index 2559e0c0b..8444faa77 100644
--- a/src/app/qbs-setup-qt/commandlineparser.cpp
+++ b/src/app/qbs-setup-qt/commandlineparser.cpp
@@ -49,6 +49,7 @@ static QString helpOptionShort() { return QLatin1String("-h"); }
static QString helpOptionLong() { return QLatin1String("--help"); }
static QString detectOption() { return QLatin1String("--detect"); }
static QString settingsDirOption() { return QLatin1String("--settings-dir"); }
+static QString systemOption() { return QLatin1String("--system"); }
void CommandLineParser::parse(const QStringList &commandLine)
{
@@ -73,6 +74,8 @@ void CommandLineParser::parse(const QStringList &commandLine)
m_helpRequested = true;
else if (arg == detectOption())
m_autoDetectionMode = true;
+ else if (arg == systemOption())
+ m_settingsScope = qbs::Settings::SystemScope;
else if (arg == settingsDirOption())
assignOptionArgument(settingsDirOption(), m_settingsDir);
}
@@ -107,10 +110,10 @@ QString CommandLineParser::usageString() const
{
QString s = Tr::tr("This tool creates qbs profiles from Qt versions.\n");
s += Tr::tr("Usage:\n");
- s += Tr::tr(" %1 [%2 <settings directory>] %3\n")
- .arg(m_command, settingsDirOption(), detectOption());
- s += Tr::tr(" %1 [%2 <settings directory>] <path to qmake> <profile name>\n")
- .arg(m_command, settingsDirOption());
+ s += Tr::tr(" %1 [%2 <settings directory>] [%4] %3\n")
+ .arg(m_command, settingsDirOption(), detectOption(), systemOption());
+ s += Tr::tr(" %1 [%2 <settings directory>] [%4] <path to qmake> <profile name>\n")
+ .arg(m_command, settingsDirOption(), systemOption());
s += Tr::tr(" %1 %2|%3\n").arg(m_command, helpOptionShort(), helpOptionLong());
s += Tr::tr("The first form tries to auto-detect all known Qt versions, looking them up "
"via the PATH environment variable.\n");
diff --git a/src/app/qbs-setup-qt/commandlineparser.h b/src/app/qbs-setup-qt/commandlineparser.h
index 8ac1ba44d..a9ecb55c8 100644
--- a/src/app/qbs-setup-qt/commandlineparser.h
+++ b/src/app/qbs-setup-qt/commandlineparser.h
@@ -39,6 +39,8 @@
#ifndef QBS_SETUPTOOLCHAINS_COMMANDLINEPARSER_H
#define QBS_SETUPTOOLCHAINS_COMMANDLINEPARSER_H
+#include <tools/settings.h>
+
#include <QtCore/qstringlist.h>
class CommandLineParser
@@ -52,6 +54,7 @@ public:
QString qmakePath() const { return m_qmakePath; }
QString profileName() const { return m_profileName; }
QString settingsDir() const { return m_settingsDir; }
+ qbs::Settings::Scope settingsScope() const { return m_settingsScope; }
QString usageString() const;
@@ -62,6 +65,7 @@ private:
bool m_helpRequested;
bool m_autoDetectionMode;
+ qbs::Settings::Scope m_settingsScope = qbs::Settings::UserScope;
QString m_qmakePath;
QString m_profileName;
QString m_settingsDir;
diff --git a/src/app/qbs-setup-qt/main.cpp b/src/app/qbs-setup-qt/main.cpp
index 55ec80582..d1bfd9614 100644
--- a/src/app/qbs-setup-qt/main.cpp
+++ b/src/app/qbs-setup-qt/main.cpp
@@ -68,6 +68,7 @@ int main(int argc, char *argv[])
}
Settings settings(clParser.settingsDir());
+ settings.setScopeForWriting(clParser.settingsScope());
if (clParser.autoDetectionMode()) {
// search all Qt's in path and dump their settings