diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-08-20 14:20:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-08-20 14:20:26 +0300 |
commit | 31acb66791e27b6cfa846302156ad2e7a88f5f04 (patch) | |
tree | 77b67fbb0dfb2e7cba3c2edcc1fbbb4b257bf15f /src/gui | |
parent | b4eae25edc2b75af41fdb98c4d0a332ee3dcf500 (diff) | |
download | manaverse-31acb66791e27b6cfa846302156ad2e7a88f5f04.tar.gz manaverse-31acb66791e27b6cfa846302156ad2e7a88f5f04.tar.bz2 manaverse-31acb66791e27b6cfa846302156ad2e7a88f5f04.tar.xz manaverse-31acb66791e27b6cfa846302156ad2e7a88f5f04.zip |
Show clickable update links for manaplus.
Site url and download link.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/updaterwindow.cpp | 16 | ||||
-rw-r--r-- | src/gui/updaterwindow.h | 7 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 71aec58a0..49977ae4b 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -46,6 +46,7 @@ #include "utils/gettext.h" #include "utils/mkdir.h" #include "utils/paths.h" +#include "utils/process.h" #include "utils/stringutils.h" #include "utils/xml.h" @@ -174,6 +175,7 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost, mProgressBar->setSmoothProgress(false); mBrowserBox->setOpaque(false); + mBrowserBox->setLinkHandler(this); mPlayButton->setEnabled(false); ContainerPlacer placer; @@ -374,7 +376,12 @@ void UpdaterWindow::loadPatch() if (version > CHECK_VERSION) { mBrowserBox->addRow("", true); - mBrowserBox->addRow(" ##1http://manaplus.evolonline.org/", true); +#ifdef WIN32 + mBrowserBox->addRow(" ##1[@@http://download.evolonline.org/" + "manaplus/download/manaplus-win32.exe|download here@@]", true); +#endif + mBrowserBox->addRow(" ##1@@http://manaplus.evolonline.org/|" + "http://manaplus.evolonline.org/@@", true); mBrowserBox->addRow("##1You can download it from", true); mBrowserBox->addRow("##1ManaPlus updated.", true); } @@ -833,3 +840,10 @@ bool UpdaterWindow::validateFile(std::string filePath, unsigned long hash) fclose(file); return adler == hash; } + +void UpdaterWindow::handleLink(const std::string &link, + gcn::MouseEvent *event A_UNUSED) +{ + if (strStartWith(link, "http://")) + openBrowser(link); +} diff --git a/src/gui/updaterwindow.h b/src/gui/updaterwindow.h index 1039bbb9e..90bd06847 100644 --- a/src/gui/updaterwindow.h +++ b/src/gui/updaterwindow.h @@ -23,6 +23,7 @@ #ifndef UPDATERWINDOW_H #define UPDATERWINDOW_H +#include "gui/widgets/linkhandler.h" #include "gui/widgets/window.h" #include "net/download.h" @@ -61,7 +62,9 @@ struct updateFile * * \ingroup GUI */ -class UpdaterWindow : public Window, public gcn::ActionListener, +class UpdaterWindow : public Window, + public gcn::ActionListener, + public LinkHandler, public gcn::KeyListener { public: @@ -112,6 +115,8 @@ class UpdaterWindow : public Window, public gcn::ActionListener, void logic(); + void handleLink(const std::string &link, gcn::MouseEvent *event A_UNUSED); + static void loadLocalUpdates(std::string dir); static void addUpdateFile(ResourceManager *resman, std::string path, |