diff options
Diffstat (limited to 'src/libs/installer/uninstallercalculator.h')
-rw-r--r-- | src/libs/installer/uninstallercalculator.h | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/src/libs/installer/uninstallercalculator.h b/src/libs/installer/uninstallercalculator.h index a458daa80..24979a9bb 100644 --- a/src/libs/installer/uninstallercalculator.h +++ b/src/libs/installer/uninstallercalculator.h @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2022 The Qt Company Ltd. +** Copyright (C) 2023 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -30,6 +30,7 @@ #include "installer_global.h" #include "qinstallerglobal.h" +#include "calculatorbase.h" #include <QHash> #include <QList> @@ -41,49 +42,30 @@ namespace QInstaller { class Component; class PackageManagerCore; -class INSTALLER_EXPORT UninstallerCalculator +class INSTALLER_EXPORT UninstallerCalculator : public CalculatorBase { public: - enum UninstallReasonType - { - Selected, // "Deselected Component(s)" - Replaced, // "Component(s) replaced by other components" - VirtualDependent, // "No dependencies to virtual component" - Dependent, // "Removed as dependency component is removed" - AutoDependent // "Removed as autodependency component is removed" - }; - - UninstallerCalculator(const QList<Component *> &installedComponents, PackageManagerCore *core, + UninstallerCalculator(PackageManagerCore *core, const AutoDependencyHash &autoDependencyComponentHash, - const DependencyHash &dependencyComponentHash, + const LocalDependencyHash &localDependencyComponentHash, const QStringList &localVirtualComponents); + ~UninstallerCalculator(); - QSet<Component*> componentsToUninstall() const; - - void appendComponentsToUninstall(const QList<Component*> &components, const bool reverse = false); - void removeComponentsFromUnInstall(const QList<Component*> &components); - void insertUninstallReason(Component *component, - const UninstallReasonType uninstallReason, - const QString &referencedComponentName = QString()); - QString uninstallReason(Component *component) const; - UninstallerCalculator::UninstallReasonType uninstallReasonType(Component *c) const; - QString uninstallReasonReferencedComponent(Component *component) const; + bool solve(const QList<Component*> &components) override; + QString resolutionText(Component *component) const override; private: - void appendComponentToUninstall(Component *component, const bool reverse); - void appendVirtualComponentsToUninstall(const bool reverse); + bool solveComponent(Component *component, const QString &version = QString()) override; + + bool isRequiredVirtualPackage(Component *component); + void appendVirtualComponentsToUninstall(); - QList<Component *> m_installedComponents; - QSet<Component *> m_componentsToUninstall; - PackageManagerCore *m_core; - QHash<QString, QPair<UninstallReasonType, QString> > m_toUninstallComponentIdReasonHash; +private: AutoDependencyHash m_autoDependencyComponentHash; - DependencyHash m_dependencyComponentHash; + LocalDependencyHash m_localDependencyComponentHash; QStringList m_localVirtualComponents; - QList<Component *> m_virtualComponentsForReverse; }; -} - +} // namespace QInstaller #endif // UNINSTALLERCALCULATOR_H |