summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-13 02:30:15 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-13 02:30:15 +0300
commitc44ee3cc262b5e6df7fff32273e9df5bf932c159 (patch)
tree9ce62935863507b098f15c8d713e34e91297d2cb /src/gui
parent28c6adc21db25de911fddc48912a61b101bfae84 (diff)
downloadmv-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')
-rw-r--r--src/gui/windows/serverinfowindow.cpp54
-rw-r--r--src/gui/windows/serverinfowindow.h3
2 files changed, 57 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("");
+ }
}
diff --git a/src/gui/windows/serverinfowindow.h b/src/gui/windows/serverinfowindow.h
index c0cf5c786..5165102cd 100644
--- a/src/gui/windows/serverinfowindow.h
+++ b/src/gui/windows/serverinfowindow.h
@@ -54,6 +54,9 @@ class ServerInfoWindow final : public Window,
protected:
void showServerInfo();
+ void addSourcesList(const std::vector<ServerUrlInfo> &list,
+ const std::string &comment);
+
private:
ServerInfo mServerInfo;
BrowserBox *mBrowserBox A_NONNULLPOINTER;