|
|
@ -35,7 +35,6 @@ |
|
|
|
#include <QDebug> |
|
|
|
#include <QDebug> |
|
|
|
#include <QFileInfo> |
|
|
|
#include <QFileInfo> |
|
|
|
#include <QProcessEnvironment> |
|
|
|
#include <QProcessEnvironment> |
|
|
|
#include <QTextStream> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(Q_OS_WIN) && !defined(DISABLE_GUI) |
|
|
|
#if defined(Q_OS_WIN) && !defined(DISABLE_GUI) |
|
|
|
#include <QMessageBox> |
|
|
|
#include <QMessageBox> |
|
|
@ -525,59 +524,57 @@ QString wrapText(const QString &text, int initialIndentation = USAGE_TEXT_COLUMN |
|
|
|
|
|
|
|
|
|
|
|
QString makeUsage(const QString &prgName) |
|
|
|
QString makeUsage(const QString &prgName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString text; |
|
|
|
const QString indentation {USAGE_INDENTATION, u' '}; |
|
|
|
QTextStream stream(&text, QIODevice::WriteOnly); |
|
|
|
|
|
|
|
QString indentation = QString(USAGE_INDENTATION, u' '); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stream << QObject::tr("Usage:") << '\n' |
|
|
|
const QString text = QObject::tr("Usage:") + u'\n' |
|
|
|
<< indentation << prgName << u" [options] [(<filename> | <url>)...]"_qs << '\n' |
|
|
|
+ indentation + prgName + u" [options] [(<filename> | <url>)...]" + u'\n' |
|
|
|
|
|
|
|
|
|
|
|
<< QObject::tr("Options:") << '\n' |
|
|
|
+ QObject::tr("Options:") + u'\n' |
|
|
|
#if !defined(Q_OS_WIN) || defined(DISABLE_GUI) |
|
|
|
#if !defined(Q_OS_WIN) || defined(DISABLE_GUI) |
|
|
|
<< SHOW_VERSION_OPTION.usage() << wrapText(QObject::tr("Display program version and exit")) << '\n' |
|
|
|
+ SHOW_VERSION_OPTION.usage() + wrapText(QObject::tr("Display program version and exit")) + u'\n' |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
<< SHOW_HELP_OPTION.usage() << wrapText(QObject::tr("Display this help message and exit")) << '\n' |
|
|
|
+ SHOW_HELP_OPTION.usage() + wrapText(QObject::tr("Display this help message and exit")) + u'\n' |
|
|
|
<< WEBUI_PORT_OPTION.usage(QObject::tr("port")) |
|
|
|
+ WEBUI_PORT_OPTION.usage(QObject::tr("port")) |
|
|
|
<< wrapText(QObject::tr("Change the Web UI port")) |
|
|
|
+ wrapText(QObject::tr("Change the Web UI port")) |
|
|
|
<< '\n' |
|
|
|
+ u'\n' |
|
|
|
#ifndef DISABLE_GUI |
|
|
|
#ifndef DISABLE_GUI |
|
|
|
<< NO_SPLASH_OPTION.usage() << wrapText(QObject::tr("Disable splash screen")) << '\n' |
|
|
|
+ NO_SPLASH_OPTION.usage() + wrapText(QObject::tr("Disable splash screen")) + u'\n' |
|
|
|
#elif !defined(Q_OS_WIN) |
|
|
|
#elif !defined(Q_OS_WIN) |
|
|
|
<< DAEMON_OPTION.usage() << wrapText(QObject::tr("Run in daemon-mode (background)")) << '\n' |
|
|
|
+ DAEMON_OPTION.usage() + wrapText(QObject::tr("Run in daemon-mode (background)")) + u'\n' |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
//: Use appropriate short form or abbreviation of "directory"
|
|
|
|
//: Use appropriate short form or abbreviation of "directory"
|
|
|
|
<< PROFILE_OPTION.usage(QObject::tr("dir")) |
|
|
|
+ PROFILE_OPTION.usage(QObject::tr("dir")) |
|
|
|
<< wrapText(QObject::tr("Store configuration files in <dir>")) << '\n' |
|
|
|
+ wrapText(QObject::tr("Store configuration files in <dir>")) + u'\n' |
|
|
|
<< CONFIGURATION_OPTION.usage(QObject::tr("name")) |
|
|
|
+ CONFIGURATION_OPTION.usage(QObject::tr("name")) |
|
|
|
<< wrapText(QObject::tr("Store configuration files in directories qBittorrent_<name>")) << '\n' |
|
|
|
+ wrapText(QObject::tr("Store configuration files in directories qBittorrent_<name>")) + u'\n' |
|
|
|
<< RELATIVE_FASTRESUME.usage() |
|
|
|
+ RELATIVE_FASTRESUME.usage() |
|
|
|
<< wrapText(QObject::tr("Hack into libtorrent fastresume files and make file paths relative " |
|
|
|
+ wrapText(QObject::tr("Hack into libtorrent fastresume files and make file paths relative " |
|
|
|
"to the profile directory")) << '\n' |
|
|
|
"to the profile directory")) + u'\n' |
|
|
|
<< Option::padUsageText(QObject::tr("files or URLs")) |
|
|
|
+ Option::padUsageText(QObject::tr("files or URLs")) |
|
|
|
<< wrapText(QObject::tr("Download the torrents passed by the user")) << '\n' |
|
|
|
+ wrapText(QObject::tr("Download the torrents passed by the user")) + u'\n' |
|
|
|
<< '\n' |
|
|
|
+ u'\n' |
|
|
|
|
|
|
|
|
|
|
|
<< wrapText(QObject::tr("Options when adding new torrents:"), 0) << '\n' |
|
|
|
+ wrapText(QObject::tr("Options when adding new torrents:"), 0) + u'\n' |
|
|
|
<< SAVE_PATH_OPTION.usage(QObject::tr("path")) << wrapText(QObject::tr("Torrent save path")) << '\n' |
|
|
|
+ SAVE_PATH_OPTION.usage(QObject::tr("path")) + wrapText(QObject::tr("Torrent save path")) + u'\n' |
|
|
|
<< PAUSED_OPTION.usage() << wrapText(QObject::tr("Add torrents as started or paused")) << '\n' |
|
|
|
+ PAUSED_OPTION.usage() + wrapText(QObject::tr("Add torrents as started or paused")) + u'\n' |
|
|
|
<< SKIP_HASH_CHECK_OPTION.usage() << wrapText(QObject::tr("Skip hash check")) << '\n' |
|
|
|
+ SKIP_HASH_CHECK_OPTION.usage() + wrapText(QObject::tr("Skip hash check")) + u'\n' |
|
|
|
<< CATEGORY_OPTION.usage(QObject::tr("name")) |
|
|
|
+ CATEGORY_OPTION.usage(QObject::tr("name")) |
|
|
|
<< wrapText(QObject::tr("Assign torrents to category. If the category doesn't exist, it will be " |
|
|
|
+ wrapText(QObject::tr("Assign torrents to category. If the category doesn't exist, it will be " |
|
|
|
"created.")) << '\n' |
|
|
|
"created.")) + u'\n' |
|
|
|
<< SEQUENTIAL_OPTION.usage() << wrapText(QObject::tr("Download files in sequential order")) << '\n' |
|
|
|
+ SEQUENTIAL_OPTION.usage() + wrapText(QObject::tr("Download files in sequential order")) + u'\n' |
|
|
|
<< FIRST_AND_LAST_OPTION.usage() |
|
|
|
+ FIRST_AND_LAST_OPTION.usage() |
|
|
|
<< wrapText(QObject::tr("Download first and last pieces first")) << '\n' |
|
|
|
+ wrapText(QObject::tr("Download first and last pieces first")) + u'\n' |
|
|
|
<< SKIP_DIALOG_OPTION.usage() |
|
|
|
+ SKIP_DIALOG_OPTION.usage() |
|
|
|
<< wrapText(QObject::tr("Specify whether the \"Add New Torrent\" dialog opens when adding a " |
|
|
|
+ wrapText(QObject::tr("Specify whether the \"Add New Torrent\" dialog opens when adding a " |
|
|
|
"torrent.")) << '\n' |
|
|
|
"torrent.")) + u'\n' |
|
|
|
<< '\n' |
|
|
|
+ u'\n' |
|
|
|
|
|
|
|
|
|
|
|
<< wrapText(QObject::tr("Option values may be supplied via environment variables. For option named " |
|
|
|
+ wrapText(QObject::tr("Option values may be supplied via environment variables. For option named " |
|
|
|
"'parameter-name', environment variable name is 'QBT_PARAMETER_NAME' (in upper " |
|
|
|
"'parameter-name', environment variable name is 'QBT_PARAMETER_NAME' (in upper " |
|
|
|
"case, '-' replaced with '_'). To pass flag values, set the variable to '1' or " |
|
|
|
"case, '-' replaced with '_'). To pass flag values, set the variable to '1' or " |
|
|
|
"'TRUE'. For example, to disable the splash screen: "), 0) << "\n" |
|
|
|
"'TRUE'. For example, to disable the splash screen: "), 0) + u'\n' |
|
|
|
<< u"QBT_NO_SPLASH=1 "_qs << prgName << '\n' |
|
|
|
+ u"QBT_NO_SPLASH=1 " + prgName + u'\n' |
|
|
|
<< wrapText(QObject::tr("Command line parameters take precedence over environment variables"), 0) << '\n'; |
|
|
|
+ wrapText(QObject::tr("Command line parameters take precedence over environment variables"), 0) + u'\n'; |
|
|
|
|
|
|
|
|
|
|
|
return text; |
|
|
|
return text; |
|
|
|
} |
|
|
|
} |
|
|
|