mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
Merge pull request #9702 from knackebrot/master
Fix building qbittorrent-nox on Windows
This commit is contained in:
commit
36f6e9b288
3 changed files with 42 additions and 24 deletions
|
@ -37,7 +37,7 @@
|
|||
#include <QProcessEnvironment>
|
||||
#include <QTextStream>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN) && !defined(DISABLE_GUI)
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
|
||||
|
@ -310,7 +310,7 @@ namespace
|
|||
|
||||
constexpr const BoolOption SHOW_HELP_OPTION {"help", 'h'};
|
||||
constexpr const BoolOption SHOW_VERSION_OPTION {"version", 'v'};
|
||||
#ifdef DISABLE_GUI
|
||||
#if defined(DISABLE_GUI) && !defined(Q_OS_WIN)
|
||||
constexpr const BoolOption DAEMON_OPTION {"daemon", 'd'};
|
||||
#else
|
||||
constexpr const BoolOption NO_SPLASH_OPTION {"no-splash"};
|
||||
|
@ -336,12 +336,12 @@ QBtCommandLineParameters::QBtCommandLineParameters(const QProcessEnvironment &en
|
|||
, skipChecking(SKIP_HASH_CHECK_OPTION.value(env))
|
||||
, sequential(SEQUENTIAL_OPTION.value(env))
|
||||
, firstLastPiecePriority(FIRST_AND_LAST_OPTION.value(env))
|
||||
#ifndef Q_OS_WIN
|
||||
#if !defined(Q_OS_WIN) || defined(DISABLE_GUI)
|
||||
, showVersion(false)
|
||||
#endif
|
||||
#ifndef DISABLE_GUI
|
||||
, noSplash(NO_SPLASH_OPTION.value(env))
|
||||
#else
|
||||
#elif !defined(Q_OS_WIN)
|
||||
, shouldDaemonize(DAEMON_OPTION.value(env))
|
||||
#endif
|
||||
, webUiPort(WEBUI_PORT_OPTION.value(env, -1))
|
||||
|
@ -411,7 +411,7 @@ QBtCommandLineParameters parseCommandLine(const QStringList &args)
|
|||
if (arg == SHOW_HELP_OPTION) {
|
||||
result.showHelp = true;
|
||||
}
|
||||
#ifndef Q_OS_WIN
|
||||
#if !defined(Q_OS_WIN) || defined(DISABLE_GUI)
|
||||
else if (arg == SHOW_VERSION_OPTION) {
|
||||
result.showVersion = true;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ QBtCommandLineParameters parseCommandLine(const QStringList &args)
|
|||
else if (arg == NO_SPLASH_OPTION) {
|
||||
result.noSplash = true;
|
||||
}
|
||||
#else
|
||||
#elif !defined(Q_OS_WIN)
|
||||
else if (arg == DAEMON_OPTION) {
|
||||
result.shouldDaemonize = true;
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ QString makeUsage(const QString &prgName)
|
|||
stream << indentation << prgName << QLatin1String(" [options] [(<filename> | <url>)...]") << '\n';
|
||||
|
||||
stream << QObject::tr("Options:") << '\n';
|
||||
#ifndef Q_OS_WIN
|
||||
#if !defined(Q_OS_WIN) || defined(DISABLE_GUI)
|
||||
stream << SHOW_VERSION_OPTION.usage() << wrapText(QObject::tr("Display program version and exit")) << '\n';
|
||||
#endif
|
||||
stream << SHOW_HELP_OPTION.usage() << wrapText(QObject::tr("Display this help message and exit")) << '\n';
|
||||
|
@ -533,7 +533,7 @@ QString makeUsage(const QString &prgName)
|
|||
<< '\n';
|
||||
#ifndef DISABLE_GUI
|
||||
stream << NO_SPLASH_OPTION.usage() << wrapText(QObject::tr("Disable splash screen")) << '\n';
|
||||
#else
|
||||
#elif !defined(Q_OS_WIN)
|
||||
stream << DAEMON_OPTION.usage() << wrapText(QObject::tr("Run in daemon-mode (background)")) << '\n';
|
||||
#endif
|
||||
//: Use appropriate short form or abbreviation of "directory"
|
||||
|
@ -579,12 +579,12 @@ QString makeUsage(const QString &prgName)
|
|||
|
||||
void displayUsage(const QString &prgName)
|
||||
{
|
||||
#ifndef Q_OS_WIN
|
||||
printf("%s\n", qUtf8Printable(makeUsage(prgName)));
|
||||
#else
|
||||
#if defined(Q_OS_WIN) && !defined(DISABLE_GUI)
|
||||
QMessageBox msgBox(QMessageBox::Information, QObject::tr("Help"), makeUsage(prgName), QMessageBox::Ok);
|
||||
msgBox.show(); // Need to be shown or to moveToCenter does not work
|
||||
msgBox.move(Utils::Gui::screenCenter(&msgBox));
|
||||
msgBox.exec();
|
||||
#else
|
||||
printf("%s\n", qUtf8Printable(makeUsage(prgName)));
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue