diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-15 20:16:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-15 20:16:16 +0300 |
commit | 5c83a96b8ad85ad0562542b9720a0df6c5fb550c (patch) | |
tree | 1759cd93802d506583c7030119f1115b0444e226 /src/gui/widgets/desktop.cpp | |
parent | a260aeab234704ace8ba672b1d1ce57e18425e07 (diff) | |
parent | 22cb237571e06395ec241377721c02716f0ea8a7 (diff) | |
download | plus-5c83a96b8ad85ad0562542b9720a0df6c5fb550c.tar.gz plus-5c83a96b8ad85ad0562542b9720a0df6c5fb550c.tar.bz2 plus-5c83a96b8ad85ad0562542b9720a0df6c5fb550c.tar.xz plus-5c83a96b8ad85ad0562542b9720a0df6c5fb550c.zip |
Merge branch 'master' into stable
Diffstat (limited to 'src/gui/widgets/desktop.cpp')
-rw-r--r-- | src/gui/widgets/desktop.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index a77516c62..0ff1b17c9 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, false, + "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(); } @@ -138,10 +144,6 @@ void Desktop::draw(Graphics *graphics) graphics->fillRectangle(Rect(0, 0, width, height)); } - // Draw a thin border under the application version... - graphics->setColor(mBackgroundColor); - graphics->fillRectangle(Rect(mVersionLabel->getDimension())); - Container::draw(graphics); BLOCK_END("Desktop::draw") } @@ -198,3 +200,9 @@ void Desktop::setBestFittingWallpaper() logger->log("Couldn't load %s as wallpaper", wallpaperName.c_str()); } } + +void Desktop::handleLink(const std::string &link, MouseEvent *event A_UNUSED) +{ + if (link == "copyright") + inputManager.executeAction(Input::KEY_WINDOW_ABOUT); +} |