summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-06-17 12:18:50 +0300
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-06-17 12:18:50 +0300
commit15d7423eda0cfc1293fd34abbad7fc13eea07a57 (patch)
tree988ca626f73a8657e75b41bc56ca56da84139674
parent88941150c353b4386d9eb478388affe2d49f6be9 (diff)
parent1e1c4311ff71560be62589547d3113683b6084e1 (diff)
Merge remote-tracking branch 'origin/4.1'
-rw-r--r--coin/instructions/make_instructions.yaml10
-rw-r--r--doc/operations.qdoc5
-rw-r--r--src/libs/installer/settings.cpp2
-rw-r--r--src/sdk/commandlineinterface.cpp7
-rw-r--r--src/sdk/installerbase.cpp58
-rw-r--r--src/sdk/sdkapp.h84
6 files changed, 94 insertions, 72 deletions
diff --git a/coin/instructions/make_instructions.yaml b/coin/instructions/make_instructions.yaml
index 0eaf2bfd2..2d2041f6d 100644
--- a/coin/instructions/make_instructions.yaml
+++ b/coin/instructions/make_instructions.yaml
@@ -97,7 +97,7 @@ instructions:
- type: ChangeDirectory
directory: "{{.InstallRoot}}/{{.AgentWorkingDir}}"
- type: ExecuteCommand
- command: "python3 {{.SourceDir}}/coin/create_ifw_installer.py --src-dir {{.SourceDir}} --bld-dir {{.SourceDir}} --target-dir {{.SourceDir}}/IfwInstaller --target-name QtInstallerFramework-macOS-x86_64-4.2.0.app"
+ command: "python3 {{.SourceDir}}/coin/create_ifw_installer.py --src-dir {{.SourceDir}} --bld-dir {{.SourceDir}} --target-dir {{.SourceDir}}/IfwInstaller --target-name QtInstallerFramework-macOS-x64-4.2.0.app"
maxTimeInSeconds: 36000
maxTimeBetweenOutput: 3600
userMessageOnFailure: "Failed to create ifw installer."
@@ -105,18 +105,18 @@ instructions:
variableName: QT_CODESIGN_IDENTITY_KEY
variableValue: "A5GTH44LYL"
- type: ExecuteCommand
- command: "{{.AgentWorkingDir}}/qtsdk/qtsdk/packaging-tools/sign_installer.py mac --file={{.SourceDir}}/IfwInstaller/QtInstallerFramework-macOS-x86_64-4.2.0.app"
+ command: "{{.AgentWorkingDir}}/qtsdk/qtsdk/packaging-tools/sign_installer.py mac --file={{.SourceDir}}/IfwInstaller/QtInstallerFramework-macOS-x64-4.2.0.app"
maxTimeInSeconds: 36000
maxTimeBetweenOutput: 3600
userMessageOnFailure: "Failed to sign the ifw installer"
- type: ExecuteCommand
- command: "{{.AgentWorkingDir}}/qtsdk/qtsdk/packaging-tools/notarize.py --dmg={{.SourceDir}}/IfwInstaller/QtInstallerFramework-macOS-x86_64-4.2.0.dmg"
+ command: "{{.AgentWorkingDir}}/qtsdk/qtsdk/packaging-tools/notarize.py --dmg={{.SourceDir}}/IfwInstaller/QtInstallerFramework-macOS-x64-4.2.0.dmg"
maxTimeInSeconds: 36000
maxTimeBetweenOutput: 3600
userMessageOnFailure: "Failed to notarize the ifw installer"
- type: Rename
- sourcePath: "{{.SourceDir}}/IfwInstaller/QtInstallerFramework-macOS-x86_64-4.2.0.dmg"
- targetPath: "{{.InstallRoot}}/{{.AgentWorkingDir}}/QtInstallerFramework-macOS-x86_64-4.2.0.dmg"
+ sourcePath: "{{.SourceDir}}/IfwInstaller/QtInstallerFramework-macOS-x64-4.2.0.dmg"
+ targetPath: "{{.InstallRoot}}/{{.AgentWorkingDir}}/QtInstallerFramework-macOS-x64-4.2.0.dmg"
userMessageOnFailure: "Failed to copy installer."
enable_if:
condition: and
diff --git a/doc/operations.qdoc b/doc/operations.qdoc
index 854e1819d..7862cdaab 100644
--- a/doc/operations.qdoc
+++ b/doc/operations.qdoc
@@ -150,6 +150,11 @@
On Windows, this creates a .lnk file which can have
\c arguments. Furthermore, \c filename can be
an HTTP or FTP URL in which case a URL shortcut is created.
+ \note If the \c @AllUsersStartMenuProgramsPath@ is used for
+ placing the shortcut, then due to a problem on Windows, it will
+ drop any arguments to the target and any description set. In
+ this case, you should place the shortcut elsewhere and copy it
+ to the location desired.
The operation is currently not implemented on other platforms.
\row
\li CreateDesktopEntry
diff --git a/src/libs/installer/settings.cpp b/src/libs/installer/settings.cpp
index 7273080f9..537f6060b 100644
--- a/src/libs/installer/settings.cpp
+++ b/src/libs/installer/settings.cpp
@@ -322,7 +322,7 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix,
reader.raiseError(QString::fromLatin1("Element \"%1\" has been defined before.").arg(name));
if (name == scTranslations) {
- s.setTranslations(readArgumentAttributes(reader, parseMode, QLatin1String("Translation"), true));
+ s.setTranslations(readArgumentAttributes(reader, parseMode, QLatin1String("Translation"), false));
} else if (name == scRunProgramArguments) {
s.setRunProgramArguments(readArgumentAttributes(reader, parseMode, QLatin1String("Argument")));
} else if (name == scProductImages) {
diff --git a/src/sdk/commandlineinterface.cpp b/src/sdk/commandlineinterface.cpp
index a6cd22151..59e9afe90 100644
--- a/src/sdk/commandlineinterface.cpp
+++ b/src/sdk/commandlineinterface.cpp
@@ -78,6 +78,13 @@ bool CommandLineInterface::initialize()
// quite safe to assume that command is the first positional argument.
m_positionalArguments.removeFirst();
}
+
+ QString ctrlScript = controlScript();
+ if (!ctrlScript.isEmpty()) {
+ m_core->controlScriptEngine()->loadInContext(
+ QLatin1String("Controller"), ctrlScript);
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Loaded control script" << ctrlScript;
+ }
return true;
}
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp
index a31278d03..32df0b550 100644
--- a/src/sdk/installerbase.cpp
+++ b/src/sdk/installerbase.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.
@@ -40,7 +40,6 @@
#include <QDir>
#include <QDirIterator>
#include <QFontDatabase>
-#include <QTranslator>
#ifdef ENABLE_SQUISH
#include <qtbuiltinhook.h>
@@ -71,61 +70,10 @@ int InstallerBase::run()
f.setItalic(true);
QInstaller::PackageManagerCore::setVirtualComponentsFont(f);
}
- QString controlScript;
- if (m_parser.isSet(CommandLineOptions::scScriptLong)) {
- controlScript = m_parser.value(CommandLineOptions::scScriptLong);
- if (!QFileInfo(controlScript).exists()) {
- qCDebug(QInstaller::lcInstallerInstallLog) << "Script file does not exist.";
- return false;
- }
- } else if (!m_core->settings().controlScript().isEmpty()) {
- controlScript = QLatin1String(":/metadata/installer-config/")
- + m_core->settings().controlScript();
- }
qCDebug(QInstaller::lcInstallerInstallLog) << "Language:" << QLocale().uiLanguages()
.value(0, QLatin1String("No UI language set")).toUtf8().constData();
-#ifndef IFW_DISABLE_TRANSLATIONS
- const QString directory = QLatin1String(":/translations");
- // Check if there is a modified translation first to enable people
- // to easily provide corrected translations to Qt/IFW for their installers
- const QString newDirectory = QLatin1String(":/translations_new");
- const QStringList translations = m_core->settings().translations();
-
- if (translations.isEmpty()) {
- foreach (const QLocale locale, QLocale().uiLanguages()) {
- QScopedPointer<QTranslator> qtTranslator(new QTranslator(QCoreApplication::instance()));
- bool qtLoaded = qtTranslator->load(locale, QLatin1String("qt"),
- QLatin1String("_"), newDirectory);
- if (!qtLoaded)
- qtLoaded = qtTranslator->load(locale, QLatin1String("qt"),
- QLatin1String("_"), directory);
-
- if (qtLoaded || locale.language() == QLocale::English) {
- if (qtLoaded)
- QCoreApplication::instance()->installTranslator(qtTranslator.take());
-
- QScopedPointer<QTranslator> ifwTranslator(new QTranslator(QCoreApplication::instance()));
- bool ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), newDirectory);
- if (!ifwLoaded)
- ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), directory);
- if (ifwLoaded)
- QCoreApplication::instance()->installTranslator(ifwTranslator.take());
-
- // To stop loading other translations it's sufficient that
- // qt was loaded successfully or we hit English as system language
- emit m_core->defaultTranslationsLoadedForLanguage(locale.language());
- break;
- }
- }
- } else {
- foreach (const QString &translation, translations) {
- QScopedPointer<QTranslator> translator(new QTranslator(QCoreApplication::instance()));
- if (translator->load(translation, QLatin1String(":/translations")))
- QCoreApplication::instance()->installTranslator(translator.take());
- }
- }
-#endif
+
{
QDirIterator fontIt(QStringLiteral(":/fonts"));
while (fontIt.hasNext()) {
@@ -138,7 +86,7 @@ int InstallerBase::run()
//create the wizard GUI
TabController controller(nullptr);
controller.setManager(m_core);
- controller.setControlScript(controlScript);
+ controller.setControlScript(controlScript());
if (m_core->isInstaller())
controller.setGui(new InstallerGui(m_core));
else
diff --git a/src/sdk/sdkapp.h b/src/sdk/sdkapp.h
index 0c6c362bc..f1f3cf25c 100644
--- a/src/sdk/sdkapp.h
+++ b/src/sdk/sdkapp.h
@@ -47,6 +47,7 @@
#include <globals.h>
#include <errors.h>
#include <loggingutils.h>
+#include <scriptengine.h>
#include <QApplication>
#include <QDir>
@@ -57,6 +58,7 @@
#include <QUuid>
#include <QMessageBox>
#include <QMetaEnum>
+#include <QTranslator>
template<class T>
class SDKApp : public T
@@ -92,17 +94,6 @@ public:
bool init(QString &errorMessage) {
QString appname = qApp->applicationName();
- if (m_runCheck.isRunning(RunOnceChecker::ConditionFlag::Lockfile)) {
- // It is possible to install an application and thus the maintenance tool into a
- // directory that requires elevated permission to create a lock file. Since this
- // cannot be done without requesting credentials from the user, we silently ignore
- // the fact that we could not create the lock file and check the running processes.
- if (m_runCheck.isRunning(RunOnceChecker::ConditionFlag::ProcessList)) {
- errorMessage = QObject::tr("Another %1 instance is already running. Wait "
- "until it finishes, close it, or restart your system.").arg(qAppName());
- return false;
- }
- }
QFile binary(binaryFile());
#ifdef Q_OS_WIN
// On some admin user installations it is possible that the installer.dat
@@ -205,6 +196,62 @@ public:
QInstaller::Protocol::Mode::Production, userArgs, isCommandLineInterface);
}
+#ifndef IFW_DISABLE_TRANSLATIONS
+ if (!isCommandLineInterface) {
+ const QString directory = QLatin1String(":/translations");
+ // Check if there is a modified translation first to enable people
+ // to easily provide corrected translations to Qt/IFW for their installers
+ const QString newDirectory = QLatin1String(":/translations_new");
+ const QStringList translations = m_core->settings().translations();
+
+ if (translations.isEmpty()) {
+ foreach (const QLocale locale, QLocale().uiLanguages()) {
+ QScopedPointer<QTranslator> qtTranslator(new QTranslator(QCoreApplication::instance()));
+ bool qtLoaded = qtTranslator->load(locale, QLatin1String("qt"),
+ QLatin1String("_"), newDirectory);
+ if (!qtLoaded)
+ qtLoaded = qtTranslator->load(locale, QLatin1String("qt"),
+ QLatin1String("_"), directory);
+
+ if (qtLoaded || locale.language() == QLocale::English) {
+ if (qtLoaded)
+ QCoreApplication::instance()->installTranslator(qtTranslator.take());
+
+ QScopedPointer<QTranslator> ifwTranslator(new QTranslator(QCoreApplication::instance()));
+ bool ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), newDirectory);
+ if (!ifwLoaded)
+ ifwLoaded = ifwTranslator->load(locale, QLatin1String("ifw"), QLatin1String("_"), directory);
+ if (ifwLoaded)
+ QCoreApplication::instance()->installTranslator(ifwTranslator.take());
+
+ // To stop loading other translations it's sufficient that
+ // qt was loaded successfully or we hit English as system language
+ emit m_core->defaultTranslationsLoadedForLanguage(locale.language());
+ break;
+ }
+ }
+ } else {
+ foreach (const QString &translation, translations) {
+ QScopedPointer<QTranslator> translator(new QTranslator(QCoreApplication::instance()));
+ if (translator->load(translation, QLatin1String(":/translations")))
+ QCoreApplication::instance()->installTranslator(translator.take());
+ }
+ }
+ }
+#endif
+
+ if (m_runCheck.isRunning(RunOnceChecker::ConditionFlag::Lockfile)) {
+ // It is possible to install an application and thus the maintenance tool into a
+ // directory that requires elevated permission to create a lock file. Since this
+ // cannot be done without requesting credentials from the user, we silently ignore
+ // the fact that we could not create the lock file and check the running processes.
+ if (m_runCheck.isRunning(RunOnceChecker::ConditionFlag::ProcessList)) {
+ errorMessage = QObject::tr("Another %1 instance is already running. Wait "
+ "until it finishes, close it, or restart your system.").arg(qAppName());
+ return false;
+ }
+ }
+
// From Qt5.8 onwards system proxy is used by default. If Qt is built with
// QT_USE_SYSTEM_PROXIES false then system proxies are not used by default.
if (m_parser.isSet(CommandLineOptions::scNoProxyLong)) {
@@ -492,6 +539,21 @@ public:
}
}
+ QString controlScript()
+ {
+ QString controlScript = QString();
+ if (m_parser.isSet(CommandLineOptions::scScriptLong)) {
+ controlScript = m_parser.value(CommandLineOptions::scScriptLong);
+ if (!QFileInfo(controlScript).exists())
+ qCDebug(QInstaller::lcInstallerInstallLog) << "Script file does not exist.";
+
+ } else if (!m_core->settings().controlScript().isEmpty()) {
+ controlScript = QLatin1String(":/metadata/installer-config/")
+ + m_core->settings().controlScript();
+ }
+ return controlScript;
+ }
+
private:
QList<QByteArray> m_resourceMappings;