From 6ec6ac70d98195bb41a5ed60e47984bc640066fc Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Tue, 26 Oct 2021 08:50:07 +0300 Subject: Add click option for product image Product image can now be clicked. It opens either url in Web browser or if file reference is given, then it will be opened with the suitable application. Task-number: QTIFW-2361 Change-Id: I59ed1355e90c23c8d0a5124779725825ca1ee2c8 Reviewed-by: Arttu Tarkiainen --- src/libs/ifwtools/binarycreator.cpp | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'src/libs/ifwtools/binarycreator.cpp') diff --git a/src/libs/ifwtools/binarycreator.cpp b/src/libs/ifwtools/binarycreator.cpp index 95ff93393..7ea652250 100644 --- a/src/libs/ifwtools/binarycreator.cpp +++ b/src/libs/ifwtools/binarycreator.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2021 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. @@ -609,17 +609,28 @@ void QInstallerTools::copyConfigData(const QString &configFile, const QString &t qDebug().noquote() << QString::fromLatin1("Read dom element: <%1>%2.").arg(tagName, elementText); if (tagName == QLatin1String("ProductImages")) { - const QDomNodeList childNodes = domElement.childNodes(); - for (int index = 0; index < childNodes.count(); ++index) { - const QDomElement childElement = childNodes.at(index).toElement(); - const QString childName = childElement.tagName(); - if (childName != QLatin1String("Image")) + const QDomNodeList productImageNode = domElement.childNodes(); + for (int j = 0; j < productImageNode.count(); ++j) { + QDomElement productImagesElement = productImageNode.at(j).toElement(); + if (productImagesElement.isNull()) continue; + const QString childName = productImagesElement.tagName(); + if (childName != QLatin1String("ProductImage")) + continue; + const QDomNodeList imageNode = productImagesElement.childNodes(); + for (int k = 0; k < imageNode.count(); ++k) { + QDomElement productImageElement = imageNode.at(k).toElement(); + if (productImageElement.isNull()) + continue; + const QString imageChildName = productImageElement.tagName(); + if (imageChildName != QLatin1String("Image")) + continue; + const QString targetFile = targetDir + QLatin1Char('/') + productImageElement.text(); + const QFileInfo childFileInfo = QFileInfo(sourceConfigFilePath, productImageElement.text()); + QInstallerTools::copyWithException(childFileInfo.absoluteFilePath(), targetFile, imageChildName); + copyHighDPIImage(childFileInfo, imageChildName, targetFile); + } - const QString targetFile = targetDir + QLatin1Char('/') + childElement.text(); - const QFileInfo childFileInfo = QFileInfo(sourceConfigFilePath, childElement.text()); - QInstallerTools::copyWithException(childFileInfo.absoluteFilePath(), targetFile, childName); - copyHighDPIImage(childFileInfo, childName, targetFile); } continue; } -- cgit v1.2.3