summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2020-05-15 10:51:37 +0300
committerKatja Marttila <katja.marttila@qt.io>2020-05-26 08:38:42 +0300
commit0fcfdebf88372d527008ff0a080bf0f9eb493c9a (patch)
treedd4daaec97ff27ea00d57122d41ab4823643f456 /src
parent298fd64d3ddbe6de3607b51c4b71b221de07ce2a (diff)
Add new no-default-installations option
This option can be used both from CLI and from GUI. Option will overwrite Default true in component.xml, which means that in GUI the components are not selected by default, and in CLI the components are not installed unless those are given as argument to install -command. Task-number:QTIFW-1630 Change-Id: I5dc16b14fc136f421980a55bb5fc6a74213309dc Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/commandlineparser.cpp3
-rw-r--r--src/libs/installer/component.cpp9
-rw-r--r--src/libs/installer/component.h2
-rw-r--r--src/libs/installer/constants.h1
-rw-r--r--src/libs/installer/packagemanagercore.cpp21
-rw-r--r--src/libs/installer/packagemanagercore.h3
-rw-r--r--src/sdk/sdkapp.h2
7 files changed, 38 insertions, 3 deletions
diff --git a/src/libs/installer/commandlineparser.cpp b/src/libs/installer/commandlineparser.cpp
index bf40c9bc0..60b02c3ae 100644
--- a/src/libs/installer/commandlineparser.cpp
+++ b/src/libs/installer/commandlineparser.cpp
@@ -130,6 +130,9 @@ CommandLineParser::CommandLineParser()
<< CommandLineOptions::scNoForceInstallationShort << CommandLineOptions::scNoForceInstallationLong,
QLatin1String("Allow deselecting components that are marked as forced.")));
m_parser.addOption(QCommandLineOption(QStringList()
+ << CommandLineOptions::scNoDefaultInstallationLong,
+ QLatin1String("Deselects components that are marked as default.")));
+ m_parser.addOption(QCommandLineOption(QStringList()
<< CommandLineOptions::scNoSizeCheckingShort << CommandLineOptions::scNoSizeCheckingLong,
QLatin1String("Disable checking of free space for installation target.")));
m_parser.addOption(QCommandLineOption(QStringList()
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index 60ec9ae9f..389580e7c 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -305,7 +305,12 @@ void Component::loadDataFromPackage(const Package &package)
setValue(scName, package.data(scName).toString());
setValue(scDisplayName, package.data(scDisplayName).toString());
setValue(scDescription, package.data(scDescription).toString());
- setValue(scDefault, package.data(scDefault).toString());
+
+ QString isDefault = package.data(scDefault, scFalse).toString().toLower();
+ if (PackageManagerCore::noDefaultInstallation())
+ isDefault = scFalse;
+ setValue(scDefault, isDefault);
+
setValue(scAutoDependOn, package.data(scAutoDependOn).toString());
setValue(scCompressedSize, package.data(scCompressedSize).toString());
setValue(scUncompressedSize, package.data(scUncompressedSize).toString());
diff --git a/src/libs/installer/component.h b/src/libs/installer/component.h
index 6dafd61b2..3cb259bd1 100644
--- a/src/libs/installer/component.h
+++ b/src/libs/installer/component.h
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
diff --git a/src/libs/installer/constants.h b/src/libs/installer/constants.h
index 58660482c..fecba0e6c 100644
--- a/src/libs/installer/constants.h
+++ b/src/libs/installer/constants.h
@@ -174,6 +174,7 @@ static const QLatin1String scInstallCompressedRepositoryShort("i");
static const QLatin1String scInstallCompressedRepositoryLong("install-compressed-repository");
static const QLatin1String scCreateLocalRepositoryShort("c");
static const QLatin1String scCreateLocalRepositoryLong("create-local-repository");
+static const QLatin1String scNoDefaultInstallationLong("no-default-installations");
// Developer options
static const QLatin1String scScriptShort("s");
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index d1a9c6351..2287e5a73 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -412,6 +412,7 @@ static QFont *sVirtualComponentsFont = nullptr;
Q_GLOBAL_STATIC(QMutex, globalVirtualComponentsFontMutex);
static bool sNoForceInstallation = false;
+static bool sNoDefaultInstallation = false;
static bool sVirtualComponentsVisible = false;
static bool sCreateLocalRepositoryFromBinary = false;
@@ -1248,6 +1249,26 @@ void PackageManagerCore::setNoForceInstallation(bool value)
/* static */
/*!
+ Returns \c true if components are not selected by default although
+ \c <Default> element is set in the package information file.
+*/
+bool PackageManagerCore::noDefaultInstallation()
+{
+ return sNoDefaultInstallation;
+}
+
+/* static */
+/*!
+ Overwrites the value specified for the component in the \c <Default>
+ element in the package information file with \a value. Setting \a value
+ to \c true unselects the components.
+*/
+void PackageManagerCore::setNoDefaultInstallation(bool value)
+{
+ sNoDefaultInstallation = value;
+}
+/* static */
+/*!
Returns \c true if a local repository should be created from binary content.
*/
bool PackageManagerCore::createLocalRepositoryFromBinary()
diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h
index 9e24b5c0a..67e7d6365 100644
--- a/src/libs/installer/packagemanagercore.h
+++ b/src/libs/installer/packagemanagercore.h
@@ -110,6 +110,9 @@ public:
static bool noForceInstallation();
static void setNoForceInstallation(bool value);
+ static bool noDefaultInstallation();
+ static void setNoDefaultInstallation(bool value);
+
static bool createLocalRepositoryFromBinary();
static void setCreateLocalRepositoryFromBinary(bool create);
diff --git a/src/sdk/sdkapp.h b/src/sdk/sdkapp.h
index dc4641f24..ecaee3758 100644
--- a/src/sdk/sdkapp.h
+++ b/src/sdk/sdkapp.h
@@ -265,6 +265,8 @@ public:
QInstaller::PackageManagerCore::setNoForceInstallation(m_parser
.isSet(CommandLineOptions::scNoForceInstallationLong));
+ QInstaller::PackageManagerCore::setNoDefaultInstallation(m_parser
+ .isSet(CommandLineOptions::scNoDefaultInstallationLong));
QInstaller::PackageManagerCore::setCreateLocalRepositoryFromBinary(m_parser
.isSet(CommandLineOptions::scCreateLocalRepositoryLong)
|| m_core->settings().createLocalRepository());