mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 13:50:35 +02:00
if the hostname field is left blank reset to DEFAULT_DOMAIN_HOSTNAME
This commit is contained in:
parent
01e6891fd3
commit
ef7dc4a39a
2 changed files with 19 additions and 6 deletions
|
@ -1151,11 +1151,18 @@ void Application::editPreferences() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char newHostname[MAX_HOSTNAME_BYTES] = {};
|
QByteArray newHostname;
|
||||||
memcpy(newHostname, domainServerHostname->text().toAscii().data(), domainServerHostname->text().size());
|
|
||||||
|
if (domainServerHostname->text().size() > 0) {
|
||||||
|
// the user input a new hostname, use that
|
||||||
|
newHostname = domainServerHostname->text().toAscii();
|
||||||
|
} else {
|
||||||
|
// the user left the field blank, use the default hostname
|
||||||
|
newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME);
|
||||||
|
}
|
||||||
|
|
||||||
// check if the domain server hostname is new
|
// check if the domain server hostname is new
|
||||||
if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname, strlen(newHostname)) != 0) {
|
if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname.constData(), newHostname.size()) != 0) {
|
||||||
|
|
||||||
NodeList::getInstance()->clear();
|
NodeList::getInstance()->clear();
|
||||||
|
|
||||||
|
@ -1165,7 +1172,8 @@ void Application::editPreferences() {
|
||||||
// reset the environment to default
|
// reset the environment to default
|
||||||
_environment.resetToDefault();
|
_environment.resetToDefault();
|
||||||
|
|
||||||
NodeList::getInstance()->setDomainHostname(newHostname);
|
// set the new hostname
|
||||||
|
NodeList::getInstance()->setDomainHostname(newHostname.constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl url(avatarURL->text());
|
QUrl url(avatarURL->text());
|
||||||
|
|
|
@ -519,12 +519,17 @@ void NodeList::loadData(QSettings *settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeList::saveData(QSettings* settings) {
|
void NodeList::saveData(QSettings* settings) {
|
||||||
|
settings->beginGroup(DOMAIN_SERVER_SETTING_KEY);
|
||||||
|
|
||||||
if (memcmp(_domainHostname, DEFAULT_DOMAIN_HOSTNAME, strlen(DEFAULT_DOMAIN_HOSTNAME)) != 0) {
|
if (memcmp(_domainHostname, DEFAULT_DOMAIN_HOSTNAME, strlen(DEFAULT_DOMAIN_HOSTNAME)) != 0) {
|
||||||
// the user is using a different hostname, store it
|
// the user is using a different hostname, store it
|
||||||
settings->beginGroup(DOMAIN_SERVER_SETTING_KEY);
|
|
||||||
settings->setValue(DOMAIN_SERVER_SETTING_KEY, QVariant(_domainHostname));
|
settings->setValue(DOMAIN_SERVER_SETTING_KEY, QVariant(_domainHostname));
|
||||||
settings->endGroup();
|
} else {
|
||||||
|
// the user has switched back to default, remove the current setting
|
||||||
|
settings->remove(DOMAIN_SERVER_SETTING_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeList::iterator NodeList::begin() const {
|
NodeList::iterator NodeList::begin() const {
|
||||||
|
|
Loading…
Reference in a new issue