diff options
-rw-r--r-- | data/graphics/gui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | data/graphics/gui/Makefile.am | 1 | ||||
-rw-r--r-- | data/graphics/gui/desktop.xml | 8 | ||||
-rw-r--r-- | src/gui/widgets/desktop.cpp | 25 | ||||
-rw-r--r-- | src/gui/widgets/desktop.h | 3 |
5 files changed, 35 insertions, 3 deletions
diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt index d14f544f3..497a21b00 100644 --- a/data/graphics/gui/CMakeLists.txt +++ b/data/graphics/gui/CMakeLists.txt @@ -16,6 +16,7 @@ SET (FILES complete_icon.xml dbutton.xml dbutton_image.xml + desktop.xml dpad.xml dpad_image.xml dropdown.xml diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am index 1e2315d09..1e9ce625b 100644 --- a/data/graphics/gui/Makefile.am +++ b/data/graphics/gui/Makefile.am @@ -19,6 +19,7 @@ gui_DATA = \ complete_icon.xml \ dbutton.xml \ dbutton_image.xml \ + desktop.xml \ dpad.xml \ dpad_image.xml \ dropdown.xml \ diff --git a/data/graphics/gui/desktop.xml b/data/graphics/gui/desktop.xml new file mode 100644 index 000000000..981dfde83 --- /dev/null +++ b/data/graphics/gui/desktop.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<skinset name="Default" image="window.png"> + <widget type="Window"> + <option name="showBackground" value="1" /> + <option name="versionX" value="25" /> + <option name="versionY" value="2" /> + </widget> +</skinset> diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 9bbe91cbb..d2e132c56 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -38,13 +38,22 @@ Desktop::Desktop(const Widget2 *const widget) : gcn::WidgetListener(), mWallpaper(nullptr), mVersionLabel(nullptr), + mSkin(nullptr), mBackgroundColor(getThemeColor(Theme::BACKGROUND, 128)), - mBackgroundGrayColor(getThemeColor(Theme::BACKGROUND_GRAY)) + mBackgroundGrayColor(getThemeColor(Theme::BACKGROUND_GRAY)), + mShowBackground(true) { addWidgetListener(this); Wallpaper::loadWallpapers(); + Theme *const theme = Theme::instance(); + if (theme) + mSkin = theme->load("desktop.xml", ""); + + if (mSkin) + mShowBackground = mSkin->getOption("showBackground"); + const std::string appName = branding.getValue("appName", std::string()); if (appName.empty()) { @@ -66,11 +75,21 @@ Desktop::~Desktop() mWallpaper->decRef(); mWallpaper = nullptr; } + if (Theme::instance()) + Theme::instance()->unload(mSkin); } void Desktop::postInit() { - add(mVersionLabel, 25, 2); + if (mSkin) + { + add(mVersionLabel, mSkin->getOption("versionX", 25), + mSkin->getOption("versionY", 2)); + } + else + { + add(mVersionLabel, 25, 2); + } } void Desktop::reloadWallpaper() @@ -132,7 +151,7 @@ void Desktop::draw(gcn::Graphics *graphics) void Desktop::setBestFittingWallpaper() { - if (!config.getBoolValue("showBackground")) + if (!mShowBackground || !config.getBoolValue("showBackground")) return; const std::string wallpaperName = diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index 112d1e794..824620f3b 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -30,6 +30,7 @@ class Image; class Label; +class Skin; /** * Desktop widget, for drawing a background image and color. @@ -69,8 +70,10 @@ class Desktop final : public Container, private gcn::WidgetListener Image *mWallpaper; Label *mVersionLabel; + Skin *mSkin; gcn::Color mBackgroundColor; gcn::Color mBackgroundGrayColor; + bool mShowBackground; }; #endif // GUI_WIDGETS_DESKTOP_H |