summaryrefslogtreecommitdiffstats
path: root/src/sdk
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2016-11-10 12:04:17 +0200
committerKatja Marttila <katja.marttila@qt.io>2016-11-15 06:43:54 +0000
commitb5b0a8d2657f874f09f157246a592a270ea78d87 (patch)
tree457e2a0656eee2c40db6da53f63e3810f6a0a9c1 /src/sdk
parente7f93217182233383851a25ae21bd950d05b408a (diff)
Introduces new --silentUpdate command line option
With this feature one can update all installed components silently with maintenancetool by passing --silentUpdate parameter Change-Id: If31d37ce24e794775c2fe47b603259da133c9ee7 Task-number: QTIFW-906 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'src/sdk')
-rw-r--r--src/sdk/commandlineparser.cpp2
-rw-r--r--src/sdk/constants.h1
-rw-r--r--src/sdk/installerbase.cpp72
3 files changed, 44 insertions, 31 deletions
diff --git a/src/sdk/commandlineparser.cpp b/src/sdk/commandlineparser.cpp
index 1dc7ca168..7efdc77c6 100644
--- a/src/sdk/commandlineparser.cpp
+++ b/src/sdk/commandlineparser.cpp
@@ -118,6 +118,8 @@ CommandLineParser::CommandLineParser()
QLatin1String("Installs QtBSP or 7z file. The QtBSP (Board Support Package) file must be a .7z "
"file which contains a valid repository."),
QLatin1String("URI,...")));
+ m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::SilentUpdate),
+ QLatin1String("Updates all packages silently.")));
m_parser.addPositionalArgument(QLatin1String(CommandLineOptions::KeyValue),
QLatin1String("Key Value pair to be set."));
}
diff --git a/src/sdk/constants.h b/src/sdk/constants.h
index 763377a08..7c849135c 100644
--- a/src/sdk/constants.h
+++ b/src/sdk/constants.h
@@ -57,6 +57,7 @@ const char SetTmpRepository[] = "setTempRepository";
const char StartServer[] = "startserver";
const char StartClient[] = "startclient";
const char InstallCompressedRepository[] = "installCompressedRepository";
+const char SilentUpdate[] = "silentUpdate";
} // namespace CommandLineOptions
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp
index ec3a87a8d..e568ad3fa 100644
--- a/src/sdk/installerbase.cpp
+++ b/src/sdk/installerbase.cpp
@@ -282,45 +282,55 @@ int InstallerBase::run()
}
}
- //create the wizard GUI
- TabController controller(0);
- controller.setManager(m_core);
- controller.setManagerParams(params);
- controller.setControlScript(controlScript);
-
- if (m_core->isInstaller()) {
- controller.setGui(new InstallerGui(m_core));
+ //Do not show gui with --silentUpdate, instead update components silently
+ if (parser.isSet(QLatin1String(CommandLineOptions::SilentUpdate))) {
+ if (m_core->isInstaller())
+ throw QInstaller::Error(QLatin1String("Cannot start installer binary as updater."));
+ m_core->setUpdater();
+ m_core->updateComponentsSilently();
}
else {
- controller.setGui(new MaintenanceGui(m_core));
- //Start listening to setValue changes that newly installed components might have
- connect(m_core, &QInstaller::PackageManagerCore::valueChanged, &controller,
- &TabController::updateManagerParams);
- }
- QInstaller::PackageManagerCore::Status status =
- QInstaller::PackageManagerCore::Status(controller.init());
- if (status != QInstaller::PackageManagerCore::Success)
- return status;
+ //create the wizard GUI
+ TabController controller(0);
+ controller.setManager(m_core);
+ controller.setManagerParams(params);
+ controller.setControlScript(controlScript);
+ if (m_core->isInstaller()) {
+ controller.setGui(new InstallerGui(m_core));
+ }
+ else {
+ controller.setGui(new MaintenanceGui(m_core));
+ //Start listening to setValue changes that newly installed components might have
+ connect(m_core, &QInstaller::PackageManagerCore::valueChanged, &controller,
+ &TabController::updateManagerParams);
+ }
- const int result = QCoreApplication::instance()->exec();
- if (result != 0)
- return result;
+ QInstaller::PackageManagerCore::Status status =
+ QInstaller::PackageManagerCore::Status(controller.init());
+ if (status != QInstaller::PackageManagerCore::Success)
+ return status;
- if (m_core->finishedWithSuccess())
- return QInstaller::PackageManagerCore::Success;
+ const int result = QCoreApplication::instance()->exec();
+ if (result != 0)
+ return result;
- status = m_core->status();
- switch (status) {
- case QInstaller::PackageManagerCore::Success:
- return status;
+ if (m_core->finishedWithSuccess())
+ return QInstaller::PackageManagerCore::Success;
- case QInstaller::PackageManagerCore::Canceled:
- return status;
+ status = m_core->status();
+ switch (status) {
+ case QInstaller::PackageManagerCore::Success:
+ return status;
- default:
- break;
+ case QInstaller::PackageManagerCore::Canceled:
+ return status;
+
+ default:
+ break;
+ }
+ return QInstaller::PackageManagerCore::Failure;
}
- return QInstaller::PackageManagerCore::Failure;
+ return QInstaller::PackageManagerCore::Success;
}