Browse Source

Store WebUI port setting in human readable number

Previously it was wrapped in QVariant type.

PR #16977.
adaptive-webui-19844
Chocobo1 3 years ago committed by GitHub
parent
commit
e9d3928fe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/base/preferences.cpp
  2. 2
      src/webui/api/appcontroller.cpp

5
src/base/preferences.cpp

@ -592,12 +592,13 @@ void Preferences::setWebUiAddress(const QString &addr) @@ -592,12 +592,13 @@ void Preferences::setWebUiAddress(const QString &addr)
quint16 Preferences::getWebUiPort() const
{
return value<int>(u"Preferences/WebUI/Port"_qs, 8080);
return value<quint16>(u"Preferences/WebUI/Port"_qs, 8080);
}
void Preferences::setWebUiPort(const quint16 port)
{
setValue(u"Preferences/WebUI/Port"_qs, port);
// cast to `int` type so it will show human readable unit in configuration file
setValue(u"Preferences/WebUI/Port"_qs, static_cast<int>(port));
}
bool Preferences::useUPnPForWebUIPort() const

2
src/webui/api/appcontroller.cpp

@ -661,7 +661,7 @@ void AppController::setPreferencesAction() @@ -661,7 +661,7 @@ void AppController::setPreferencesAction()
if (hasKey(u"web_ui_address"_qs))
pref->setWebUiAddress(it.value().toString());
if (hasKey(u"web_ui_port"_qs))
pref->setWebUiPort(it.value().toUInt());
pref->setWebUiPort(it.value().value<quint16>());
if (hasKey(u"web_ui_upnp"_qs))
pref->setUPnPForWebUIPort(it.value().toBool());
if (hasKey(u"use_https"_qs))

Loading…
Cancel
Save