diff --git a/wallpapers/image/image.h b/wallpapers/image/image.h --- a/wallpapers/image/image.h +++ b/wallpapers/image/image.h @@ -59,8 +59,7 @@ Q_PROPERTY(int slideTimer READ slideTimer WRITE setSlideTimer NOTIFY slideTimerChanged) Q_PROPERTY(QStringList usersWallpapers READ usersWallpapers WRITE setUsersWallpapers NOTIFY usersWallpapersChanged) Q_PROPERTY(QStringList slidePaths READ slidePaths WRITE setSlidePaths NOTIFY slidePathsChanged) - Q_PROPERTY(int width MEMBER m_width READ width WRITE setWidth NOTIFY sizeChanged) - Q_PROPERTY(int height MEMBER m_height READ height WRITE setHeight NOTIFY sizeChanged) + Q_PROPERTY(QSize targetSize READ targetSize WRITE setTargetSize NOTIFY targetSizeChanged) Q_PROPERTY(QString photosPath READ photosPath CONSTANT) public: @@ -95,11 +94,6 @@ QSize targetSize() const; void setTargetSize(const QSize &size); - int width() const; - int height() const; - void setWidth(int w); - void setHeight(int h); - KPackage::Package *package(); QAbstractItemModel* wallpaperModel(); @@ -129,11 +123,11 @@ void settingsChanged(bool); void wallpaperPathChanged(); void renderingModeChanged(); + void targetSizeChanged(); void slideTimerChanged(); void usersWallpapersChanged(); void slidePathsChanged(); void resizeMethodChanged(); - void sizeChanged(QSize s); void customWallpaperPicked(); protected Q_SLOTS: @@ -184,9 +178,6 @@ int m_currentSlide; BackgroundListModel *m_model; QFileDialog *m_dialog; - QSize m_size; - int m_width; - int m_height; QString m_img; QDateTime m_previousModified; QPointer m_newStuffDialog; diff --git a/wallpapers/image/image.cpp b/wallpapers/image/image.cpp --- a/wallpapers/image/image.cpp +++ b/wallpapers/image/image.cpp @@ -61,9 +61,7 @@ m_mode(SingleImage), m_currentSlide(-1), m_model(0), - m_dialog(0), - m_width(0), - m_height(0) + m_dialog(0) { m_wallpaperPackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Wallpaper/Images")); @@ -74,8 +72,6 @@ connect(m_dirWatch, &KDirWatch::deleted, this, &Image::pathDeleted); m_dirWatch->startScan(); - connect(this, &Image::sizeChanged, this, &Image::setTargetSize); - useSingleImageDefaults(); setSingleImage(); } @@ -239,31 +235,9 @@ } setSingleImage(); } -} -int Image::height() const -{ - return m_height; -} - -void Image::setHeight(int h) -{ - if (m_height != h) { - m_height = h; - emit sizeChanged(QSize(m_width, m_height)); - } -} - -int Image::width() const -{ - return m_width; -} - -void Image::setWidth(int w) -{ - if (m_width != w) { - m_width = w; - emit sizeChanged(QSize(m_width, m_height)); + if (sizeChanged) { + emit targetSizeChanged(); } } diff --git a/wallpapers/image/imagepackage/contents/config/main.xml b/wallpapers/image/imagepackage/contents/config/main.xml --- a/wallpapers/image/imagepackage/contents/config/main.xml +++ b/wallpapers/image/imagepackage/contents/config/main.xml @@ -18,14 +18,6 @@ 0 - - - 0 - - - - 0 - diff --git a/wallpapers/image/imagepackage/contents/ui/config.qml b/wallpapers/image/imagepackage/contents/ui/config.qml --- a/wallpapers/image/imagepackage/contents/ui/config.qml +++ b/wallpapers/image/imagepackage/contents/ui/config.qml @@ -46,8 +46,7 @@ Wallpaper.Image { id: imageWallpaper - width: wallpaper.configuration.width - height: wallpaper.configuration.height + targetSize: Qt.size(plasmoid.width, plasmoid.height) onSlidePathsChanged: cfg_SlidePaths = slidePaths } @@ -279,7 +278,7 @@ focus: true cellWidth: Math.floor(wallpapersGrid.width / Math.max(Math.floor(wallpapersGrid.width / (units.gridUnit*12)), 3)) - cellHeight: cellWidth / (imageWallpaper.width / imageWallpaper.height) + cellHeight: Math.round(cellWidth / (imageWallpaper.targetSize.width / imageWallpaper.targetSize.height)) anchors.margins: 4 boundsBehavior: Flickable.StopAtBounds diff --git a/wallpapers/image/imagepackage/contents/ui/main.qml b/wallpapers/image/imagepackage/contents/ui/main.qml --- a/wallpapers/image/imagepackage/contents/ui/main.qml +++ b/wallpapers/image/imagepackage/contents/ui/main.qml @@ -133,17 +133,6 @@ } } - Binding { - target: wallpaper.configuration - property: "width" - value: root.width - } - Binding { - target: wallpaper.configuration - property: "height" - value: root.height - } - onWidthChanged: startFadeSourceTimer() onHeightChanged: startFadeSourceTimer() @@ -164,9 +153,7 @@ id: imageWallpaper //the oneliner of difference between image and slideshow wallpapers renderingMode: (wallpaper.pluginName == "org.kde.image") ? Wallpaper.Image.SingleImage : Wallpaper.Image.SlideShow -// targetSize: "1920x1080" - width: root.width - height: root.height + targetSize: Qt.size(root.width, root.height) slidePaths: wallpaper.configuration.SlidePaths slideTimer: wallpaper.configuration.SlideInterval } diff --git a/wallpapers/image/slideshowpackage/contents/config/main.xml b/wallpapers/image/slideshowpackage/contents/config/main.xml --- a/wallpapers/image/slideshowpackage/contents/config/main.xml +++ b/wallpapers/image/slideshowpackage/contents/config/main.xml @@ -18,14 +18,6 @@ 0 - - - 0 - - - - 0 -