mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 18:04:32 +00:00
parent
f2dd1e6456
commit
fdba525e62
@ -196,6 +196,12 @@ Application::Application(int &argc, char **argv)
|
|||||||
|
|
||||||
if (m_commandLineArgs.webUiPort > 0) // it will be -1 when user did not set any value
|
if (m_commandLineArgs.webUiPort > 0) // it will be -1 when user did not set any value
|
||||||
Preferences::instance()->setWebUiPort(m_commandLineArgs.webUiPort);
|
Preferences::instance()->setWebUiPort(m_commandLineArgs.webUiPort);
|
||||||
|
|
||||||
|
if (m_commandLineArgs.torrentingPort > 0) // it will be -1 when user did not set any value
|
||||||
|
{
|
||||||
|
SettingValue<int> port {u"BitTorrent/Session/Port"_qs};
|
||||||
|
port = m_commandLineArgs.torrentingPort;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application()
|
Application::~Application()
|
||||||
|
@ -326,6 +326,7 @@ namespace
|
|||||||
constexpr const BoolOption NO_SPLASH_OPTION {"no-splash"};
|
constexpr const BoolOption NO_SPLASH_OPTION {"no-splash"};
|
||||||
#endif
|
#endif
|
||||||
constexpr const IntOption WEBUI_PORT_OPTION {"webui-port"};
|
constexpr const IntOption WEBUI_PORT_OPTION {"webui-port"};
|
||||||
|
constexpr const IntOption TORRENTING_PORT_OPTION {"torrenting-port"};
|
||||||
constexpr const StringOption PROFILE_OPTION {"profile"};
|
constexpr const StringOption PROFILE_OPTION {"profile"};
|
||||||
constexpr const StringOption CONFIGURATION_OPTION {"configuration"};
|
constexpr const StringOption CONFIGURATION_OPTION {"configuration"};
|
||||||
constexpr const BoolOption RELATIVE_FASTRESUME {"relative-fastresume"};
|
constexpr const BoolOption RELATIVE_FASTRESUME {"relative-fastresume"};
|
||||||
@ -353,6 +354,7 @@ QBtCommandLineParameters::QBtCommandLineParameters(const QProcessEnvironment &en
|
|||||||
, shouldDaemonize(DAEMON_OPTION.value(env))
|
, shouldDaemonize(DAEMON_OPTION.value(env))
|
||||||
#endif
|
#endif
|
||||||
, webUiPort(WEBUI_PORT_OPTION.value(env, -1))
|
, webUiPort(WEBUI_PORT_OPTION.value(env, -1))
|
||||||
|
, torrentingPort(TORRENTING_PORT_OPTION.value(env, -1))
|
||||||
, addPaused(PAUSED_OPTION.value(env))
|
, addPaused(PAUSED_OPTION.value(env))
|
||||||
, skipDialog(SKIP_DIALOG_OPTION.value(env))
|
, skipDialog(SKIP_DIALOG_OPTION.value(env))
|
||||||
, profileDir(PROFILE_OPTION.value(env))
|
, profileDir(PROFILE_OPTION.value(env))
|
||||||
@ -427,6 +429,15 @@ QBtCommandLineParameters parseCommandLine(const QStringList &args)
|
|||||||
throw CommandLineParameterError(QObject::tr("%1 must specify a valid port (1 to 65535).")
|
throw CommandLineParameterError(QObject::tr("%1 must specify a valid port (1 to 65535).")
|
||||||
.arg(u"--webui-port"_qs));
|
.arg(u"--webui-port"_qs));
|
||||||
}
|
}
|
||||||
|
else if (arg == TORRENTING_PORT_OPTION)
|
||||||
|
{
|
||||||
|
result.torrentingPort = TORRENTING_PORT_OPTION.value(arg);
|
||||||
|
if ((result.torrentingPort < 1) || (result.torrentingPort > 65535))
|
||||||
|
{
|
||||||
|
throw CommandLineParameterError(QObject::tr("%1 must specify a valid port (1 to 65535).")
|
||||||
|
.arg(u"--torrenting-port"_qs));
|
||||||
|
}
|
||||||
|
}
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
else if (arg == NO_SPLASH_OPTION)
|
else if (arg == NO_SPLASH_OPTION)
|
||||||
{
|
{
|
||||||
@ -537,6 +548,9 @@ QString makeUsage(const QString &prgName)
|
|||||||
+ 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"))
|
||||||
+ u'\n'
|
+ u'\n'
|
||||||
|
+ TORRENTING_PORT_OPTION.usage(QObject::tr("port"))
|
||||||
|
+ wrapText(QObject::tr("Change the torrenting port"))
|
||||||
|
+ u'\n'
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
+ NO_SPLASH_OPTION.usage() + wrapText(QObject::tr("Disable splash screen")) + u'\n'
|
+ NO_SPLASH_OPTION.usage() + wrapText(QObject::tr("Disable splash screen")) + u'\n'
|
||||||
#elif !defined(Q_OS_WIN)
|
#elif !defined(Q_OS_WIN)
|
||||||
|
@ -56,6 +56,7 @@ struct QBtCommandLineParameters
|
|||||||
bool shouldDaemonize;
|
bool shouldDaemonize;
|
||||||
#endif
|
#endif
|
||||||
int webUiPort;
|
int webUiPort;
|
||||||
|
int torrentingPort;
|
||||||
std::optional<bool> addPaused;
|
std::optional<bool> addPaused;
|
||||||
std::optional<bool> skipDialog;
|
std::optional<bool> skipDialog;
|
||||||
QStringList torrents;
|
QStringList torrents;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user