diff --git a/src/app/core/qcommandlineoption.cpp b/src/app/core/qcommandlineoption.cpp
index a063a1fea..a18f3e2a9 100644
--- a/src/app/core/qcommandlineoption.cpp
+++ b/src/app/core/qcommandlineoption.cpp
@@ -34,7 +34,6 @@ class QCommandLineOptionPrivate : public QSharedData
{
public:
inline QCommandLineOptionPrivate()
- : hidden(false)
{ }
void setNames(const QStringList &nameList);
@@ -51,9 +50,6 @@ public:
//! The list of default values used for this option.
QStringList defaultValues;
-
- //! Show or hide in --help
- bool hidden;
};
#ifdef Q_CC_GNU
@@ -362,29 +358,4 @@ QStringList QCommandLineOption::defaultValues() const
return d->defaultValues;
}
-/*!
- Sets whether to hide this option in the user-visible help output.
-
- All options are visible by default. Setting \a hidden to true for
- a particular option makes it internal, i.e. not listed in the help output.
-
- \since 5.6
- \sa isHidden
- */
-void QCommandLineOption::setHidden(bool hide)
-{
- d->hidden = hide;
-}
-
-/*!
- Returns true if this option is omitted from the help output,
- false if the option is listed.
-
- \since 5.6
- \sa setHidden()
- */
-bool QCommandLineOption::isHidden() const
-{
- return d->hidden;
-}
#endif //QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
diff --git a/src/app/core/qcommandlineoption.h b/src/app/core/qcommandlineoption.h
index 92fd65109..abc2abeae 100644
--- a/src/app/core/qcommandlineoption.h
+++ b/src/app/core/qcommandlineoption.h
@@ -69,9 +69,6 @@ public:
void setDefaultValues(const QStringList &defaultValues);
QStringList defaultValues() const;
- void setHidden(bool hidden);
- bool isHidden() const;
-
private:
QSharedDataPointer elements should be used:
@@ -224,20 +217,36 @@ QStringList QCommandLineParserPrivate::aliases(const QString &optionName) const
case CommandLineOk:
break;
case CommandLineError:
+#ifdef Q_OS_WIN
QMessageBox::warning(0, QGuiApplication::applicationDisplayName(),
"
" + errorMessage + "
"
+ parser.helpText() + "
");
+#else
+ fputs(qPrintable(errorMessage), stderr);
+ fputs("\n\n", stderr);
+ fputs(qPrintable(parser.helpText()), stderr);
+#endif
return 1;
case CommandLineVersionRequested:
+#ifdef Q_OS_WIN
QMessageBox::information(0, QGuiApplication::applicationDisplayName(),
QGuiApplication::applicationDisplayName() + ' '
+ QCoreApplication::applicationVersion());
+#else
+ printf("%s %s\n", QGuiApplication::applicationDisplayName(),
+ qPrintable(QCoreApplication::applicationVersion()));
+#endif
return 0;
case CommandLineHelpRequested:
+#ifdef Q_OS_WIN
QMessageBox::warning(0, QGuiApplication::applicationDisplayName(),
"
" + parser.helpText() + ""); return 0; +#else + parser.showHelp(); + Q_UNREACHABLE(); +#endif } \endcode @@ -296,41 +305,6 @@ void QCommandLineParser::setSingleDashWordOptionMode(QCommandLineParser::SingleD d->singleDashWordOptionMode = singleDashWordOptionMode; } -/*! - \enum QCommandLineParser::OptionsAfterPositionalArgumentsMode - - This enum describes the way the parser interprets options that - occur after positional arguments. - - \value ParseAsOptions \c{application argument --opt -t} is interpreted as setting - the options \c{opt} and \c{t}, just like \c{application --opt -t argument} would do. - This is the default parsing mode. In order to specify that \c{--opt} and \c{-t} - are positional arguments instead, the user can use \c{--}, as in - \c{application argument -- --opt -t}. - - \value ParseAsPositionalArguments \c{application argument --opt} is interpreted as - having two positional arguments, \c{argument} and \c{--opt}. - This mode is useful for executables that aim to launch other executables - (e.g. wrappers, debugging tools, etc.) or that support internal commands - followed by options for the command. \c{argument} is the name of the command, - and all options occurring after it can be collected and parsed by another - command line parser, possibly in another executable. - - \sa setOptionsAfterPositionalArgumentsMode() - - \since 5.5 -*/ - -/*! - Sets the parsing mode to \a parsingMode. - This must be called before process() or parse(). - \since 5.5 -*/ -void QCommandLineParser::setOptionsAfterPositionalArgumentsMode(QCommandLineParser::OptionsAfterPositionalArgumentsMode parsingMode) -{ - d->optionsAfterPositionalArgumentsMode = parsingMode; -} - /*! Adds the option \a option to look for while parsing. @@ -515,41 +489,6 @@ QString QCommandLineParser::errorText() const return QString(); } -enum MessageType { UsageMessage, ErrorMessage }; - -#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) -// Return whether to use a message box. Use handles if a console can be obtained -// or we are run with redirected handles (for example, by QProcess). -static inline bool displayMessageBox() -{ - if (GetConsoleWindow()) - return false; - STARTUPINFO startupInfo; - startupInfo.cb = sizeof(STARTUPINFO); - GetStartupInfo(&startupInfo); - return !(startupInfo.dwFlags & STARTF_USESTDHANDLES); -} -#endif // Q_OS_WIN && !QT_BOOTSTRAPPED && !Q_OS_WIN && !Q_OS_WINRT - -static void showParserMessage(const QString &message, MessageType type) -{ -#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) - if (displayMessageBox()) { - const UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND - | (type == UsageMessage ? MB_ICONINFORMATION : MB_ICONERROR); - QString title; - if (QCoreApplication::instance()) - title = QCoreApplication::instance()->property("applicationDisplayName").toString(); - if (title.isEmpty()) - title = QCoreApplication::applicationName(); - MessageBoxW(0, reinterpret_cast