diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-07-16 14:35:39 +0900 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2022-07-17 14:44:44 +0300 |
commit | 14bc816be9c921a6b004e0b0419e0c4c2f010b8c (patch) | |
tree | 83af2c09a0b99e564f8577b01e283de2ced7a0b7 /kcontrol | |
parent | d6db1a583cc495ae318872e298f200ee1da673d9 (diff) | |
download | tdebase-14bc816be9c921a6b004e0b0419e0c4c2f010b8c.tar.gz tdebase-14bc816be9c921a6b004e0b0419e0c4c2f010b8c.zip |
Use Scale & Crop as default style for wallpaper.
Add more options to "Set as Background" menu in Konqueror.
This resolves issue #280 and issue #281.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kcontrol')
-rw-r--r-- | kcontrol/background/bgdefaults.h | 4 | ||||
-rw-r--r-- | kcontrol/background/bgdialog.cpp | 54 | ||||
-rw-r--r-- | kcontrol/background/bgdialog.h | 7 |
3 files changed, 52 insertions, 13 deletions
diff --git a/kcontrol/background/bgdefaults.h b/kcontrol/background/bgdefaults.h index bde81071a..e6ece1cfe 100644 --- a/kcontrol/background/bgdefaults.h +++ b/kcontrol/background/bgdefaults.h @@ -24,12 +24,10 @@ #define _defMinOptimizationDepth 1 // Per desktop defaults -// Before you change this get in touch with me (kb9vqf@pearsoncomputing.net) -// Thanks!! #define _defColorA TQColor("#003082") #define _defColorB TQColor("#C0C0C0") #define _defBackgroundMode KBackgroundSettings::Flat -#define _defWallpaperMode KBackgroundSettings::Scaled +#define _defWallpaperMode KBackgroundSettings::ScaleAndCrop #define _defMultiMode KBackgroundSettings::NoMulti #define _defBlendMode KBackgroundSettings::NoBlending #define _defBlendBalance 100 diff --git a/kcontrol/background/bgdialog.cpp b/kcontrol/background/bgdialog.cpp index 365713a06..67756d466 100644 --- a/kcontrol/background/bgdialog.cpp +++ b/kcontrol/background/bgdialog.cpp @@ -1,5 +1,4 @@ /* - This file is part of the KDE libraries Copyright (c) 2005 David Saxton <david@bluehaze.org> @@ -245,10 +244,36 @@ BGDialog::BGDialog(TQWidget* parent, TDEConfig* _config, bool _multidesktop) m_slideShowRandom = KBackgroundSettings::InOrder; // Wallpaper Position + m_prevWallpaperPos = KBackgroundSettings::ScaleAndCrop; + m_prevTilePos = KBackgroundSettings::Tiled; + m_wallpaperPos = eRenderer()->wallpaperMode(); if (m_wallpaperPos == KBackgroundSettings::NoWallpaper) m_wallpaperPos = KBackgroundSettings::Centred; // Default + const TQString path = eRenderer()->wallpaper(); + KFileMetaInfo metaInfo(path); + if (metaInfo.isValid() && metaInfo.item("Dimensions").isValid()) + { + // If the image is greater than 800x600 default to using the user selected mode + // for a normal wallpaper, otherwise default to user selection for tiles. + TQSize s = metaInfo.item("Dimensions").value().toSize(); + m_isTile = (s.width() < 800 || s.height() < 600); + if (m_isTile) + { + m_prevTilePos = m_wallpaperPos; + } + else + { + m_prevWallpaperPos = m_wallpaperPos; + } + } + else if (KMimeType::findByPath(path)->is("image/svg+xml")) + { + m_prevWallpaperPos = m_wallpaperPos; + } + + // Restrictions if (TDEGlobal::dirs()->isRestrictedResource("wallpaper")) { m_urlWallpaperButton->hide(); @@ -940,18 +965,22 @@ void BGDialog::slotWallpaperTypeChanged(int i) KFileMetaInfo metaInfo(path); if (metaInfo.isValid() && metaInfo.item("Dimensions").isValid()) { - // If the image is greater than 800x600 default to using scaled mode, - // otherwise default to tiled. - + // If the image is greater than 800x600 default to using the user selected mode + // for a normal wallpaper, otherwise default to user selection for tiles. TQSize s = metaInfo.item("Dimensions").value().toSize(); - if (s.width() >= 800 && s.height() >= 600) - m_wallpaperPos = KBackgroundSettings::Scaled; + m_isTile = (s.width() < 800 || s.height() < 600); + if (m_isTile) + { + m_wallpaperPos = m_prevTilePos; + } else - m_wallpaperPos = KBackgroundSettings::Tiled; + { + m_wallpaperPos = m_prevWallpaperPos; + } } else if (KMimeType::findByPath(path)->is("image/svg+xml")) { - m_wallpaperPos = KBackgroundSettings::Scaled; + m_wallpaperPos = m_prevWallpaperPos; } r->setWallpaperMode(m_wallpaperPos); @@ -998,6 +1027,15 @@ void BGDialog::slotWallpaperPos(int mode) if (mode == r->wallpaperMode()) return; + if (m_isTile) + { + m_prevTilePos = mode; + } + else + { + m_prevWallpaperPos = mode; + } + r->stop(); r->setWallpaperMode(mode); r->start(true); diff --git a/kcontrol/background/bgdialog.h b/kcontrol/background/bgdialog.h index 6b33d8999..607118337 100644 --- a/kcontrol/background/bgdialog.h +++ b/kcontrol/background/bgdialog.h @@ -99,8 +99,11 @@ protected: TQValueVector< TQPtrVector<KBackgroundRenderer> > m_renderer; // m_renderer[desk][screen] TQMap<TQString,int> m_wallpaper; TQStringList m_patterns; - int m_slideShowRandom; // Remembers last Slide Show setting - int m_wallpaperPos; // Remembers last wallpaper pos + int m_slideShowRandom; // Remembers last Slide Show setting + int m_wallpaperPos; // Remembers last wallpaper pos + int m_prevWallpaperPos; // Previous normal wallpaper pos + int m_prevTilePos; // Previous tile wallpaper pos + bool m_isTile; // Whether the wallpaper is a tile (800x600 or smaller) BGMonitorArrangement * m_pMonitorArrangement; |