[graphics/digikam] core/dplugins/generic/view/slideshow: Keep the displayed item when shuffle is changed in the slide show

Gilles Caulier <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit a7377f2f5d55a9e62a635b1460bc9ca74bfe34da by Gilles Caulier, on behalf of Mark Cockram.
Committed on 30/07/2026 at 13:09.
Pushed by cgilles into branch 'master'.

Keep the displayed item when shuffle is changed in the slide show

Accepting the settings dialog during a slide show shuffles or
restores the file list, but the current index still pointed at a
raw position, so the show jumped to another item. Look up the
displayed item again after the list was reordered.

M  +14   -0    core/dplugins/generic/view/slideshow/common/slideshowloader.cpp
M  +1    -0    core/dplugins/generic/view/slideshow/common/slideshowloader.h
M  +1    -1    core/dplugins/generic/view/slideshow/widgets/slideosd.cpp

https://invent.kde.org/graphics/digikam/-/commit/a7377f2f5d55a9e62a635b1460bc9ca74bfe34da

diff --git a/core/dplugins/generic/view/slideshow/common/slideshowloader.cpp b/core/dplugins/generic/view/slideshow/common/slideshowloader.cpp
index f9aeda945a..d722231415 100644
--- a/core/dplugins/generic/view/slideshow/common/slideshowloader.cpp
+++ b/core/dplugins/generic/view/slideshow/common/slideshowloader.cpp
@@ -336,6 +336,20 @@ void SlideShowLoader::resolveStartItem()
     }
 }
 
+void SlideShowLoader::reshuffleImages()
+{
+    QUrl url  = currentItem();
+
+    d->settings->suffleImages();
+
+    int index = d->settings->indexOf(url);
+
+    if (index != -1)
+    {
+        d->fileIndex = index;
+    }
+}
+
 QUrl SlideShowLoader::currentItem() const
 {
     return d->settings->fileList.value(d->fileIndex);
diff --git a/core/dplugins/generic/view/slideshow/common/slideshowloader.h b/core/dplugins/generic/view/slideshow/common/slideshowloader.h
index 98bcbaeffa..e7ec48f420 100644
--- a/core/dplugins/generic/view/slideshow/common/slideshowloader.h
+++ b/core/dplugins/generic/view/slideshow/common/slideshowloader.h
@@ -64,6 +64,7 @@ public:
 
     void setCurrentItem(const QUrl& url);
     void resolveStartItem();
+    void reshuffleImages();
     QUrl currentItem() const;
 
     void setShortCutPrefixes(const QMap<QString, QString>& prefixes);
diff --git a/core/dplugins/generic/view/slideshow/widgets/slideosd.cpp b/core/dplugins/generic/view/slideshow/widgets/slideosd.cpp
index aff99c5bfc..be013e9a79 100644
--- a/core/dplugins/generic/view/slideshow/widgets/slideosd.cpp
+++ b/core/dplugins/generic/view/slideshow/widgets/slideosd.cpp
@@ -297,7 +297,7 @@ void SlideOSD::slotUpdateSettings()
     d->clWidget->setVisible(d->settings->printLabels);
     d->plWidget->setVisible(d->settings->printLabels);
     d->progressBar->setMaximum(d->settings->delay);
-    d->settings->suffleImages();
+    d->parent->reshuffleImages();
 }
 
 SlideToolBar* SlideOSD::toolBar() const
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.