From 4abbb950f32b10b6bd64b36766c4129060fe5eb2 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 29 Jun 2015 13:13:07 -0500 Subject: Attempt to scale background image if a background image with native resolution is not available --- src/thememoodin.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/thememoodin.cpp b/src/thememoodin.cpp index d1711fa..2ad557c 100644 --- a/src/thememoodin.cpp +++ b/src/thememoodin.cpp @@ -161,6 +161,7 @@ void ThemeMoodin::initBackground(TQPainter* p) return; TQString bgImage; + bool scaleBgImage; if (mUsersBackground) { @@ -170,18 +171,29 @@ void ThemeMoodin::initBackground(TQPainter* p) kdesktoprc.setGroup(TQString("Desktop%1").arg(num)); bgImage = kdesktoprc.readPathEntry("Wallpaper", TQString()); + if (kdesktoprc.readPathEntry("WallpaperMode", TQString()) == "Scaled") { + scaleBgImage = true; + } + else { + scaleBgImage = false; + } } else { if (!mBackgroundImage.isEmpty()) bgImage = mTheme->locateThemeData(mBackgroundImage); + scaleBgImage = false; } - if (bgImage.isEmpty()) + if (bgImage.isEmpty()) { bgImage = mTheme->locateThemeData(TQString("Background-%1x%2.jpg").arg(width()).arg(height())); + scaleBgImage = false; + } - if (bgImage.isEmpty()) + if (bgImage.isEmpty()) { bgImage = mTheme->locateThemeData("Background.jpg"); + scaleBgImage = true; + } if (bgImage.isEmpty()) { @@ -190,7 +202,12 @@ void ThemeMoodin::initBackground(TQPainter* p) } TQImage* bg = mCache->cacheFile(bgImage); - p->drawImage(0, 0, *bg); + if (scaleBgImage) { + p->drawImage(0, 0, (*bg).scale(width(), height())); + } + else { + p->drawImage(0, 0, *bg); + } delete bg; if (mKubuntuStyle) { -- cgit v1.2.1