summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-14 15:15:51 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-14 15:15:51 +0300
commit5c7ea2e2dc120107145e7314119a82654280c010 (patch)
tree5d2d9b88ac3c30907bb7bb936c65be1f7311773c
parentfc5a71f55255e7ff211efe80b33a2cd3dd89a8ea (diff)
downloadmv-5c7ea2e2dc120107145e7314119a82654280c010.tar.gz
mv-5c7ea2e2dc120107145e7314119a82654280c010.tar.bz2
mv-5c7ea2e2dc120107145e7314119a82654280c010.tar.xz
mv-5c7ea2e2dc120107145e7314119a82654280c010.zip
Add name for default server updates group.
-rw-r--r--src/gui/windows/logindialog.cpp8
-rw-r--r--src/gui/windows/serverdialog.cpp68
-rw-r--r--src/net/serverinfo.h5
3 files changed, 48 insertions, 33 deletions
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index 355f1b26b..14c662a0d 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -378,8 +378,12 @@ void LoginDialog::mergeUpdateHosts()
{
HostsGroup group;
- // TRANSLATORS: update hosts group default name
- group.name = _("default");
+ group.name = mServer->defaultHostName;
+ if (group.name.empty())
+ {
+ // TRANSLATORS: update hosts group default name
+ group.name = _("default updates");
+ }
group.hosts = mLoginData->updateHosts;
mServer->updateHosts.insert(mServer->updateHosts.begin(), group);
}
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 04663de71..82d44c1b0 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -234,6 +234,7 @@ void ServerDialog::connectToSelectedServer()
mServerInfo->registerUrl = server.registerUrl;
mServerInfo->onlineListUrl = server.onlineListUrl;
mServerInfo->supportUrl = server.supportUrl;
+ mServerInfo->defaultHostName = server.defaultHostName;
mServerInfo->save = true;
mServerInfo->persistentIp = server.persistentIp;
mServerInfo->updateMirrors = server.updateMirrors;
@@ -453,7 +454,7 @@ static void loadHostsGroup(const XmlNodePtr node,
ServerInfo &server)
{
HostsGroup group;
- group.name = XML::getProperty(node,
+ group.name = XML::langProperty(node,
"name",
// TRANSLATORS: unknown hosts group name
_("Unknown"));
@@ -560,41 +561,45 @@ void ServerDialog::loadServers(const bool addNew)
server.port = defaultPortForServerType(server.type);
}
}
- else if (!XmlHaveChildContent(subNode))
+ else if (XmlHaveChildContent(subNode))
{
- continue;
- }
-
- if ((xmlNameEqual(subNode, "description")
- && server.description.empty()) || (!lang.empty()
- && xmlNameEqual(subNode, description2.c_str())))
- {
- server.description = XmlChildContent(subNode);
- }
- else if (xmlNameEqual(subNode, "registerurl"))
- {
- server.registerUrl = XmlChildContent(subNode);
- }
- else if (xmlNameEqual(subNode, "onlineListUrl"))
- {
- server.onlineListUrl = XmlChildContent(subNode);
- }
- else if (xmlNameEqual(subNode, "support"))
- {
- server.supportUrl = XmlChildContent(subNode);
- }
- else if (xmlNameEqual(subNode, "persistentIp"))
- {
- std::string text = XmlChildContent(subNode);
- server.persistentIp = (text == "1" || text == "true");
+ if ((xmlNameEqual(subNode, "description")
+ && server.description.empty()) || (!lang.empty()
+ && xmlNameEqual(subNode, description2.c_str())))
+ {
+ server.description = XmlChildContent(subNode);
+ }
+ else if (xmlNameEqual(subNode, "registerurl"))
+ {
+ server.registerUrl = XmlChildContent(subNode);
+ }
+ else if (xmlNameEqual(subNode, "onlineListUrl"))
+ {
+ server.onlineListUrl = XmlChildContent(subNode);
+ }
+ else if (xmlNameEqual(subNode, "support"))
+ {
+ server.supportUrl = XmlChildContent(subNode);
+ }
+ else if (xmlNameEqual(subNode, "persistentIp"))
+ {
+ std::string text = XmlChildContent(subNode);
+ server.persistentIp = (text == "1" || text == "true");
+ }
+ else if (xmlNameEqual(subNode, "updateMirror"))
+ {
+ server.updateMirrors.push_back(XmlChildContent(subNode));
+ }
}
- else if (xmlNameEqual(subNode, "updateMirror"))
+ if (xmlNameEqual(subNode, "updates"))
{
- server.updateMirrors.push_back(XmlChildContent(subNode));
+ loadHostsGroup(subNode, server);
}
- else if (xmlNameEqual(subNode, "updates"))
+ else if (xmlNameEqual(subNode, "defaultUpdateHost"))
{
- loadHostsGroup(subNode, server);
+ server.defaultHostName = XML::langProperty(
+ // TRANSLATORS: default hosts group name
+ subNode, "name", _("default"));
}
}
@@ -620,6 +625,7 @@ void ServerDialog::loadServers(const bool addNew)
mServers[i].althostname = server.althostname;
mServers[i].persistentIp = server.persistentIp;
mServers[i].updateMirrors = server.updateMirrors;
+ mServers[i].defaultHostName = server.defaultHostName;
mServers[i].updateHosts = server.updateHosts;
mServers[i].packetVersion = server.packetVersion;
mServersListModel->setVersionString(i, version);
diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h
index e2949af0b..37be5e279 100644
--- a/src/net/serverinfo.h
+++ b/src/net/serverinfo.h
@@ -44,6 +44,7 @@ class ServerInfo final
std::string registerUrl;
std::string onlineListUrl;
std::string supportUrl;
+ std::string defaultHostName;
std::vector<std::string> updateMirrors;
std::vector<HostsGroup> updateHosts;
uint16_t port;
@@ -61,6 +62,7 @@ class ServerInfo final
registerUrl(),
onlineListUrl(),
supportUrl(),
+ defaultHostName(),
updateMirrors(),
updateHosts(),
#ifdef TMWA_SUPPORT
@@ -85,6 +87,7 @@ class ServerInfo final
registerUrl(info.registerUrl),
onlineListUrl(info.onlineListUrl),
supportUrl(info.supportUrl),
+ defaultHostName(info.defaultHostName),
updateMirrors(info.updateMirrors),
updateHosts(info.updateHosts),
port(info.port),
@@ -107,6 +110,7 @@ class ServerInfo final
registerUrl = info.registerUrl;
onlineListUrl = info.onlineListUrl;
supportUrl = info.supportUrl;
+ defaultHostName = info.defaultHostName;
updateMirrors = info.updateMirrors;
updateHosts = info.updateHosts;
port = info.port;
@@ -136,6 +140,7 @@ class ServerInfo final
registerUrl.clear();
onlineListUrl.clear();
supportUrl.clear();
+ defaultHostName.clear();
updateMirrors.clear();
updateHosts.clear();
version.first = 0;