diff options
59 files changed, 237 insertions, 146 deletions
diff --git a/.qmake.conf b/.qmake.conf index 8798c3d5a..36f547a67 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,2 +1,2 @@ -VERSION=4.1.0 +VERSION=4.2.0 CONFIG=prepare_docs qt_docs_targets $$CONFIG diff --git a/dist/packages/org.qtproject.ifw.binaries/meta/package.xml b/dist/packages/org.qtproject.ifw.binaries/meta/package.xml index f94336822..4d9a3c7a7 100644 --- a/dist/packages/org.qtproject.ifw.binaries/meta/package.xml +++ b/dist/packages/org.qtproject.ifw.binaries/meta/package.xml @@ -2,7 +2,7 @@ <Package> <DisplayName>Qt Installer Framework Binaries</DisplayName> <Description>Installs the binaries, examples and help files.</Description> - <Version>4.1.0</Version> - <ReleaseDate>2020-12-09</ReleaseDate> + <Version>4.2.0</Version> + <ReleaseDate>2021-03-03</ReleaseDate> <Default>True</Default> </Package> diff --git a/dist/packages/org.qtproject.ifw/meta/package.xml b/dist/packages/org.qtproject.ifw/meta/package.xml index b68e6cbf2..5c56a177e 100644 --- a/dist/packages/org.qtproject.ifw/meta/package.xml +++ b/dist/packages/org.qtproject.ifw/meta/package.xml @@ -2,8 +2,8 @@ <Package> <DisplayName>Qt Installer Framework</DisplayName> <Description>Installs the Qt Installer Framework.</Description> - <Version>4.1.0</Version> - <ReleaseDate>2020-12-09</ReleaseDate> + <Version>4.2.0</Version> + <ReleaseDate>2021-03-03</ReleaseDate> <Licenses> <License name="The Qt Company GPL Exception 1.0" file="LICENSE.GPL3-EXCEPT" /> <License name="Third Party Code Licenses" file="3RDPARTY" /> diff --git a/doc/scripting-api/packagemanagercore.qdoc b/doc/scripting-api/packagemanagercore.qdoc index bacf50f27..f4d71ee97 100644 --- a/doc/scripting-api/packagemanagercore.qdoc +++ b/doc/scripting-api/packagemanagercore.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -861,6 +861,12 @@ */ /*! + \qmlmethod boolean installer::isPackageViewer() + + Returns \c true if the current installer is executed as package viewer. +*/ + +/*! \qmlmethod boolean installer::isUserSetBinaryMarker() Returns \c true if the magic binary marker has been set by user. diff --git a/installerfw.pri b/installerfw.pri index e38bb5108..377d07d2c 100644 --- a/installerfw.pri +++ b/installerfw.pri @@ -3,9 +3,9 @@ } IFW_PRI_INCLUDED = 1 -IFW_VERSION_STR = 4.1.0 -IFW_VERSION = 0x040100 -IFW_VERSION_WIN32 = 4,1,0,0 +IFW_VERSION_STR = 4.2.0 +IFW_VERSION = 0x040200 +IFW_VERSION_WIN32 = 4,2,0,0 IFW_VERSION_STR_WIN32 = $$IFW_VERSION_STR\0 diff --git a/src/libs/ifwtools/binarycreator.cpp b/src/libs/ifwtools/binarycreator.cpp index deea01ed7..a813c7f50 100644 --- a/src/libs/ifwtools/binarycreator.cpp +++ b/src/libs/ifwtools/binarycreator.cpp @@ -410,9 +410,9 @@ static int assemble(Input input, const QInstaller::Settings &settings, const QSt collection.setName(info.name.toUtf8()); qDebug() << "Creating resource archive for" << info.name; - foreach (const QString &file, info.copiedFiles) { - const QSharedPointer<Resource> resource(new Resource(file)); - qDebug().nospace() << "Appending " << file << " (" << humanReadableSize(resource->size()) << ")"; + foreach (const QString &copiedFile, info.copiedFiles) { + const QSharedPointer<Resource> resource(new Resource(copiedFile)); + qDebug().nospace() << "Appending " << copiedFile << " (" << humanReadableSize(resource->size()) << ")"; collection.appendResource(resource); } input.manager.insertCollection(collection); @@ -610,8 +610,8 @@ void QInstallerTools::copyConfigData(const QString &configFile, const QString &t if (tagName == QLatin1String("ProductImages")) { const QDomNodeList childNodes = domElement.childNodes(); - for (int i = 0; i < childNodes.count(); ++i) { - const QDomElement childElement = childNodes.at(i).toElement(); + for (int index = 0; index < childNodes.count(); ++index) { + const QDomElement childElement = childNodes.at(index).toElement(); const QString childName = childElement.tagName(); if (childName != QLatin1String("Image")) continue; diff --git a/src/libs/ifwtools/rcc/rcc.cpp b/src/libs/ifwtools/rcc/rcc.cpp index 10b7cbc4f..12f399937 100644 --- a/src/libs/ifwtools/rcc/rcc.cpp +++ b/src/libs/ifwtools/rcc/rcc.cpp @@ -120,18 +120,18 @@ public: RCCFileInfo::RCCFileInfo(const QString &name, const QFileInfo &fileInfo, QLocale::Language language, QLocale::Country country, uint flags, int compressLevel, int compressThreshold) + : m_flags(flags) + , m_name(name) + , m_language(language) + , m_country(country) + , m_fileInfo(fileInfo) + , m_parent(nullptr) + , m_compressLevel(compressLevel) + , m_compressThreshold(compressThreshold) + , m_nameOffset(0) + , m_dataOffset(0) + , m_childOffset(0) { - m_name = name; - m_fileInfo = fileInfo; - m_language = language; - m_country = country; - m_flags = flags; - m_parent = nullptr; - m_nameOffset = 0; - m_dataOffset = 0; - m_childOffset = 0; - m_compressLevel = compressLevel; - m_compressThreshold = compressThreshold; } RCCFileInfo::~RCCFileInfo() diff --git a/src/libs/ifwtools/repositorygen.cpp b/src/libs/ifwtools/repositorygen.cpp index 842d4f9cb..863b5655b 100644 --- a/src/libs/ifwtools/repositorygen.cpp +++ b/src/libs/ifwtools/repositorygen.cpp @@ -777,14 +777,14 @@ QStringList QInstallerTools::unifyMetadata(const QString &repoDir, const QString QFile archiveFile(existingRepoDir); QInstaller::openForRead(&archiveFile); Lib7z::extractArchive(&archiveFile, existingRepoTemp); - QDir dir(existingRepoTemp); - QStringList existingRepoEntries = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + QDir dir2(existingRepoTemp); + QStringList existingRepoEntries = dir2.entryList(QDir::Dirs | QDir::NoDotAndDotDot); foreach (const QString existingRepoEntry, existingRepoEntries) { if (entryList.contains(existingRepoEntry)) { continue; } else { - dir.cd(existingRepoEntry); - const QString absPath = dir.absolutePath(); + dir2.cd(existingRepoEntry); + const QString absPath = dir2.absolutePath(); absPaths.append(absPath); } } diff --git a/src/libs/installer/binarycontent.h b/src/libs/installer/binarycontent.h index a21cd69e7..7d50c0e28 100644 --- a/src/libs/installer/binarycontent.h +++ b/src/libs/installer/binarycontent.h @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -48,6 +48,13 @@ public: static const qint64 MagicUpdaterMarker = 0x12023235UL; static const qint64 MagicPackageManagerMarker = 0x12023236UL; + // additional distinguishers only used at runtime, not written to the binary itself + enum MagicMarkerSupplement { + Default = 0x0, + OfflineGenerator = 0x1, + PackageViewer = 0x2 + }; + // the cookie put at the end of the file static const quint64 MagicCookie = 0xc2630a1c99d668f8LL; // binary static const quint64 MagicCookieDat = 0xc2630a1c99d668f9LL; // data diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index c5d74cdfa..8142cd4e1 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -306,6 +306,8 @@ void Component::loadDataFromPackage(const KDUpdater::LocalPackage &package) /*! Sets variables according to the values set in the package.xml file of \a package. Also loads UI files, licenses and translations if they are referenced in the package.xml. + If the \c PackageManagerCore object of this component is run as package viewer, then + only sets the variables without loading referenced files. */ void Component::loadDataFromPackage(const Package &package) { @@ -344,6 +346,9 @@ void Component::loadDataFromPackage(const Package &package) setValue(scForcedInstallation, forced); setValue(scContentSha1, package.data(scContentSha1).toString()); + if (d->m_core->isPackageViewer()) + return; + setLocalTempPath(QInstaller::pathFromUrl(package.packageSource().url)); const QStringList uis = package.data(QLatin1String("UserInterfaces")).toString() .split(QInstaller::commaRegExp(), QString::SkipEmptyParts); diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp index aab487b45..642828ad7 100644 --- a/src/libs/installer/componentmodel.cpp +++ b/src/libs/installer/componentmodel.cpp @@ -260,9 +260,9 @@ bool ComponentModel::setData(const QModelIndex &index, const QVariant &value, in newValue = (oldValue == Qt::Checked) ? Qt::Unchecked : Qt::Checked; } QSet<QModelIndex> changed = updateCheckedState(nodes << component, newValue); - foreach (const QModelIndex &index, changed) { - emit dataChanged(index, index); - emit checkStateChanged(index); + foreach (const QModelIndex &changedIndex, changed) { + emit dataChanged(changedIndex, changedIndex); + emit checkStateChanged(changedIndex); } updateAndEmitModelState(); // update the internal state } else { diff --git a/src/libs/installer/componentselectionpage_p.cpp b/src/libs/installer/componentselectionpage_p.cpp index a9f4ba134..c333195c1 100644 --- a/src/libs/installer/componentselectionpage_p.cpp +++ b/src/libs/installer/componentselectionpage_p.cpp @@ -399,10 +399,9 @@ void ComponentSelectionPagePrivate::fetchRepositoryCategories() { updateWidgetVisibility(true); - QCheckBox *checkbox; QList<QCheckBox*> checkboxes = m_categoryGroupBox->findChildren<QCheckBox *>(); for (int i = 0; i < checkboxes.count(); i++) { - checkbox = checkboxes.at(i); + QCheckBox *checkbox = checkboxes.at(i); enableRepositoryCategory(checkbox->objectName(), checkbox->isChecked()); } diff --git a/src/libs/installer/installiconsoperation.cpp b/src/libs/installer/installiconsoperation.cpp index 9443b7f71..de1ddcc4f 100644 --- a/src/libs/installer/installiconsoperation.cpp +++ b/src/libs/installer/installiconsoperation.cpp @@ -134,8 +134,8 @@ bool InstallIconsOperation::performOperation() if (status == PackageManagerCore::Canceled || status == PackageManagerCore::Failure) return true; - const QString &source = it.next(); - QString target = targetDir.absoluteFilePath(sourceDir.relativeFilePath(source)); + const QString &source2 = it.next(); + QString target = targetDir.absoluteFilePath(sourceDir.relativeFilePath(source2)); emit outputTextChanged(target); @@ -185,7 +185,7 @@ bool InstallIconsOperation::performOperation() } // copy the file to its new location - QFile cf(source); + QFile cf(source2); if (!cf.copy(target)) { setError(UserDefinedError); setErrorString(tr("Failed to copy file \"%1\": %2").arg( @@ -193,8 +193,8 @@ bool InstallIconsOperation::performOperation() undoOperation(); return false; } - deleteFileNowOrLater(source); - files.push_back(source); + deleteFileNowOrLater(source2); + files.push_back(source2); files.push_back(target); setValue(QLatin1String("files"), files); } else if (fi.isDir() && !QDir(target).exists()) { diff --git a/src/libs/installer/keepaliveobject.cpp b/src/libs/installer/keepaliveobject.cpp index 94e91efd8..18ec9743a 100644 --- a/src/libs/installer/keepaliveobject.cpp +++ b/src/libs/installer/keepaliveobject.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -48,7 +48,12 @@ KeepAliveObject::KeepAliveObject() void KeepAliveObject::start() { + if (m_timer) + delete m_timer; m_timer = new QTimer(this); + + if (m_socket) + delete m_socket; m_socket = new QLocalSocket(this); connect(m_timer, &QTimer::timeout, [this]() { diff --git a/src/libs/installer/loggingutils.cpp b/src/libs/installer/loggingutils.cpp index 0ebba10db..45f7aab1b 100644 --- a/src/libs/installer/loggingutils.cpp +++ b/src/libs/installer/loggingutils.cpp @@ -259,7 +259,7 @@ void LoggingHandler::printComponentInfo(const QList<Component *> components) con QDomElement root = doc.createElement(QLatin1String("updates")); doc.appendChild(root); - foreach (Component *component, components) { + foreach (const Component *component, components) { QDomElement update = doc.createElement(QLatin1String("update")); update.setAttribute(QLatin1String("name"), component->value(scDisplayName)); update.setAttribute(QLatin1String("version"), component->value(scVersion)); diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index 5f7412c54..c512c23b5 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -2185,21 +2185,32 @@ ComponentModel *PackageManagerCore::updaterComponentModel() const */ void PackageManagerCore::listAvailablePackages(const QString ®exp) { + setPackageViewer(); qCDebug(QInstaller::lcInstallerInstallLog) << "Searching packages with regular expression:" << regexp; + + ComponentModel *model = defaultComponentModel(); d->fetchMetaInformationFromRepositories(DownloadType::UpdatesXML); d->addUpdateResourcesFromRepositories(true); QRegularExpression re(regexp); const PackagesList &packages = d->remotePackages(); + if (!fetchAllPackages(packages, LocalPackagesHash())) { + qCWarning(QInstaller::lcInstallerInstallLog) + << "There was a problem with loading the package data."; + return; + } PackagesList matchedPackages; foreach (Package *package, packages) { const QString name = package->data(scName).toString(); - if (re.match(name).hasMatch() && - (virtualComponentsVisible() ? true : !package->data(scVirtual, false).toBool())) { + Component *component = componentByName(name); + if (!component) + continue; + + const QModelIndex &idx = model->indexFromComponentName(component->treeName()); + if (idx.isValid() && re.match(name).hasMatch()) matchedPackages.append(package); - } } if (matchedPackages.count() == 0) qCDebug(QInstaller::lcInstallerInstallLog) << "No matching packages found."; @@ -2275,10 +2286,26 @@ bool PackageManagerCore::checkComponentsForInstallation(const QStringList &compo model->setData(idx, Qt::Checked, Qt::CheckStateRole); installComponentsFound = true; } - } else { // idx is invalid and component valid when we have invisible virtual component - component->isVirtual() - ? errorMessage.append(tr("Cannot install %1. Component is virtual.\n").arg(name)) - : errorMessage.append(tr("Cannot install %1. Component not found.\n").arg(name)); + } else { + auto isDescendantOfVirtual = [&]() { + Component *trace = component; + forever { + trace = trace->parentComponent(); + if (!trace) { + // We already checked the root component if there is no parent + return false; + } else if (trace->isVirtual()) { + errorMessage.append(tr("Cannot install %1. Component is descendant " + "of a virtual component %2.\n").arg(name, trace->name())); + return true; + } + } + }; + // idx is invalid and component valid when we have invisible virtual component + if (component->isVirtual()) + errorMessage.append(tr("Cannot install %1. Component is virtual.\n").arg(name)); + else if (!isDescendantOfVirtual()) + errorMessage.append(tr("Cannot install %1. Component not found.\n").arg(name)); } } if (!installComponentsFound) @@ -2292,6 +2319,7 @@ bool PackageManagerCore::checkComponentsForInstallation(const QStringList &compo */ void PackageManagerCore::listInstalledPackages(const QString ®exp) { + setPackageViewer(); LocalPackagesHash installedPackages = this->localInstalledPackages(); if (!regexp.isEmpty()) { @@ -3380,11 +3408,11 @@ bool PackageManagerCore::isPackageManager() const } /*! - Sets current installer to be offline generator based on \a offlineGenerator. + Sets current installer to be offline generator. */ -void PackageManagerCore::setOfflineGenerator(bool offlineGenerator) +void PackageManagerCore::setOfflineGenerator() { - d->m_offlineGenerator = offlineGenerator; + d->m_magicMarkerSupplement = BinaryContent::OfflineGenerator; } /*! @@ -3398,6 +3426,24 @@ bool PackageManagerCore::isOfflineGenerator() const } /*! + Sets the current installer as the package viewer. +*/ +void PackageManagerCore::setPackageViewer() +{ + d->m_magicMarkerSupplement = BinaryContent::PackageViewer; +} + +/*! + Returns \c true if the current installer is executed as package viewer. + + \sa {installer::isPackageViewer}{installer.isPackageViewer} +*/ +bool PackageManagerCore::isPackageViewer() const +{ + return d->isPackageViewer(); +} + +/*! Sets the installer magic binary marker based on \a magicMarker and userSetBinaryMarker to \c true. */ @@ -3638,7 +3684,7 @@ void PackageManagerCore::storeReplacedComponents(QHash<QString, Component *> &co qCWarning(QInstaller::lcDeveloperBuild) << componentName << "- Does not exist in the repositories anymore."; continue; } - if (!componentToReplace && !d->componentsToReplace().contains(componentName)) { + if (!d->componentsToReplace().contains(componentName)) { componentToReplace = new Component(this); componentToReplace->setValue(scName, componentName); } else { diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h index 9d89e4763..750c03b15 100644 --- a/src/libs/installer/packagemanagercore.h +++ b/src/libs/installer/packagemanagercore.h @@ -264,9 +264,12 @@ public: Q_INVOKABLE void setPackageManager(); Q_INVOKABLE bool isPackageManager() const; - void setOfflineGenerator(bool offlineGenerator = true); + void setOfflineGenerator(); Q_INVOKABLE bool isOfflineGenerator() const; + void setPackageViewer(); + Q_INVOKABLE bool isPackageViewer() const; + void setUserSetBinaryMarker(qint64 magicMarker); Q_INVOKABLE bool isUserSetBinaryMarker() const; diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index e6220ba35..1b14c306b 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -225,6 +225,7 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core) , m_repoFetched(false) , m_updateSourcesAdded(false) , m_magicBinaryMarker(0) // initialize with pseudo marker + , m_magicMarkerSupplement(BinaryContent::Default) , m_componentsToInstallCalculated(false) , m_componentScriptEngine(nullptr) , m_controlScriptEngine(nullptr) @@ -243,7 +244,6 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core) , m_autoAcceptLicenses(false) , m_disableWriteMaintenanceTool(false) , m_autoConfirmCommand(false) - , m_offlineGenerator(false) { } @@ -264,6 +264,7 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q , m_repoFetched(false) , m_updateSourcesAdded(false) , m_magicBinaryMarker(magicInstallerMaker) + , m_magicMarkerSupplement(BinaryContent::Default) , m_componentsToInstallCalculated(false) , m_componentScriptEngine(nullptr) , m_controlScriptEngine(nullptr) @@ -282,7 +283,6 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q , m_autoAcceptLicenses(false) , m_disableWriteMaintenanceTool(false) , m_autoConfirmCommand(false) - , m_offlineGenerator(false) { foreach (const OperationBlob &operation, performedOperations) { QScopedPointer<QInstaller::Operation> op(KDUpdater::UpdateOperationFactory::instance() @@ -717,7 +717,12 @@ bool PackageManagerCorePrivate::isPackageManager() const bool PackageManagerCorePrivate::isOfflineGenerator() const { - return m_offlineGenerator; + return m_magicMarkerSupplement == BinaryContent::OfflineGenerator; +} + +bool PackageManagerCorePrivate::isPackageViewer() const +{ + return m_magicMarkerSupplement == BinaryContent::PackageViewer; } bool PackageManagerCorePrivate::statusCanceledOrFailed() const diff --git a/src/libs/installer/packagemanagercore_p.h b/src/libs/installer/packagemanagercore_p.h index 4d5021471..b29808228 100644 --- a/src/libs/installer/packagemanagercore_p.h +++ b/src/libs/installer/packagemanagercore_p.h @@ -132,6 +132,8 @@ public: bool runOfflineGenerator(); bool isOfflineGenerator() const; + bool isPackageViewer() const; + QString replaceVariables(const QString &str) const; QByteArray replaceVariables(const QByteArray &str) const; @@ -265,9 +267,10 @@ private: bool m_repoFetched; bool m_updateSourcesAdded; qint64 m_magicBinaryMarker; + int m_magicMarkerSupplement; + bool m_componentsToInstallCalculated; - bool m_foundEssentialUpdate; - bool m_offlineGenerator; + bool m_foundEssentialUpdate;; mutable ScriptEngine *m_componentScriptEngine; mutable ScriptEngine *m_controlScriptEngine; diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 86c3a2d0c..d52034389 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -321,7 +321,7 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent) QFile sheet(styleSheetFile); if (sheet.exists()) { if (sheet.open(QIODevice::ReadOnly)) { - setStyleSheet(QString::fromLatin1(sheet.readAll())); + qApp->setStyleSheet(QString::fromLatin1(sheet.readAll())); } else { qCWarning(QInstaller::lcDeveloperBuild) << "The specified style sheet file " "can not be opened."; diff --git a/src/libs/installer/qsettingswrapper.cpp b/src/libs/installer/qsettingswrapper.cpp index 56db28d78..f57750bc1 100644 --- a/src/libs/installer/qsettingswrapper.cpp +++ b/src/libs/installer/qsettingswrapper.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -74,9 +74,9 @@ public: Private(const QString &fileName, QSettings::Format format) : m_filename(fileName) + , m_format(format) , settings(fileName, format) { - m_format = format; m_scope = settings.scope(); m_application = settings.applicationName(); m_organization = settings.organizationName(); diff --git a/src/libs/installer/utils.cpp b/src/libs/installer/utils.cpp index 59be2171b..7506a13fe 100644 --- a/src/libs/installer/utils.cpp +++ b/src/libs/installer/utils.cpp @@ -351,12 +351,12 @@ static QString qt_create_commandline(const QString &program, const QStringList & // as escaping the quote -- rather put the \ behind the quote: e.g. // rather use "foo"\ than "foo\" QString endQuote(QLatin1Char('\"')); - int i = tmp.length(); - while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\')) { - --i; + int j = tmp.length(); + while (j > 0 && tmp.at(j - 1) == QLatin1Char('\\')) { + --j; endQuote += QLatin1Char('\\'); } - args += QLatin1String(" \"") + tmp.left(i) + endQuote; + args += QLatin1String(" \"") + tmp.left(j) + endQuote; } else { args += QLatin1Char(' ') + tmp; } diff --git a/src/libs/kdtools/selfrestarter.cpp b/src/libs/kdtools/selfrestarter.cpp index 7326ac070..7771fafac 100644 --- a/src/libs/kdtools/selfrestarter.cpp +++ b/src/libs/kdtools/selfrestarter.cpp @@ -36,20 +36,21 @@ class SelfRestarter::Private { public: Private(int argc, char *argv[]) - : restartOnQuit(false) + : executable(QString::fromLocal8Bit(argv[0])) + , restartOnQuit(false) + , workingPath(QDir::currentPath()) { - executable = QString::fromLocal8Bit(argv[0]); - workingPath = QDir::currentPath(); + for (int i = 1; i < argc; ++i) args << QString::fromLocal8Bit(argv[i]); } Private() - : restartOnQuit(false) + : executable(qApp->applicationFilePath()) + , args(qApp->arguments().mid(1)) + , restartOnQuit(false) + , workingPath(QDir::currentPath()) { - executable = qApp->applicationFilePath(); - workingPath = QDir::currentPath(); - args = qApp->arguments().mid(1); } ~Private() diff --git a/src/libs/kdtools/updatefinder.cpp b/src/libs/kdtools/updatefinder.cpp index 3403430fe..034e162d3 100644 --- a/src/libs/kdtools/updatefinder.cpp +++ b/src/libs/kdtools/updatefinder.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB) -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -79,7 +79,7 @@ public: RemoveExisting }; - Private(UpdateFinder *qq) + explicit Private(UpdateFinder *qq) : q(qq) , cancel(false) , downloadCompleteCount(0) @@ -94,7 +94,7 @@ public: struct Data { Data() : downloader(0) {} - Data(const PackageSource &i, FileDownloader *d = 0) + explicit Data(const PackageSource &i, FileDownloader *d = 0) : info(i), downloader(d) {} PackageSource info; diff --git a/src/libs/kdtools/updateoperation.cpp b/src/libs/kdtools/updateoperation.cpp index 00b059af1..897fecf1b 100644 --- a/src/libs/kdtools/updateoperation.cpp +++ b/src/libs/kdtools/updateoperation.cpp @@ -283,7 +283,7 @@ void UpdateOperation::setRequiresUnreplacedVariables(bool isRequired) struct StartsWith { - StartsWith(const QString &searchTerm) + explicit StartsWith(const QString &searchTerm) : m_searchTerm(searchTerm) {} bool operator()(const QString &searchString) diff --git a/src/libs/kdtools/updatesinfo.cpp b/src/libs/kdtools/updatesinfo.cpp index 3119b6240..eaa9b039e 100644 --- a/src/libs/kdtools/updatesinfo.cpp +++ b/src/libs/kdtools/updatesinfo.cpp @@ -125,8 +125,8 @@ bool UpdatesInfoData::parsePackageUpdateElement(const QDomElement &updateE) } else if (childE.tagName() == QLatin1String("Licenses")) { QHash<QString, QVariant> licenseHash; const QDomNodeList licenseNodes = childE.childNodes(); - for (int i = 0; i < licenseNodes.count(); ++i) { - const QDomNode licenseNode = licenseNodes.at(i); + for (int index = 0; index < licenseNodes.count(); ++index) { + const QDomNode licenseNode = licenseNodes.at(index); if (licenseNode.nodeName() == QLatin1String("License")) { QDomElement element = licenseNode.toElement(); QVariantMap attributes; @@ -210,8 +210,8 @@ QVariant UpdatesInfoData::parseOperations(const QDomNodeList &operationNodes) if (operationNode.nodeName() == QLatin1String("Operation")) { const QDomNodeList argumentNodes = operationNode.childNodes(); QStringList attributes; - for (int i = 0; i < argumentNodes.count(); ++i) { - const QDomNode argumentNode = argumentNodes.at(i); + for (int index = 0; index < argumentNodes.count(); ++index) { + const QDomNode argumentNode = argumentNodes.at(index); if (argumentNode.nodeName() == QLatin1String("Argument")) { QDomElement argumentElement = argumentNode.toElement(); attributes.append(argumentElement.text()); diff --git a/src/sdk/tabcontroller.cpp b/src/sdk/tabcontroller.cpp index 5e2f1ed13..3bcb3f11a 100644 --- a/src/sdk/tabcontroller.cpp +++ b/src/sdk/tabcontroller.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -166,23 +166,6 @@ void TabController::restartWizard() void TabController::onSettingsButtonClicked() { SettingsDialog dialog(d->m_core); - // set custom stylesheet - const QString styleSheetFile = d->m_core->settings().styleSheet(); - if (!styleSheetFile.isEmpty()) { - QFile sheet(styleSheetFile); - if (sheet.exists()) { - if (sheet.open(QIODevice::ReadOnly)) { - dialog.setStyleSheet(QString::fromLatin1(sheet.readAll())); - } else { - qCWarning(QInstaller::lcDeveloperBuild) << "The specified style sheet file " - "can not be opened."; - } - } else { - qCWarning(QInstaller::lcDeveloperBuild) << "A style sheet file is specified, " - "but it does not exist."; - } - } - connect(&dialog, &SettingsDialog::networkSettingsChanged, this, &TabController::onNetworkSettingsChanged); dialog.exec(); diff --git a/tests/auto/installer/binaryformat/tst_binaryformat.cpp b/tests/auto/installer/binaryformat/tst_binaryformat.cpp index c9cd2b00f..7e0f5ed24 100644 --- a/tests/auto/installer/binaryformat/tst_binaryformat.cpp +++ b/tests/auto/installer/binaryformat/tst_binaryformat.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -51,7 +51,7 @@ struct Layout : public QInstaller::BinaryLayout class TestOperation : public KDUpdater::UpdateOperation { public: - TestOperation(const QString &name) + explicit TestOperation(const QString &name) : KDUpdater::UpdateOperation(nullptr) { setName(name); } diff --git a/tests/auto/installer/clientserver/tst_clientserver.cpp b/tests/auto/installer/clientserver/tst_clientserver.cpp index 23442d5fa..29d4283b9 100644 --- a/tests/auto/installer/clientserver/tst_clientserver.cpp +++ b/tests/auto/installer/clientserver/tst_clientserver.cpp @@ -501,7 +501,7 @@ private slots: QFile file; file.setFileName(filename); file.open(QIODevice::ReadWrite); - const QByteArray ba = file.readLine(); + file.readLine(); file.seek(0); QCOMPARE(file.atEnd(), false); diff --git a/tests/auto/installer/cliinterface/data/repository/A/1.0.2-1content.7z b/tests/auto/installer/cliinterface/data/repository/A/1.0.2-1content.7z Binary files differdeleted file mode 100644 index 5a9383e7e..000000000 --- a/tests/auto/installer/cliinterface/data/repository/A/1.0.2-1content.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/repository/A/1.0.2-1content.7z.sha1 b/tests/auto/installer/cliinterface/data/repository/A/1.0.2-1content.7z.sha1 deleted file mode 100644 index fd0bc548c..000000000 --- a/tests/auto/installer/cliinterface/data/repository/A/1.0.2-1content.7z.sha1 +++ /dev/null @@ -1 +0,0 @@ -643cb71b2337d5a49d57a5bc3c636ee9b84c0802
\ No newline at end of file diff --git a/tests/auto/installer/cliinterface/data/repository/A/1.0.2-1meta.7z b/tests/auto/installer/cliinterface/data/repository/A/1.0.2-1meta.7z Binary files differdeleted file mode 100644 index 6ef0b7959..000000000 --- a/tests/auto/installer/cliinterface/data/repository/A/1.0.2-1meta.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/repository/AB/1.0.2-1meta.7z b/tests/auto/installer/cliinterface/data/repository/AB/1.0.2-1meta.7z Binary files differdeleted file mode 100644 index 6b5e5ac91..000000000 --- a/tests/auto/installer/cliinterface/data/repository/AB/1.0.2-1meta.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/repository/B/1.0.0-1content.7z b/tests/auto/installer/cliinterface/data/repository/B/1.0.0-1content.7z Binary files differdeleted file mode 100644 index dfe41ad15..000000000 --- a/tests/auto/installer/cliinterface/data/repository/B/1.0.0-1content.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/repository/B/1.0.0-1content.7z.sha1 b/tests/auto/installer/cliinterface/data/repository/B/1.0.0-1content.7z.sha1 deleted file mode 100644 index 50a632b49..000000000 --- a/tests/auto/installer/cliinterface/data/repository/B/1.0.0-1content.7z.sha1 +++ /dev/null @@ -1 +0,0 @@ -c7b9ab370efe036171dda7b71cd95021747cb101
\ No newline at end of file diff --git a/tests/auto/installer/cliinterface/data/repository/B/1.0.0-1meta.7z b/tests/auto/installer/cliinterface/data/repository/B/1.0.0-1meta.7z Binary files differdeleted file mode 100644 index 12d54f94c..000000000 --- a/tests/auto/installer/cliinterface/data/repository/B/1.0.0-1meta.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/repository/C/1.0.0-1content.7z b/tests/auto/installer/cliinterface/data/repository/C/1.0.0-1content.7z Binary files differdeleted file mode 100644 index 7d03dca9c..000000000 --- a/tests/auto/installer/cliinterface/data/repository/C/1.0.0-1content.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/repository/C/1.0.0-1content.7z.sha1 b/tests/auto/installer/cliinterface/data/repository/C/1.0.0-1content.7z.sha1 deleted file mode 100644 index 91ead97f0..000000000 --- a/tests/auto/installer/cliinterface/data/repository/C/1.0.0-1content.7z.sha1 +++ /dev/null @@ -1 +0,0 @@ -c8b7076fabaaf6b9d27f27350c577118c24f426b
\ No newline at end of file diff --git a/tests/auto/installer/cliinterface/data/repository/C/1.0.0-1meta.7z b/tests/auto/installer/cliinterface/data/repository/C/1.0.0-1meta.7z Binary files differdeleted file mode 100644 index 46bae0179..000000000 --- a/tests/auto/installer/cliinterface/data/repository/C/1.0.0-1meta.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/repository/Updates.xml b/tests/auto/installer/cliinterface/data/repository/Updates.xml index c7b11dc03..e5bc4f8af 100644 --- a/tests/auto/installer/cliinterface/data/repository/Updates.xml +++ b/tests/auto/installer/cliinterface/data/repository/Updates.xml @@ -35,6 +35,27 @@ <DownloadableArchives>content.7z</DownloadableArchives> <SHA1>5b3939da1af492382c68388fc796837e4c36b876</SHA1> </PackageUpdate> + <PackageUpdate> + <Name>C.virt</Name> + <DisplayName>Virtual subcomponent of C</DisplayName> + <Description>Example virtual component</Description> + <Version>1.0.0-1</Version> + <ReleaseDate>2015-01-01</ReleaseDate> + <Virtual>true</Virtual> + <UpdateFile CompressedSize="222" OS="Any" UncompressedSize="72"/> + <DownloadableArchives>content.7z</DownloadableArchives> + <SHA1>5b3939da1af492382c68388fc796837e4c36b876</SHA1> + </PackageUpdate> + <PackageUpdate> + <Name>C.virt.subcomponent</Name> + <DisplayName>Subcomponent of virtual component</DisplayName> + <Description>Example subcomponent of virtual component</Description> + <Version>1.0.0-1</Version> + <ReleaseDate>2015-01-01</ReleaseDate> + <UpdateFile CompressedSize="222" OS="Any" UncompressedSize="72"/> + <DownloadableArchives>content.7z</DownloadableArchives> + <SHA1>5b3939da1af492382c68388fc796837e4c36b876</SHA1> + </PackageUpdate> <PackageUpdate> <Name>AB</Name> <DisplayName>AB</DisplayName> diff --git a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/A/2.0.0content.7z b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/A/2.0.0content.7z Binary files differdeleted file mode 100644 index d7fbf4d8e..000000000 --- a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/A/2.0.0content.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/A/2.0.0content.7z.sha1 b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/A/2.0.0content.7z.sha1 deleted file mode 100644 index c5825de47..000000000 --- a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/A/2.0.0content.7z.sha1 +++ /dev/null @@ -1 +0,0 @@ -f33d2028e1c61061f7f29e5189f7d66800361dc2
\ No newline at end of file diff --git a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/A/2.0.0meta.7z b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/A/2.0.0meta.7z Binary files differdeleted file mode 100644 index d783c7c1c..000000000 --- a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/A/2.0.0meta.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/AB/1.0.2-1meta.7z b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/AB/1.0.2-1meta.7z Binary files differdeleted file mode 100644 index 20f2aca2d..000000000 --- a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/AB/1.0.2-1meta.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/B/2.0.0content.7z b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/B/2.0.0content.7z Binary files differdeleted file mode 100644 index bd0bc9352..000000000 --- a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/B/2.0.0content.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/B/2.0.0content.7z.sha1 b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/B/2.0.0content.7z.sha1 deleted file mode 100644 index e66535388..000000000 --- a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/B/2.0.0content.7z.sha1 +++ /dev/null @@ -1 +0,0 @@ -bb256f1eda0f452c7ab33d1f364a4fad062f0a73
\ No newline at end of file diff --git a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/B/2.0.0meta.7z b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/B/2.0.0meta.7z Binary files differdeleted file mode 100644 index f92853734..000000000 --- a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/B/2.0.0meta.7z +++ /dev/null diff --git a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml index e0aedffdd..f0c724db8 100644 --- a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml +++ b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml @@ -37,4 +37,14 @@ <SHA1>cfa136fa1d7a4196896c90af72d510727ba799ae</SHA1> <Virtual>true</Virtual> </PackageUpdate> + <PackageUpdate> + <Name>B.subcomponent</Name> + <DisplayName>Subcomponent of B</DisplayName> + <Description>Example non-virtual subcomponent of B</Description> + <Version>2.0.0</Version> + <ReleaseDate>2015-01-01</ReleaseDate> + <UpdateFile CompressedSize="224" OS="Any" UncompressedSize="74"/> + <DownloadableArchives>content.7z</DownloadableArchives> + <SHA1>cfa136fa1d7a4196896c90af72d510727ba799ae</SHA1> + </PackageUpdate> </Updates> diff --git a/tests/auto/installer/cliinterface/tst_cliinterface.cpp b/tests/auto/installer/cliinterface/tst_cliinterface.cpp index 550f45da2..98ea99133 100644 --- a/tests/auto/installer/cliinterface/tst_cliinterface.cpp +++ b/tests/auto/installer/cliinterface/tst_cliinterface.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -89,6 +89,15 @@ private slots: " <package name=\"C\" displayname=\"C\" version=\"1.0.0-1\"/>\n" "</availablepackages>\n"); core->listAvailablePackages(QLatin1String("^C")); + + // Need to change rules here to catch messages + QLoggingCategory::setFilterRules("ifw.* = true\n"); + + QTest::ignoreMessage(QtDebugMsg, "No matching packages found."); + core->listAvailablePackages(QLatin1String("C.virt")); + + QTest::ignoreMessage(QtDebugMsg, "No matching packages found."); + core->listAvailablePackages(QLatin1String("C.virt.subcomponent")); } void testInstallPackageFails() @@ -117,6 +126,11 @@ private slots: << QLatin1String("B"))); QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download..."); + QTest::ignoreMessage(QtDebugMsg, "Cannot install B.subcomponent. Component is descendant of a virtual component B.\n"); + QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList() + << QLatin1String("B.subcomponent"))); + + QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download..."); QTest::ignoreMessage(QtDebugMsg, "Cannot install MissingComponent. Component not found.\n"); QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList() << QLatin1String("MissingComponent"))); diff --git a/tests/auto/installer/factory/tst_factory.cpp b/tests/auto/installer/factory/tst_factory.cpp index f44a6febe..eb7e2c36c 100644 --- a/tests/auto/installer/factory/tst_factory.cpp +++ b/tests/auto/installer/factory/tst_factory.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -82,7 +82,7 @@ public: : Food(amount) , m_expireDate(expireDate) { qDebug().nospace().noquote() << "Constructor."; } - QDate expireDate() const { + QDate expireDate() const Q_DECL_OVERRIDE { return m_expireDate; } private: @@ -92,7 +92,7 @@ private: class Butter : public Food { public: - QDate expireDate() const { + QDate expireDate() const Q_DECL_OVERRIDE { return m_expireDate; } static Food *create(int amount, const QDate expireDate) { @@ -117,7 +117,7 @@ public: : Food(amount) , m_expireDate(expireDate) { qDebug().nospace().noquote() << "Constructor."; } - QDate expireDate() const { + QDate expireDate() const Q_DECL_OVERRIDE { return m_expireDate; } diff --git a/tests/auto/installer/metadatajob/data/config.xml b/tests/auto/installer/metadatajob/data/config.xml deleted file mode 100644 index 041ce5062..000000000 --- a/tests/auto/installer/metadatajob/data/config.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Installer> - <Name>Your application</Name> - <Version>1.2.3</Version> - <MaintenanceToolName></MaintenanceToolName> - <MaintenanceToolIniFile></MaintenanceToolIniFile> - <TargetConfigurationFile></TargetConfigurationFile> -</Installer> diff --git a/tests/auto/installer/metadatajob/settings.qrc b/tests/auto/installer/metadatajob/settings.qrc index c881f294b..6e56a7854 100644 --- a/tests/auto/installer/metadatajob/settings.qrc +++ b/tests/auto/installer/metadatajob/settings.qrc @@ -1,6 +1,5 @@ <RCC> <qresource prefix="/"> - <file>data/config.xml</file> <file>data/repository/Updates.xml</file> <file>data/repositoryActionAdd/Updates.xml</file> <file>data/repositoryActionRemove/Updates.xml</file> diff --git a/tests/auto/installer/metadatajob/tst_metadatajob.cpp b/tests/auto/installer/metadatajob/tst_metadatajob.cpp index ef7b42940..54609ab95 100644 --- a/tests/auto/installer/metadatajob/tst_metadatajob.cpp +++ b/tests/auto/installer/metadatajob/tst_metadatajob.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -47,7 +47,6 @@ class tst_MetaDataJob : public QObject private slots: void testRepository() { - Settings settings = Settings::fromFileAndPrefix(":///data/config.xml", ":///data"); PackageManagerCore core; core.setInstaller(); QSet<Repository> repoList; @@ -63,7 +62,6 @@ private slots: void testRepositoryUpdateActionAdd() { - Settings settings = Settings::fromFileAndPrefix(":///data/config.xml", ":///data"); PackageManagerCore core; core.setInstaller(); QSet<Repository> repoList; @@ -82,7 +80,6 @@ private slots: void testRepositoryUpdateActionRemove() { - Settings settings = Settings::fromFileAndPrefix(":///data/config.xml", ":///data"); PackageManagerCore core; core.setInstaller(); QSet<Repository> repoList; diff --git a/tests/auto/installer/packagemanagercore/tst_packagemanagercore.cpp b/tests/auto/installer/packagemanagercore/tst_packagemanagercore.cpp index 17343e49d..a3e86c2f8 100644 --- a/tests/auto/installer/packagemanagercore/tst_packagemanagercore.cpp +++ b/tests/auto/installer/packagemanagercore/tst_packagemanagercore.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -46,7 +46,7 @@ using namespace QInstaller; class DummyComponent : public Component { public: - DummyComponent(PackageManagerCore *core) + explicit DummyComponent(PackageManagerCore *core) : Component(core) { setCheckState(Qt::Checked); diff --git a/tests/auto/installer/registerfiletypeoperation/tst_registerfiletypeoperation.cpp b/tests/auto/installer/registerfiletypeoperation/tst_registerfiletypeoperation.cpp index 5a4377d7b..3e3005621 100644 --- a/tests/auto/installer/registerfiletypeoperation/tst_registerfiletypeoperation.cpp +++ b/tests/auto/installer/registerfiletypeoperation/tst_registerfiletypeoperation.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -80,7 +80,6 @@ private slots: QInstaller::init(); QString randomString = ""; const QString possible = "abcdefghijklmnopqrstuvwxyz0123456789"; - qsrand(QTime::currentTime().msec()); for (int i = 0; i < 5; i++) { int index = QRandomGenerator::global()->generate() % possible.length(); QChar nextChar = possible.at(index); diff --git a/tests/auto/tools/repotest/tst_repotest.cpp b/tests/auto/tools/repotest/tst_repotest.cpp index 228c13c80..c467d21d2 100644 --- a/tests/auto/tools/repotest/tst_repotest.cpp +++ b/tests/auto/tools/repotest/tst_repotest.cpp @@ -44,7 +44,7 @@ private: { QStringList filteredPackages; - QInstallerTools::PackageInfoVector m_packages = QInstallerTools::collectPackages(m_repoInfo, + m_packages = QInstallerTools::collectPackages(m_repoInfo, &filteredPackages, QInstallerTools::Exclude, updateNewComponents, packagesUpdatedWithSha); if (updateNewComponents) { //Verify that component B exists as that is not updated diff --git a/tools/devtool/binarydump.cpp b/tools/devtool/binarydump.cpp index bd8e9053c..bb0700149 100644 --- a/tools/devtool/binarydump.cpp +++ b/tools/devtool/binarydump.cpp @@ -117,10 +117,10 @@ int BinaryDump::dump(const QInstaller::ResourceCollectionManager &manager, const if ((!isOpen) && (!resource->open())) continue; // TODO: should we throw here? - QFile target(targetDir.filePath(name) + QDir::separator() + QFile targetFile(targetDir.filePath(name) + QDir::separator() + QString::fromUtf8(resource->name())); - QInstaller::openForWrite(&target); - resource->copyData(&target); // copy the 7z files into the target directory + QInstaller::openForWrite(&targetFile); + resource->copyData(&targetFile); // copy the 7z files into the target directory if (!isOpen) // If we reach that point, either the resource was opened already... resource->close(); // or we did open it and have to close it again. diff --git a/tools/devtool/main.cpp b/tools/devtool/main.cpp index 52db7d8b3..8da6dfb75 100644 --- a/tools/devtool/main.cpp +++ b/tools/devtool/main.cpp @@ -182,31 +182,31 @@ int main(int argc, char *argv[]) quint64 cookie = QInstaller::BinaryContent::MagicCookie; try { { - QFile tmp(path); - QInstaller::openForRead(&tmp); + QFile tmpFile(path); + QInstaller::openForRead(&tmpFile); - if (!tmp.seek(QInstaller::BinaryContent::findMagicCookie(&tmp, cookie) - sizeof(qint64))) + if (!tmpFile.seek(QInstaller::BinaryContent::findMagicCookie(&tmpFile, cookie) - sizeof(qint64))) throw QInstaller::Error(QLatin1String("Cannot seek to read magic marker.")); QInstaller::BinaryLayout layout; - layout.magicMarker = QInstaller::retrieveInt64(&tmp); + layout.magicMarker = QInstaller::retrieveInt64(&tmpFile); if (layout.magicMarker == QInstaller::BinaryContent::MagicUninstallerMarker) { - QFileInfo fi(path); + QFileInfo fileInfo(path); - QInstaller::isInBundle(fi.absoluteFilePath(), &bundlePath); - fi.setFile(bundlePath); + QInstaller::isInBundle(fileInfo.absoluteFilePath(), &bundlePath); + fileInfo.setFile(bundlePath); - path = fi.absolutePath() + QLatin1Char('/') + fi.baseName() + QLatin1String(".dat"); + path = fileInfo.absolutePath() + QLatin1Char('/') + fileInfo.baseName() + QLatin1String(".dat"); - tmp.close(); - tmp.setFileName(path); - QInstaller::openForRead(&tmp); + tmpFile.close(); + tmpFile.setFileName(path); + QInstaller::openForRead(&tmpFile); cookie = QInstaller::BinaryContent::MagicCookieDat; } - layout = QInstaller::BinaryContent::binaryLayout(&tmp, cookie); - tmp.close(); + layout = QInstaller::BinaryContent::binaryLayout(&tmpFile, cookie); + tmpFile.close(); if (command == QLatin1String("update")) { BinaryReplace br(layout); // To update the binary we do not need any mapping. diff --git a/tools/repocompare/repositorymanager.cpp b/tools/repocompare/repositorymanager.cpp index 3fb863eaf..e4405d103 100644 --- a/tools/repocompare/repositorymanager.cpp +++ b/tools/repocompare/repositorymanager.cpp @@ -120,6 +120,7 @@ void RepositoryManager::createRepositoryMap(const QByteArray &data, QMap<QString currentDescription.updateText.clear(); currentDescription.version.clear(); currentDescription.checksum.clear(); + currentDescription.update = false; } if (reader.name() == QLatin1String("SHA1")) currentDescription.checksum = reader.readElementText(); |