summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2022-05-11 13:21:11 +0300
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2022-05-13 12:24:44 +0300
commitbaa236b7ae7bf1178ac21b56c245a5edc936b22e (patch)
treea75b4c4db204244f8f00748cce3847e9e7084adc /src/libs
parent60704a293520d9fb53d0ca43cb63454ba221bcd3 (diff)
Save sorting priority of components to local package hub
Before this change, components that declared explicit SortingPriority value would be sorted incorrectly with the default sorting value if the repositories were not available after installation. Task-number: QTIFW-2631 Change-Id: I3d18d6c6a5444eb3d2d700f12ed61da72431b8a4 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/installer/component.cpp1
-rw-r--r--src/libs/installer/loggingutils.cpp1
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp1
-rw-r--r--src/libs/kdtools/localpackagehub.cpp5
-rw-r--r--src/libs/kdtools/localpackagehub.h2
5 files changed, 10 insertions, 0 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index 100e95cee..d8485f02a 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -297,6 +297,7 @@ void Component::loadDataFromPackage(const KDUpdater::LocalPackage &package)
setValue(scUncompressedSize, QString::number(package.uncompressedSize));
setValue(scDependencies, package.dependencies.join(QLatin1String(",")));
setValue(scAutoDependOn, package.autoDependencies.join(QLatin1String(",")));
+ setValue(scSortingPriority, QString::number(package.sortingPriority));
setValue(scForcedInstallation, package.forcedInstallation ? scTrue : scFalse);
setValue(scVirtual, package.virtualComp ? scTrue : scFalse);
diff --git a/src/libs/installer/loggingutils.cpp b/src/libs/installer/loggingutils.cpp
index 2c5d918d5..8c542a1d1 100644
--- a/src/libs/installer/loggingutils.cpp
+++ b/src/libs/installer/loggingutils.cpp
@@ -292,6 +292,7 @@ void LoggingHandler::printLocalPackageInformation(const QList<KDUpdater::LocalPa
stream.writeAttribute(QLatin1String("version"), package.version);
if (verboseLevel() == VerbosityLevel::Detailed) {
stream.writeAttribute(QLatin1String("description"), package.description);
+ stream.writeAttribute(QLatin1String("sortingPriority"), QVariant(package.sortingPriority).toString());
stream.writeAttribute(QLatin1String("treeName"), package.treeName.first);
stream.writeAttribute(QLatin1String("moveChildren"), QVariant(package.treeName.second).toString());
stream.writeAttribute(QLatin1String("dependencies"), package.dependencies.join(QLatin1Char(',')));
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index 6764983e4..8f59fba81 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -2436,6 +2436,7 @@ void PackageManagerCorePrivate::installComponent(Component *component, double pr
QPair<QString, bool>(component->value(scTreeName),
component->treeNameMoveChildren()),
component->value(scDescription),
+ component->value(scSortingPriority).toInt(),
component->dependencies(),
component->autoDependencies(),
component->forcedInstallation(),
diff --git a/src/libs/kdtools/localpackagehub.cpp b/src/libs/kdtools/localpackagehub.cpp
index f63f6c974..bd6d879e3 100644
--- a/src/libs/kdtools/localpackagehub.cpp
+++ b/src/libs/kdtools/localpackagehub.cpp
@@ -328,6 +328,7 @@ void LocalPackageHub::addPackage(const QString &name,
const QString &title,
const QPair<QString, bool> &treeName,
const QString &description,
+ const int sortingPriority,
const QStringList &dependencies,
const QStringList &autoDependencies,
bool forcedInstallation,
@@ -352,6 +353,7 @@ void LocalPackageHub::addPackage(const QString &name,
info.title = title;
info.treeName = treeName;
info.description = description;
+ info.sortingPriority = sortingPriority;
info.dependencies = dependencies;
info.autoDependencies = autoDependencies;
info.forcedInstallation = forcedInstallation;
@@ -411,6 +413,7 @@ void LocalPackageHub::writeToDisk()
addTextChildHelper(&package, QLatin1String("Name"), info.name);
addTextChildHelper(&package, QLatin1String("Title"), info.title);
addTextChildHelper(&package, QLatin1String("Description"), info.description);
+ addTextChildHelper(&package, QLatin1String("SortingPriority"), QString::number(info.sortingPriority));
addTextChildHelper(&package, scTreeName, info.treeName.first, QLatin1String("moveChildren"),
QVariant(info.treeName.second).toString());
if (info.inheritVersionFrom.isEmpty())
@@ -485,6 +488,8 @@ void LocalPackageHub::PackagesInfoData::addPackageFrom(const QDomElement &packag
info.title = childNodeE.text();
else if (childNodeE.tagName() == QLatin1String("Description"))
info.description = childNodeE.text();
+ else if (childNodeE.tagName() == QLatin1String("SortingPriority"))
+ info.sortingPriority = childNodeE.text().toInt();
else if (childNodeE.tagName() == scTreeName) {
info.treeName.first = childNodeE.text();
info.treeName.second = QVariant(childNodeE.attribute(QLatin1String("moveChildren"))).toBool();
diff --git a/src/libs/kdtools/localpackagehub.h b/src/libs/kdtools/localpackagehub.h
index 11ed200a5..5d69faf7d 100644
--- a/src/libs/kdtools/localpackagehub.h
+++ b/src/libs/kdtools/localpackagehub.h
@@ -43,6 +43,7 @@ struct KDTOOLS_EXPORT LocalPackage
QString name;
QString title;
QString description;
+ int sortingPriority;
QPair<QString, bool> treeName;
QString version;
QString inheritVersionFrom;
@@ -104,6 +105,7 @@ public:
const QString &title,
const QPair<QString, bool> &treeName,
const QString &description,
+ const int sortingPriority,
const QStringList &dependencies,
const QStringList &autoDependencies,
bool forcedInstallation,