From e2b81d3e9adb1e101d3a28144a0a1f17d91ed958 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 13 Jun 2017 03:07:04 +0300 Subject: Show register and support url in server info window. --- src/gui/windows/serverinfowindow.cpp | 55 +++++++++++++++++++++++------------- src/gui/windows/serverinfowindow.h | 3 ++ 2 files changed, 39 insertions(+), 19 deletions(-) (limited to 'src/gui') 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 &list, FOR_EACH (std::vector::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 &list, const std::string &comment); + void addServerComment(const std::string &url, + const std::string &comment); + private: ServerInfo mServerInfo; BrowserBox *mBrowserBox A_NONNULLPOINTER; -- cgit v1.2.3-70-g09d2