Handle empty value for computer name setting (#7422)
* Handle empty value for computer name setting * Remove stray include * Move load screen name to scoped settings * Update ChangeLog
This commit is contained in:
parent
c77f977bbb
commit
e0c08852bf
3 changed files with 21 additions and 1 deletions
|
|
@ -65,6 +65,7 @@ Enhancements:
|
||||||
- #7416 Catch exception propagating to `Server` dtor
|
- #7416 Catch exception propagating to `Server` dtor
|
||||||
- #7421 Only load core after settings have fully loaded
|
- #7421 Only load core after settings have fully loaded
|
||||||
- #7419 Introduce 'Advanced' tab to Preferences window
|
- #7419 Introduce 'Advanced' tab to Preferences window
|
||||||
|
- #7422 Handle empty value for computer name setting
|
||||||
|
|
||||||
# 1.14.6
|
# 1.14.6
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,8 @@ void AppConfig::loadCommonSettings() {
|
||||||
void AppConfig::loadScopeSettings() {
|
void AppConfig::loadScopeSettings() {
|
||||||
using enum Setting;
|
using enum Setting;
|
||||||
|
|
||||||
m_ScreenName = loadSetting(kScreenName, m_ScreenName).toString();
|
loadScreenName();
|
||||||
|
|
||||||
m_Port = loadSetting(kPort, m_Port).toInt();
|
m_Port = loadSetting(kPort, m_Port).toInt();
|
||||||
m_Interface = loadSetting(kInterface, m_Interface).toString();
|
m_Interface = loadSetting(kInterface, m_Interface).toString();
|
||||||
m_LogLevel = loadSetting(kLogLevel, m_LogLevel).toInt();
|
m_LogLevel = loadSetting(kLogLevel, m_LogLevel).toInt();
|
||||||
|
|
@ -232,6 +233,23 @@ void AppConfig::saveSettings() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppConfig::loadScreenName() {
|
||||||
|
using enum Setting;
|
||||||
|
|
||||||
|
const auto &screenName =
|
||||||
|
loadSetting(kScreenName, m_ScreenName).toString().trimmed();
|
||||||
|
|
||||||
|
// for some reason, the screen name can be saved as an empty string
|
||||||
|
// in the config file. this is probably a bug. if this happens, then default
|
||||||
|
// back to the hostname.
|
||||||
|
if (screenName.isEmpty()) {
|
||||||
|
qWarning("screen name was empty in config, setting to hostname");
|
||||||
|
m_ScreenName = m_Deps.hostname();
|
||||||
|
} else {
|
||||||
|
m_ScreenName = screenName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AppConfig::loadSerialKey() {
|
void AppConfig::loadSerialKey() {
|
||||||
using enum Setting;
|
using enum Setting;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QString settingName(AppConfig::Setting name);
|
static QString settingName(AppConfig::Setting name);
|
||||||
|
void loadScreenName();
|
||||||
void loadSerialKey();
|
void loadSerialKey();
|
||||||
void loadElevateMode();
|
void loadElevateMode();
|
||||||
void loadCommonSettings();
|
void loadCommonSettings();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue