diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-13 03:07:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-13 03:07:04 +0300 |
commit | e2b81d3e9adb1e101d3a28144a0a1f17d91ed958 (patch) | |
tree | aed21d2330b91a58ea53c338b0eb01136f380613 /src | |
parent | c44ee3cc262b5e6df7fff32273e9df5bf932c159 (diff) | |
download | manaverse-e2b81d3e9adb1e101d3a28144a0a1f17d91ed958.tar.gz manaverse-e2b81d3e9adb1e101d3a28144a0a1f17d91ed958.tar.bz2 manaverse-e2b81d3e9adb1e101d3a28144a0a1f17d91ed958.tar.xz manaverse-e2b81d3e9adb1e101d3a28144a0a1f17d91ed958.zip |
Show register and support url in server info window.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/windows/serverinfowindow.cpp | 55 | ||||
-rw-r--r-- | src/gui/windows/serverinfowindow.h | 3 |
2 files changed, 39 insertions, 19 deletions
diff --git a/src/gui/windows/serverinfowindow.cpp b/src/gui/windows/serverinfowindow.cpp index 22931fa80..23e7a7e50 100644 --- a/src/gui/windows/serverinfowindow.cpp +++ b/src/gui/windows/serverinfowindow.cpp @@ -107,19 +107,27 @@ void ServerInfoWindow::showServerInfo() if (type == ServerFreeType::Free) { // TRANSLATORS: server info comment - mBrowserBox->addRow(_("Server with free license.")); + mBrowserBox->addRow(_("##BServer with free license.")); } else if (type == ServerFreeType::NonFree) { // TRANSLATORS: server info comment - mBrowserBox->addRow(_("Server with non free license.")); + mBrowserBox->addRow(_("##BServer with non free license.")); } else if (type == ServerFreeType::Unknown || type == ServerFreeType::NotSet) { // TRANSLATORS: server info comment - mBrowserBox->addRow(_("Server unknown licesne.")); + mBrowserBox->addRow(_("##BServer unknown licesne.")); } + mBrowserBox->addRow(""); + addServerComment(mServerInfo.supportUrl, + // TRANSLATORS: server info comment + _("Support url")); + addServerComment(mServerInfo.registerUrl, + // TRANSLATORS: server info comment + _("Register url")); + addSourcesList(mServerInfo.nonFreeSources, // TRANSLATORS: server info non free comment _("##BNon free sources")); @@ -138,23 +146,32 @@ void ServerInfoWindow::addSourcesList(const std::vector<ServerUrlInfo> &list, FOR_EACH (std::vector<ServerUrlInfo>::const_iterator, it, list) { const ServerUrlInfo &info = *it; - const std::string url = info.url; - std::string str; - if (strStartWith(url, "http://") || - strStartWith(url, "https://")) - { - str = strprintf("%s: @@%s|@@##0", - info.name.c_str(), - url.c_str()); - } - else - { - str = strprintf("%s: %s", - info.name.c_str(), - url.c_str()); - } - mBrowserBox->addRow(str); + addServerComment(info.url, + info.name); } mBrowserBox->addRow(""); } } + +void ServerInfoWindow::addServerComment(const std::string &url, + const std::string &comment) +{ + std::string str; + if (!url.empty()) + { + if (strStartWith(url, "http://") || + strStartWith(url, "https://")) + { + str = strprintf("%s: @@%s|@@##0", + comment.c_str(), + url.c_str()); + } + else + { + str = strprintf("%s: %s", + comment.c_str(), + url.c_str()); + } + mBrowserBox->addRow(str); + } +} diff --git a/src/gui/windows/serverinfowindow.h b/src/gui/windows/serverinfowindow.h index 5165102cd..630bc733d 100644 --- a/src/gui/windows/serverinfowindow.h +++ b/src/gui/windows/serverinfowindow.h @@ -57,6 +57,9 @@ class ServerInfoWindow final : public Window, void addSourcesList(const std::vector<ServerUrlInfo> &list, const std::string &comment); + void addServerComment(const std::string &url, + const std::string &comment); + private: ServerInfo mServerInfo; BrowserBox *mBrowserBox A_NONNULLPOINTER; |