summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2014-06-03 12:58:10 +0200
committerKarsten Heimrich <karsten.heimrich@digia.com>2014-06-05 16:58:55 +0200
commit05bb1b8ccd3d12fb286f026406f076a41ec54965 (patch)
tree33e5c0cc8f09a9abc10515624995a5e313fe1611
parent451eee7a2ee9f3732ac2113cf560f0e1770236fd (diff)
Make it possible to calculate dependencies from script.
Task-number: QTIFW-503 Change-Id: Ic359d586f36669d4c1430c22e10b5a209ba6fc3c Reviewed-by: Samuli Piippo <samuli.piippo@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Niels Weber <niels.weber@digia.com>
-rw-r--r--src/libs/installer/packagemanagercore.cpp61
-rw-r--r--src/libs/installer/packagemanagercore.h7
2 files changed, 50 insertions, 18 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 61ce92467..82f852faf 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -129,6 +129,24 @@
*/
/*!
+ \qmlsignal QInstaller::finishedCalculateComponentsToInstall()
+
+ Emitted after the ordered list of components to install was calculated.
+*/
+
+/*!
+ \qmlsignal QInstaller::aboutCalculateComponentsToUninstall()
+
+ Emitted before the ordered list of components to uninstall is calculated.
+*/
+
+/*!
+ \qmlsignal QInstaller::finishedCalculateComponentsToUninstall()
+
+ Emitted after the ordered list of components to uninstall was calculated.
+*/
+
+/*!
\qmlsignal QInstaller::componentAdded(Component component)
Emitted when a new root component has been added.
@@ -1247,8 +1265,12 @@ Component *PackageManagerCore::componentByName(const QString &name) const
}
/*!
- Calculates an ordered list of components to install based on the current run mode. Also auto installed
- dependencies are resolved.
+ \qmlmethod boolean QInstaller::calculateComponentsToInstall()
+
+ Calculates an ordered list of components to install based on the current run mode. Also auto
+ installed dependencies are resolved. The aboutCalculateComponentsToInstall() signal is emitted
+ before the calculation starts, the finishedCalculateComponentsToInstall() signal once all
+ calculations are done.
*/
bool PackageManagerCore::calculateComponentsToInstall() const
{
@@ -1278,6 +1300,7 @@ bool PackageManagerCore::calculateComponentsToInstall() const
d->m_componentsToInstallCalculated = d->appendComponentsToInstall(components);
}
+ emit finishedCalculateComponentsToInstall();
return d->m_componentsToInstallCalculated;
}
@@ -1290,26 +1313,32 @@ QList<Component*> PackageManagerCore::orderedComponentsToInstall() const
}
/*!
- Calculates a list of components to uninstall based on the current run mode. Auto installed dependencies
- are resolved as well.
+ \qmlmethod boolean QInstaller::calculateComponentsToUninstall()
+
+ Calculates a list of components to uninstall based on the current run mode. Auto installed
+ dependencies are not yet resolved. The aboutCalculateComponentsToUninstall() signal is emitted
+ before the calculation starts, the finishedCalculateComponentsToUninstall() signal once all
+ calculations are done.
*/
bool PackageManagerCore::calculateComponentsToUninstall() const
{
- if (isUpdater())
- return true;
+ bool result = true;
+ emit aboutCalculateComponentsToUninstall();
+ if (!isUpdater()) {
+ // hack to avoid removing needed dependencies
+ QSet<Component*> componentsToInstall = d->m_orderedComponentsToInstall.toSet();
- // hack to avoid removing needed dependencies
- QSet<Component*> componentsToInstall = d->m_orderedComponentsToInstall.toSet();
+ QList<Component*> components;
+ foreach (Component *component, availableComponents()) {
+ if (component->uninstallationRequested() && !componentsToInstall.contains(component))
+ components.append(component);
+ }
- QList<Component*> components;
- foreach (Component *component, availableComponents()) {
- if (component->uninstallationRequested() && !componentsToInstall.contains(component))
- components.append(component);
+ d->m_componentsToUninstall.clear();
+ result = d->appendComponentsToUninstall(components);
}
-
-
- d->m_componentsToUninstall.clear();
- return d->appendComponentsToUninstall(components);
+ emit finishedCalculateComponentsToUninstall();
+ return result;
}
/*!
diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h
index a3f2b7eb0..7b45b008e 100644
--- a/src/libs/installer/packagemanagercore.h
+++ b/src/libs/installer/packagemanagercore.h
@@ -199,10 +199,10 @@ public:
QList<Component*> availableComponents() const;
Component *componentByName(const QString &identifier) const;
- bool calculateComponentsToInstall() const;
+ Q_INVOKABLE bool calculateComponentsToInstall() const;
QList<Component*> orderedComponentsToInstall() const;
- bool calculateComponentsToUninstall() const;
+ Q_INVOKABLE bool calculateComponentsToUninstall() const;
QList<Component*> componentsToUninstall() const;
QString componentsToInstallError() const;
@@ -270,6 +270,9 @@ public Q_SLOTS:
Q_SIGNALS:
void aboutCalculateComponentsToInstall() const;
+ void finishedCalculateComponentsToInstall() const;
+ void aboutCalculateComponentsToUninstall() const;
+ void finishedCalculateComponentsToUninstall() const;
void componentAdded(QInstaller::Component *comp);
void rootComponentsAdded(QList<QInstaller::Component*> components);
void updaterComponentsAdded(QList<QInstaller::Component*> components);