diff options
author | Katja Marttila <katja.marttila@qt.io> | 2020-04-20 11:20:45 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2020-04-28 09:38:30 +0300 |
commit | 4f5eace163eeb34504cb8044c42b147df03fafed (patch) | |
tree | 8e953142cb3b798c4dbc99684aec912e7df49b08 /src/libs/installer/globals.cpp | |
parent | a05dc40daa16819823eeddb50a9fcc4656eb8f3b (diff) |
Answer queries from command line
Standard input is possible in Windows only in console application. This
change makes installers to be console applications by default. If
started as gui from command line, console is released and application
is restarted so cmd.exe won't be waiting for application to finish.
If started from explorer, console is launched but released immediately.
This may be seen on screen with short console flash.
Using command line interface messagebox strings and possible answer
values for it are printed to console. Answers must be given in case
sensitive format as StandardButton QMetaEnum is utilized when reading
button values. This ensures that if StandardButtons are
added/removed/changed the code continues to work.
Also added a new option 'default-answer' which will answer the questions
with default button values without user interaction.
Task-number: QTIFW-1739
Change-Id: I710f921f5c927dbd13090af32f93656dded84e72
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs/installer/globals.cpp')
-rw-r--r-- | src/libs/installer/globals.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libs/installer/globals.cpp b/src/libs/installer/globals.cpp index 231702c6f..a6453c1d9 100644 --- a/src/libs/installer/globals.cpp +++ b/src/libs/installer/globals.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -26,6 +26,7 @@ ** **************************************************************************/ #include <QTextDocument> +#include <QMetaEnum> #include "globals.h" @@ -150,5 +151,16 @@ QString htmlToString(const QString &html) return doc.toPlainText(); } +QString enumToString(const QMetaObject& metaObject, const char *enumerator, int key) +{ + QString value = QString(); + int enumIndex = metaObject.indexOfEnumerator(enumerator); + if (enumIndex != -1) { + QMetaEnum en = metaObject.enumerator(enumIndex); + value = QLatin1String(en.valueToKey(key)); + } + return value; +} + } // namespace QInstaller |