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:
@ -65,6 +65,7 @@ Enhancements:
|
||||
- #7416 Catch exception propagating to `Server` dtor
|
||||
- #7421 Only load core after settings have fully loaded
|
||||
- #7419 Introduce 'Advanced' tab to Preferences window
|
||||
- #7422 Handle empty value for computer name setting
|
||||
|
||||
# 1.14.6
|
||||
|
||||
|
||||
@ -144,7 +144,8 @@ void AppConfig::loadCommonSettings() {
|
||||
void AppConfig::loadScopeSettings() {
|
||||
using enum Setting;
|
||||
|
||||
m_ScreenName = loadSetting(kScreenName, m_ScreenName).toString();
|
||||
loadScreenName();
|
||||
|
||||
m_Port = loadSetting(kPort, m_Port).toInt();
|
||||
m_Interface = loadSetting(kInterface, m_Interface).toString();
|
||||
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() {
|
||||
using enum Setting;
|
||||
|
||||
|
||||
@ -214,6 +214,7 @@ public:
|
||||
|
||||
private:
|
||||
static QString settingName(AppConfig::Setting name);
|
||||
void loadScreenName();
|
||||
void loadSerialKey();
|
||||
void loadElevateMode();
|
||||
void loadCommonSettings();
|
||||
|
||||
Reference in New Issue
Block a user