diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-11 21:05:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-11 23:47:01 +0300 |
commit | 4f967c32a2ff7e6e2cebcc3d3f7b6aaad7465c2f (patch) | |
tree | 73463ea6cb20a670665de746105419dbf394f926 | |
parent | 86b8c903900a59f99b2e1f02232476d600ae5a12 (diff) | |
download | manaplus-4f967c32a2ff7e6e2cebcc3d3f7b6aaad7465c2f.tar.gz manaplus-4f967c32a2ff7e6e2cebcc3d3f7b6aaad7465c2f.tar.bz2 manaplus-4f967c32a2ff7e6e2cebcc3d3f7b6aaad7465c2f.tar.xz manaplus-4f967c32a2ff7e6e2cebcc3d3f7b6aaad7465c2f.zip |
Show copyright at background.
-rw-r--r-- | data/help/about.txt | 2 | ||||
-rw-r--r-- | data/help/team.txt | 1 | ||||
-rw-r--r-- | src/actionmanager.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/desktop.cpp | 24 | ||||
-rw-r--r-- | src/gui/widgets/desktop.h | 11 |
5 files changed, 32 insertions, 14 deletions
diff --git a/data/help/about.txt b/data/help/about.txt index 7778e7ac5..0c82f2bc0 100644 --- a/data/help/about.txt +++ b/data/help/about.txt @@ -11,7 +11,7 @@ sure this game can't ever run away from you.>> ##9 Copyright (C) 2012-2014 The ManaPlus Developers - -> @@team|<<Manaplus Developers>>@@ + -> @@team|<<Manaplus Developers>>, http://manaplus.org@@ ##9 Copyright (C) 2004-2014 The Mana World Development Team -> @@about-tmw|<<About The Mana World>>@@ diff --git a/data/help/team.txt b/data/help/team.txt index e51da3e89..34558e154 100644 --- a/data/help/team.txt +++ b/data/help/team.txt @@ -1,5 +1,6 @@ .<- @@index|<<Back to Index>>@@ +@@http://manaplus.org/|<<Official site:>> http://manaplus.org@@ ##3--------------------------- ##3-- <<ManaPlus Contributors>> -- diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp index e8bdc7511..381244799 100644 --- a/src/actionmanager.cpp +++ b/src/actionmanager.cpp @@ -703,11 +703,11 @@ impHandler0(hideWindows) return true; } -static bool showHelpPage(const std::string &page) +static bool showHelpPage(const std::string &page, const bool showHide) { if (helpWindow) { - if (helpWindow->isWindowVisible()) + if (showHide && helpWindow->isWindowVisible()) { helpWindow->setVisible(false); } @@ -723,12 +723,12 @@ static bool showHelpPage(const std::string &page) impHandler0(helpWindowShow) { - return showHelpPage("index"); + return showHelpPage("index", true); } impHandler0(aboutWindowShow) { - return showHelpPage("about"); + return showHelpPage("about", false); } static void showHideWindow(Window *const window) diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index a77516c62..8e8831a49 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -24,7 +24,9 @@ #include "configuration.h" #include "main.h" -#include "gui/widgets/label.h" +#include "gui/widgets/browserbox.h" + +#include "input/inputmanager.h" #include "resources/image.h" #include "resources/imagehelper.h" @@ -35,9 +37,11 @@ Desktop::Desktop(const Widget2 *const widget) : Container(widget), + LinkHandler(), WidgetListener(), mWallpaper(nullptr), - mVersionLabel(nullptr), + mVersionLabel(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, + "browserbox.xml")), mSkin(nullptr), mBackgroundColor(getThemeColor(Theme::BACKGROUND, 128)), mBackgroundGrayColor(getThemeColor(Theme::BACKGROUND_GRAY)), @@ -57,15 +61,16 @@ Desktop::Desktop(const Widget2 *const widget) : const std::string appName = branding.getValue("appName", std::string()); if (appName.empty()) { - mVersionLabel = new Label(this, FULL_VERSION); + mVersionLabel->addRow(FULL_VERSION); } else { - mVersionLabel = new Label(this, strprintf("%s (%s)", FULL_VERSION, + mVersionLabel->addRow(strprintf("%s (%s)", FULL_VERSION, appName.c_str())); } - - mVersionLabel->setBackgroundColor(getThemeColor(Theme::BACKGROUND, 128)); + mVersionLabel->addRow("copyright", + "(C) ManaPlus developers, http://manaplus.org"); + mVersionLabel->setLinkHandler(this); } Desktop::~Desktop() @@ -100,6 +105,7 @@ void Desktop::reloadWallpaper() void Desktop::widgetResized(const Event &event A_UNUSED) { + mVersionLabel->setSize(getWidth(), getHeight()); setBestFittingWallpaper(); } @@ -198,3 +204,9 @@ void Desktop::setBestFittingWallpaper() logger->log("Couldn't load %s as wallpaper", wallpaperName.c_str()); } } + +void Desktop::handleLink(const std::string &link, MouseEvent *event) +{ + if (link == "copyright") + inputManager.executeAction(Input::KEY_WINDOW_ABOUT); +} diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index f0fd500ea..f3b0cd371 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -24,12 +24,14 @@ #include "gui/widgets/container.h" +#include "gui/widgets/linkhandler.h" + #include "listeners/widgetlistener.h" #include "localconsts.h" +class BrowserBox; class Image; -class Label; class Skin; /** @@ -46,7 +48,8 @@ class Skin; * \ingroup GUI */ class Desktop final : public Container, - private WidgetListener + public LinkHandler, + public WidgetListener { public: explicit Desktop(const Widget2 *const widget); @@ -66,11 +69,13 @@ class Desktop final : public Container, void postInit(); + void handleLink(const std::string &link, + MouseEvent *event) override final; private: void setBestFittingWallpaper(); Image *mWallpaper; - Label *mVersionLabel; + BrowserBox *mVersionLabel; Skin *mSkin; Color mBackgroundColor; Color mBackgroundGrayColor; |