summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2022-12-28 11:19:31 +0200
committerKatja Marttila <katja.marttila@qt.io>2023-01-26 08:05:14 +0200
commit476b6d6fffaf6841adaf68889e8b8ddae17dd382 (patch)
tree48d804c0a596b14afa395a35841c684f0b7d56c3
parent1b4b466af7ff89dc00b9f81686933fbbb82561c7 (diff)
Resolve downloadable archive list while installing
Installer can have thousands of components and only few of them user selects for install. Parsing the downloadable archives to install only when they are selected for install for better performance. Task-number: QTIFW-2805 Change-Id: I0771df05e17c85f37639768e2581d85bbf7bf66f Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
-rw-r--r--src/libs/installer/component.cpp17
-rw-r--r--src/libs/installer/component.h3
-rw-r--r--src/libs/installer/component_p.h1
-rw-r--r--src/libs/installer/packagemanagercore.cpp10
4 files changed, 21 insertions, 10 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index 78cbba79f..ccf9dc8bb 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -994,6 +994,15 @@ void Component::addDownloadableArchive(const QString &path)
}
/*!
+ \internal
+*/
+void Component::addDownloadableArchives(const QString& archives)
+{
+ Q_ASSERT(isFromOnlineRepository());
+ d->m_downloadableArchivesVariable = archives;
+}
+
+/*!
Removes the archive \a path previously added via addDownloadableArchive() from this component.
This can only be called if this component was downloaded from an online repository.
@@ -1008,9 +1017,15 @@ void Component::removeDownloadableArchive(const QString &path)
/*!
Returns the archives to be downloaded from the online repository before installation.
+ Should be called only once when the installation starts.
*/
-QStringList Component::downloadableArchives() const
+QStringList Component::downloadableArchives()
{
+ const QStringList downloadableArchives = d->m_downloadableArchivesVariable
+ .split(QInstaller::commaRegExp(), Qt::SkipEmptyParts);
+ foreach (const QString downloadableArchive, downloadableArchives)
+ addDownloadableArchive(downloadableArchive);
+
return d->m_downloadableArchives;
}
diff --git a/src/libs/installer/component.h b/src/libs/installer/component.h
index 8092b4c37..0d8bf85ab 100644
--- a/src/libs/installer/component.h
+++ b/src/libs/installer/component.h
@@ -150,9 +150,10 @@ public:
Q_INVOKABLE bool addElevatedOperation(QQmlV4Function *args);
bool addElevatedOperation(const QString &operation, const QStringList &parameters);
- QStringList downloadableArchives() const;
+ QStringList downloadableArchives();
Q_INVOKABLE void addDownloadableArchive(const QString &path);
Q_INVOKABLE void removeDownloadableArchive(const QString &path);
+ void addDownloadableArchives(const QString& archives);
QStringList stopProcessForUpdateRequests() const;
Q_INVOKABLE void addStopProcessForUpdateRequest(const QString &process);
diff --git a/src/libs/installer/component_p.h b/src/libs/installer/component_p.h
index fe9d84023..dea2d4935 100644
--- a/src/libs/installer/component_p.h
+++ b/src/libs/installer/component_p.h
@@ -75,6 +75,7 @@ public:
QList<Component*> m_childComponents;
QList<Component*> m_allChildComponents;
QStringList m_downloadableArchives;
+ QString m_downloadableArchivesVariable;
QStringList m_stopProcessForUpdateRequests;
QHash<QString, QPointer<QWidget> > m_userInterfaces;
QHash<QString, QVariant> m_scriptHash;
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 642f13b03..8c70bdae6 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -3977,14 +3977,8 @@ bool PackageManagerCore::updateComponentData(struct Data &data, Component *compo
component->setValue(QLatin1String("password"), repo.password());
}
- // add downloadable archive from xml
- const QStringList downloadableArchives = data.package->data(scDownloadableArchives).toString()
- .split(QInstaller::commaRegExp(), Qt::SkipEmptyParts);
-
- if (component->isFromOnlineRepository()) {
- foreach (const QString downloadableArchive, downloadableArchives)
- component->addDownloadableArchive(downloadableArchive);
- }
+ if (component->isFromOnlineRepository())
+ component->addDownloadableArchives(data.package->data(scDownloadableArchives).toString());
const QStringList componentsToReplace = data.package->data(scReplaces).toString()
.split(QInstaller::commaRegExp(), Qt::SkipEmptyParts);