mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-22 14:23:35 -07:00
Add CLI option to force default WebUI
This commit is contained in:
parent
53f919aea8
commit
13e08b0d32
3 changed files with 10 additions and 0 deletions
|
@ -331,6 +331,9 @@ Application::Application(int &argc, char **argv)
|
|||
if (m_commandLineArgs.webUIPort > 0) // it will be -1 when user did not set any value
|
||||
Preferences::instance()->setWebUIPort(m_commandLineArgs.webUIPort);
|
||||
|
||||
if (m_commandLineArgs.forceDefaultWebUI)
|
||||
Preferences::instance()->setAltWebUIEnabled(false);
|
||||
|
||||
if (m_commandLineArgs.torrentingPort > 0) // it will be -1 when user did not set any value
|
||||
{
|
||||
SettingValue<int> port {u"BitTorrent/Session/Port"_s};
|
||||
|
|
|
@ -315,6 +315,7 @@ namespace
|
|||
constexpr const BoolOption NO_SPLASH_OPTION {u"no-splash"};
|
||||
#endif
|
||||
constexpr const IntOption WEBUI_PORT_OPTION {u"webui-port"};
|
||||
constexpr const BoolOption FORCE_DEFAULT_WEBUI_OPTION {u"force-default-webui"};
|
||||
constexpr const IntOption TORRENTING_PORT_OPTION {u"torrenting-port"};
|
||||
constexpr const StringOption PROFILE_OPTION {u"profile"};
|
||||
constexpr const StringOption CONFIGURATION_OPTION {u"configuration"};
|
||||
|
@ -383,6 +384,10 @@ QBtCommandLineParameters parseCommandLine(const QStringList &args)
|
|||
throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "%1 must specify a valid port (1 to 65535).")
|
||||
.arg(u"--webui-port"_s));
|
||||
}
|
||||
else if (arg == FORCE_DEFAULT_WEBUI_OPTION)
|
||||
{
|
||||
result.forceDefaultWebUI = true;
|
||||
}
|
||||
else if (arg == TORRENTING_PORT_OPTION)
|
||||
{
|
||||
result.torrentingPort = TORRENTING_PORT_OPTION.value(arg);
|
||||
|
@ -503,6 +508,7 @@ QString makeUsage(const QString &prgName)
|
|||
+ WEBUI_PORT_OPTION.usage(QCoreApplication::translate("CMD Options", "port"))
|
||||
+ wrapText(QCoreApplication::translate("CMD Options", "Change the WebUI port"))
|
||||
+ u'\n'
|
||||
+ FORCE_DEFAULT_WEBUI_OPTION.usage() + wrapText(QCoreApplication::translate("CMD Options", "Disable alternative WebUI and use the default")) + u'\n'
|
||||
+ TORRENTING_PORT_OPTION.usage(QCoreApplication::translate("CMD Options", "port"))
|
||||
+ wrapText(QCoreApplication::translate("CMD Options", "Change the torrenting port"))
|
||||
+ u'\n'
|
||||
|
|
|
@ -55,6 +55,7 @@ struct QBtCommandLineParameters
|
|||
bool shouldDaemonize = false;
|
||||
#endif
|
||||
int webUIPort = -1;
|
||||
bool forceDefaultWebUI = false;
|
||||
int torrentingPort = -1;
|
||||
std::optional<bool> skipDialog;
|
||||
Path profileDir;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue