diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-15 20:37:18 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-15 20:37:18 +0300 |
commit | f6cb5519a2cc4452055ff0bfb6f38990bc3e9e65 (patch) | |
tree | a4b22c43caebdccb79969dc95356f8745600d36c /src/gui | |
parent | acc395f67dbe683787f1aeb0bf96fe0a16f62c5e (diff) | |
download | plus-f6cb5519a2cc4452055ff0bfb6f38990bc3e9e65.tar.gz plus-f6cb5519a2cc4452055ff0bfb6f38990bc3e9e65.tar.bz2 plus-f6cb5519a2cc4452055ff0bfb6f38990bc3e9e65.tar.xz plus-f6cb5519a2cc4452055ff0bfb6f38990bc3e9e65.zip |
Allow open server info window from game.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/windowmenu.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/serverdialog.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/serverinfowindow.cpp | 10 | ||||
-rw-r--r-- | src/gui/windows/serverinfowindow.h | 4 |
4 files changed, 23 insertions, 1 deletions
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index f45b292f0..41640a458 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -171,6 +171,11 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : // TRANSLATORS: long button name for mail window. _("Mail"), x, h, InputAction::WINDOW_MAIL, Visible_true); + // TRANSLATORS: short button name for server info window. + addButton(N_("SI"), + // TRANSLATORS: long button name for server info window. + _("Server info"), x, h, InputAction::WINDOW_SERVER_INFO, + Visible_true); // TRANSLATORS: short button name for debug window. addButton(N_("DBG"), // TRANSLATORS: long button name for debug window. diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 501557c8c..c8c0256ee 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -246,6 +246,7 @@ void ServerDialog::connectToSelectedServer() mServerInfo->freeSources = server.freeSources; mServerInfo->nonFreeSources = server.nonFreeSources; mServerInfo->docs = server.docs; + mServerInfo->serverUrl = server.serverUrl; settings.persistentIp = mServerInfo->persistentIp; settings.supportUrl = mServerInfo->supportUrl; @@ -316,7 +317,9 @@ void ServerDialog::action(const ActionEvent &event) const int index = mServersList->getSelected(); if (index >= 0) { - CREATEWIDGET(ServerInfoWindow, + if (serverInfoWindow != nullptr) + serverInfoWindow->scheduleDelete(); + serverInfoWindow = CREATEWIDGETR(ServerInfoWindow, mServers.at(index)); } } diff --git a/src/gui/windows/serverinfowindow.cpp b/src/gui/windows/serverinfowindow.cpp index 660dd0241..c0099d356 100644 --- a/src/gui/windows/serverinfowindow.cpp +++ b/src/gui/windows/serverinfowindow.cpp @@ -33,6 +33,8 @@ #include "debug.h" +ServerInfoWindow *serverInfoWindow = nullptr; + ServerInfoWindow::ServerInfoWindow(ServerInfo &serverInfo) : // TRANSLATORS: servers dialog name Window(_("Server info"), Modal_false, nullptr, "server_info.xml"), @@ -170,3 +172,11 @@ void ServerInfoWindow::addServerComment(const std::string &url, mBrowserBox->addRow(str); } } + +void ServerInfoWindow::close() +{ + Window::close(); + if (serverInfoWindow == this) + serverInfoWindow = nullptr; + scheduleDelete(); +} diff --git a/src/gui/windows/serverinfowindow.h b/src/gui/windows/serverinfowindow.h index f3e2b545e..699a00451 100644 --- a/src/gui/windows/serverinfowindow.h +++ b/src/gui/windows/serverinfowindow.h @@ -46,6 +46,8 @@ class ServerInfoWindow final : public Window, void handleLink(const std::string &link, MouseEvent *const event A_UNUSED) override final; + void close() override final; + protected: void showServerInfo(); @@ -61,4 +63,6 @@ class ServerInfoWindow final : public Window, ScrollArea *mScrollArea A_NONNULLPOINTER; }; +extern ServerInfoWindow *serverInfoWindow; + #endif // GUI_WINDOWS_SERVERINFOWINDOW_H |