Revise legal notice

For GUI and non-daemon console, the legal notice won't ask for user acceptance anymore and only
provide an OK button (or Enter key in console) from now on.
For daemon mode, qbt will print the legal notice and continue to run. It will also notify user
to use command line option `--confirm-legal-notice` to suppress the message. The message will be
printed on every start up unless user specify the command line option once.

PR #20080.
This commit is contained in:
Chocobo1 2023-12-05 03:13:37 +08:00 committed by GitHub
parent 608efc77e8
commit 0dbac78e17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 169 additions and 93 deletions

View file

@ -302,7 +302,10 @@ namespace
};
constexpr const BoolOption SHOW_HELP_OPTION {"help", 'h'};
#if !defined(Q_OS_WIN) || defined(DISABLE_GUI)
constexpr const BoolOption SHOW_VERSION_OPTION {"version", 'v'};
#endif
constexpr const BoolOption CONFIRM_LEGAL_NOTICE {"confirm-legal-notice"};
#if defined(DISABLE_GUI) && !defined(Q_OS_WIN)
constexpr const BoolOption DAEMON_OPTION {"daemon", 'd'};
#else
@ -323,7 +326,8 @@ namespace
}
QBtCommandLineParameters::QBtCommandLineParameters(const QProcessEnvironment &env)
: relativeFastresumePaths(RELATIVE_FASTRESUME.value(env))
: confirmLegalNotice(CONFIRM_LEGAL_NOTICE.value(env))
, relativeFastresumePaths(RELATIVE_FASTRESUME.value(env))
#ifndef DISABLE_GUI
, noSplash(NO_SPLASH_OPTION.value(env))
#elif !defined(Q_OS_WIN)
@ -365,6 +369,10 @@ QBtCommandLineParameters parseCommandLine(const QStringList &args)
result.showVersion = true;
}
#endif
else if (arg == CONFIRM_LEGAL_NOTICE)
{
result.confirmLegalNotice = true;
}
else if (arg == WEBUI_PORT_OPTION)
{
result.webUIPort = WEBUI_PORT_OPTION.value(arg);
@ -484,10 +492,11 @@ QString makeUsage(const QString &prgName)
+ indentation + prgName + u' ' + QCoreApplication::translate("CMD Options", "[options] [(<filename> | <url>)...]") + u'\n'
+ QCoreApplication::translate("CMD Options", "Options:") + u'\n'
+ SHOW_HELP_OPTION.usage() + wrapText(QCoreApplication::translate("CMD Options", "Display this help message and exit")) + u'\n'
#if !defined(Q_OS_WIN) || defined(DISABLE_GUI)
+ SHOW_VERSION_OPTION.usage() + wrapText(QCoreApplication::translate("CMD Options", "Display program version and exit")) + u'\n'
#endif
+ SHOW_HELP_OPTION.usage() + wrapText(QCoreApplication::translate("CMD Options", "Display this help message and exit")) + u'\n'
+ CONFIRM_LEGAL_NOTICE.usage() + wrapText(QCoreApplication::translate("CMD Options", "Confirm the legal notice")) + u'\n'
+ WEBUI_PORT_OPTION.usage(QCoreApplication::translate("CMD Options", "port"))
+ wrapText(QCoreApplication::translate("CMD Options", "Change the WebUI port"))
+ u'\n'