summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Riddell <jr@jriddell.org>2016-09-26 16:04:28 (GMT)
committerJonathan Riddell <jr@jriddell.org>2016-09-26 16:04:28 (GMT)
commitfc475a805c80b1d5841b562b6c53023217cc4b31 (patch)
treecbdef53c07f37d2b9919ee70bb4006c5f89497cf
parentf00915e88af1514e209319ac5758b74bd2696bf9 (diff)
set perfentage of dialog during install
-rw-r--r--app/kipiinterface.cpp15
-rw-r--r--app/kipiinterface.h2
2 files changed, 12 insertions, 5 deletions
diff --git a/app/kipiinterface.cpp b/app/kipiinterface.cpp
index 577621f..8f9c3fd 100644
--- a/app/kipiinterface.cpp
+++ b/app/kipiinterface.cpp
@@ -355,7 +355,7 @@ void KIPIInterface::loadOnePlugin()
#ifdef KIPI_INSTALLER
void KIPIInterface::slotInstallPlugins(bool checked) {
Q_UNUSED(checked);
- d->installDialog = new QProgressDialog(i18n("Installing Plugins..."), i18n("Cancel"), 0, 0);
+ d->installDialog = new QProgressDialog(i18n("Installing Plugins..."), i18n("Cancel"), 0, 100);
d->installDialog->setWindowModality(Qt::WindowModal);
Appstream::Database appstreamDatabase;
@@ -373,17 +373,19 @@ void KIPIInterface::slotInstallPlugins(bool checked) {
}
void KIPIInterface::packageInstall(PackageKit::Transaction::Info, QString packageID, QString summary) {
- PackageKit::Transaction *installTransaction = PackageKit::Daemon::installPackage(packageID);
- connect(installTransaction,
+ m_installTransaction = PackageKit::Daemon::installPackage(packageID);
+ connect(m_installTransaction,
SIGNAL(finished(PackageKit::Transaction::Exit, uint)),
SLOT(packageFinished(PackageKit::Transaction::Exit, uint)));
+ connect(m_installTransaction,
+ SIGNAL(percentageChanged()),
+ SLOT(percentageChanged()));
}
void KIPIInterface::packageFinished(PackageKit::Transaction::Exit status, uint runtime) {
if (status == PackageKit::Transaction::Exit::ExitSuccess) {
d->installDialog->setLabelText("Image plugins have been installed.");
d->installDialog->setAutoClose(false);
- d->installDialog->setMaximum(100);
d->installDialog->setValue(100);
d->installDialog->setCancelButtonText("&Close");
d->mPluginLoader = 0;
@@ -392,10 +394,13 @@ void KIPIInterface::packageFinished(PackageKit::Transaction::Exit status, uint r
d->mPluginMenu->removeAction(d->mNoPluginAction);
} else {
d->installDialog->setLabelText("Could not install plugins.");
- d->installDialog->setMaximum(100);
d->installDialog->setCancelButtonText("&Close");
}
}
+
+void KIPIInterface::percentageChanged() {
+ d->installDialog->setValue(m_installTransaction->percentage());
+}
#endif
QList<QAction*> KIPIInterface::pluginActions(KIPI::Category category) const
diff --git a/app/kipiinterface.h b/app/kipiinterface.h
index 5ceacd0..2b8242c 100644
--- a/app/kipiinterface.h
+++ b/app/kipiinterface.h
@@ -97,12 +97,14 @@ private Q_SLOTS:
void slotInstallPlugins(bool checked);
void packageInstall(PackageKit::Transaction::Info, QString, QString);
void packageFinished(PackageKit::Transaction::Exit, uint);
+ void percentageChanged();
#endif
void init();
void loadOnePlugin();
private:
KIPIInterfacePrivate* const d;
+ PackageKit::Transaction* m_installTransaction;
};
class ImageCollection : public KIPI::ImageCollectionShared