diff options
author | Katja Marttila <katja.marttila@qt.io> | 2016-11-10 12:04:17 +0200 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2016-11-15 06:43:54 +0000 |
commit | b5b0a8d2657f874f09f157246a592a270ea78d87 (patch) | |
tree | 457e2a0656eee2c40db6da53f63e3810f6a0a9c1 /src/sdk/installerbase.cpp | |
parent | e7f93217182233383851a25ae21bd950d05b408a (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/installerbase.cpp')
-rw-r--r-- | src/sdk/installerbase.cpp | 72 |
1 files changed, 41 insertions, 31 deletions
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; } |