summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/installercalculator.h
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2022-03-25 15:38:50 +0200
committerKatja Marttila <katja.marttila@qt.io>2022-04-28 15:18:34 +0300
commita28cf55b5a5007c0dd952b3012c076d9da329f0f (patch)
treeaba86d92da394969acfcf2eb6d7b7578c9432c36 /src/libs/installer/installercalculator.h
parent23ec1e91f4e0c567f5953de149b2ab3496490e87 (diff)
Speed up component selection in component selection pages
If a lot of components are installed, maintenancetool was slow to select/unselect a single component. This was caused because the whole tree's components were recalculated. Fixed so that only the selected/unselected components and their dependencies and autodependencies are recalculated instead of whole tree. This change speeds up clicking tree item from zero to 90 percent, depending on how much components are already installed. The more components are installed as autodependency, the slower it gets to select the items. Task-number: QTIFW-2522 Change-Id: I5e824aed8787fd7ecdce72b15a1b13848f0a3923 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs/installer/installercalculator.h')
-rw-r--r--src/libs/installer/installercalculator.h39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/libs/installer/installercalculator.h b/src/libs/installer/installercalculator.h
index b2d05bdbe..2841d8671 100644
--- a/src/libs/installer/installercalculator.h
+++ b/src/libs/installer/installercalculator.h
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -42,41 +42,50 @@ class Component;
class INSTALLER_EXPORT InstallerCalculator
{
public:
- InstallerCalculator(const QList<Component *> &allComponents);
+ InstallerCalculator(const QList<Component *> &allComponents, const QHash<QString, QStringList> &autoDependencyComponentHash);
enum InstallReasonType
{
+ Selected, // "Selected Component(s) without Dependencies"
Automatic, // "Component(s) added as automatic dependencies"
Dependent, // "Added as dependency for %1."
- Resolved, // "Component(s) that have resolved Dependencies"
- Selected // "Selected Component(s) without Dependencies"
+ Resolved // "Component(s) that have resolved Dependencies"
};
- InstallReasonType installReasonType(Component *component) const;
- QString installReasonReferencedComponent(Component *component) const;
- QString installReason(Component *component) const;
+ InstallReasonType installReasonType(const Component *c) const;
+ QString installReason(const Component *component) const;
QList<Component*> orderedComponentsToInstall() const;
QString componentsToInstallError() const;
- bool appendComponentsToInstall(const QList<Component*> &components);
+ bool appendComponentsToInstall(const QList<Component*> &components, bool modelReset = false, const bool revertFromInstall = false);
+ bool removeComponentsFromInstall(const QList<Component*> &components);
private:
- void insertInstallReason(Component *component,
- InstallReasonType installReasonType,
- const QString &referencedComponentName = QString());
- void realAppendToInstallComponents(Component *component, const QString &version = QString());
- bool appendComponentToInstall(Component *components, const QString &version = QString());
- QString recursionError(Component *component);
+ QString installReasonReferencedComponent(const Component *component) const;
+ void insertInstallReason(const Component *component,
+ const InstallReasonType installReason,
+ const QString &referencedComponentName = QString(),
+ const bool revertFromInstall = false);
+ void realAppendToInstallComponents(Component *component, const QString &version, const bool revertFromInstall);
+ bool appendComponentToInstall(Component *component, const QString &version, const bool revertFromInstall);
+ QString recursionError(const Component *component) const;
+ QSet<Component *> autodependencyComponents(const bool revertFromInstall);
+private:
QList<Component*> m_allComponents;
QHash<Component*, QSet<Component*> > m_visitedComponents;
- QSet<QString> m_toInstallComponentIds; //for faster lookups
+ QList<const Component*> m_componentsForAutodepencencyCheck;
+ //for faster lookups.
+ QSet<QString> m_toInstallComponentIds;
+ QHash<QString, QStringList> m_referenceCount;
QString m_componentsToInstallError;
//calculate installation order variables
QList<Component*> m_orderedComponentsToInstall;
//we can't use this reason hash as component id hash, because some reasons are ready before
//the component is added
QHash<QString, QPair<InstallReasonType, QString> > m_toInstallComponentIdReasonHash;
+ //Helper hash for quicker search for autodependency components
+ QHash<QString, QStringList> m_autoDependencyComponentHash;
};
}