diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-13 02:30:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-13 02:30:15 +0300 |
commit | c44ee3cc262b5e6df7fff32273e9df5bf932c159 (patch) | |
tree | 9ce62935863507b098f15c8d713e34e91297d2cb /src/gui/windows/serverinfowindow.cpp | |
parent | 28c6adc21db25de911fddc48912a61b101bfae84 (diff) | |
download | mv-c44ee3cc262b5e6df7fff32273e9df5bf932c159.tar.gz mv-c44ee3cc262b5e6df7fff32273e9df5bf932c159.tar.bz2 mv-c44ee3cc262b5e6df7fff32273e9df5bf932c159.tar.xz mv-c44ee3cc262b5e6df7fff32273e9df5bf932c159.zip |
Show server sources in server info window.
Diffstat (limited to 'src/gui/windows/serverinfowindow.cpp')
-rw-r--r-- | src/gui/windows/serverinfowindow.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/gui/windows/serverinfowindow.cpp b/src/gui/windows/serverinfowindow.cpp index 274fd97ce..22931fa80 100644 --- a/src/gui/windows/serverinfowindow.cpp +++ b/src/gui/windows/serverinfowindow.cpp @@ -103,4 +103,58 @@ void ServerInfoWindow::handleLink(const std::string &link, void ServerInfoWindow::showServerInfo() { + const ServerFreeTypeT type = mServerInfo.freeType; + if (type == ServerFreeType::Free) + { + // TRANSLATORS: server info comment + mBrowserBox->addRow(_("Server with free license.")); + } + else if (type == ServerFreeType::NonFree) + { + // TRANSLATORS: server info comment + mBrowserBox->addRow(_("Server with non free license.")); + } + else if (type == ServerFreeType::Unknown || + type == ServerFreeType::NotSet) + { + // TRANSLATORS: server info comment + mBrowserBox->addRow(_("Server unknown licesne.")); + } + addSourcesList(mServerInfo.nonFreeSources, + // TRANSLATORS: server info non free comment + _("##BNon free sources")); + addSourcesList(mServerInfo.freeSources, + // TRANSLATORS: server info non free comment + _("##BFree sources")); +} + +void ServerInfoWindow::addSourcesList(const std::vector<ServerUrlInfo> &list, + const std::string &comment) +{ + if (!list.empty()) + { + mBrowserBox->addRow(""); + mBrowserBox->addRow(comment); + 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); + } + mBrowserBox->addRow(""); + } } |