From c82f0912f653d99527eeaf6f23e2f307160ca268 Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 6 Jul 2011 13:01:38 +0200 Subject: Fix problem with showing wrong progress. Fake! :) --- .../libinstaller/packagemanagercore.cpp | 3 --- .../libinstaller/packagemanagercore_p.cpp | 22 +++++++++------------- .../libinstaller/performinstallationform.cpp | 2 +- 3 files changed, 10 insertions(+), 17 deletions(-) (limited to 'installerbuilder') diff --git a/installerbuilder/libinstaller/packagemanagercore.cpp b/installerbuilder/libinstaller/packagemanagercore.cpp index 27701aa72..467e11e54 100644 --- a/installerbuilder/libinstaller/packagemanagercore.cpp +++ b/installerbuilder/libinstaller/packagemanagercore.cpp @@ -552,9 +552,6 @@ void PackageManagerCore::rollBackInstallation() "error happend.")); } } - - if (ProgressCoordinator::instance()->progressInPercentage() < 100) - ProgressCoordinator::instance()->partProgressChanged(0.99); packages.writeToDisk(); } diff --git a/installerbuilder/libinstaller/packagemanagercore_p.cpp b/installerbuilder/libinstaller/packagemanagercore_p.cpp index efe145d6c..2755bf2b6 100644 --- a/installerbuilder/libinstaller/packagemanagercore_p.cpp +++ b/installerbuilder/libinstaller/packagemanagercore_p.cpp @@ -1078,10 +1078,10 @@ void PackageManagerCorePrivate::runInstaller() writeUninstaller(m_performedOperationsOld + m_performedOperationsCurrentSession); registerUninstaller(); - // this is the reserved one from the beginning - ProgressCoordinator::instance()->addManualPercentagePoints(1); - if (ProgressCoordinator::instance()->progressInPercentage() < 100) - ProgressCoordinator::instance()->partProgressChanged(0.99); + // fake a possible wrong value to show a full progress bar + const int progress = ProgressCoordinator::instance()->progressInPercentage(); + if (progress < 100) + ProgressCoordinator::instance()->addManualPercentagePoints(100 - progress); ProgressCoordinator::instance()->emitLabelAndDetailTextChanged(tr("\nInstallation finished!")); if (adminRightsGained) @@ -1220,10 +1220,10 @@ void PackageManagerCorePrivate::runPackageUpdater() commitSessionOperations(); //end session, move ops to "old" m_needToWriteUninstaller = true; - //this is the reserved one from the beginning - ProgressCoordinator::instance()->addManualPercentagePoints(1); - if (ProgressCoordinator::instance()->progressInPercentage() < 100) - ProgressCoordinator::instance()->partProgressChanged(0.99); + // fake a possible wrong value to show a full progress bar + const int progress = ProgressCoordinator::instance()->progressInPercentage(); + if (progress < 100) + ProgressCoordinator::instance()->addManualPercentagePoints(100 - progress); ProgressCoordinator::instance()->emitLabelAndDetailTextChanged(tr("\nUpdate finished!")); if (adminRightsGained) @@ -1330,7 +1330,7 @@ void PackageManagerCorePrivate::runUninstaller() ProgressCoordinator::instance()->emitLabelAndDetailTextChanged(tr("\nDeinstallation aborted!")); if (adminRightsGained) m_core->dropAdminRights(); - emit installationFinished(); + emit uninstallationFinished(); throw; } @@ -1391,10 +1391,6 @@ void PackageManagerCorePrivate::installComponent(Component *component, double pr // fails or if this operation failed but still needs an undo call to cleanup. addPerformed(operation); operation->setValue(QLatin1String("component"), component->name()); - // Add the progress operation size to the progress coordinator, so we will show the right - // progress at the end of the install/ update after we had an ignore error. - if (ignoreError) - ProgressCoordinator::instance()->partProgressChanged(progressOperationSize); } if (becameAdmin) diff --git a/installerbuilder/libinstaller/performinstallationform.cpp b/installerbuilder/libinstaller/performinstallationform.cpp index ce1bdc28b..c1ba65a93 100644 --- a/installerbuilder/libinstaller/performinstallationform.cpp +++ b/installerbuilder/libinstaller/performinstallationform.cpp @@ -122,7 +122,7 @@ void PerformInstallationForm::updateProgress() QInstaller::ProgressCoordinator *progressCoordninator = QInstaller::ProgressCoordinator::instance(); const int progressPercentage = progressCoordninator->progressInPercentage(); - m_progressBar->setRange(0, (progressPercentage == 0) ? 0 : 100); + m_progressBar->setRange(0, 100); m_progressBar->setValue(progressPercentage); m_progressLabel->setText(progressCoordninator->labelText()); } -- cgit v1.2.3