diff options
author | Katja Marttila <katja.marttila@qt.io> | 2019-05-31 13:30:18 +0300 |
---|---|---|
committer | Iikka Eklund <iikka.eklund@qt.io> | 2019-12-04 12:11:59 +0000 |
commit | 0842ea01554202b4552911c827417acb00a03cf1 (patch) | |
tree | 8633ef3e268a2f0064f0051755bd2e0d7ec6eb04 /src/sdk/installerbase.cpp | |
parent | f8ade64515482e2079fde805b93ee11e3dae44f5 (diff) |
Install selected packages from CLI
Also move targetDirWarning() from targetdirectorypage to packagemanager
and move target directory check to checkTargetDir() function
so that those are accessible also without UI.
Change-Id: Ia38cc7e66bb542e6a60fea2c39cc3b80735564ef
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'src/sdk/installerbase.cpp')
-rw-r--r-- | src/sdk/installerbase.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index 09cc547d2..e32b4f127 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -341,6 +341,33 @@ int InstallerBase::run() if (!value.isEmpty()) packages = value.split(QLatin1Char(','), QString::SkipEmptyParts); m_core->updateComponentsSilently(packages); + } else if (parser.isSet(QLatin1String(CommandLineOptions::InstallPackages))) { + checkLicense(); + m_core->autoRejectMessageBoxes(); + if (m_core->isInstaller()) { + if (parser.isSet(QLatin1String(CommandLineOptions::TargetDir))) { + const QString &value = parser.value(QLatin1String(CommandLineOptions::TargetDir)); + if (m_core->checkTargetDir(value)) { + QString targetDirWarning = m_core->targetDirWarning(value); + if (!targetDirWarning.isEmpty()) { + qDebug() << m_core->targetDirWarning(value); + return EXIT_FAILURE; + } + m_core->setValue(QLatin1String("TargetDir"), value); + } else { + return EXIT_FAILURE; + } + } else { + qWarning() << "Please specify target directory."; + return EXIT_FAILURE; + } + } + + QStringList packages; + const QString &value = parser.value(QLatin1String(CommandLineOptions::InstallPackages)); + if (!value.isEmpty()) + packages = value.split(QLatin1Char(','), QString::SkipEmptyParts); + m_core->installSelectedComponentsSilently(packages); } else { //create the wizard GUI TabController controller(nullptr); |