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