1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 20:44:15 +00:00

Store WebUI port setting in human readable number

Previously it was wrapped in QVariant type.

PR #16977.
This commit is contained in:
Chocobo1 2022-05-04 12:11:17 +08:00 committed by GitHub
parent 2a6f02fa29
commit e9d3928fe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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))