Bug 87106 - advancedslideshow : option to pause, go back or forward, and quit/resume
Summary: advancedslideshow : option to pause, go back or forward, and quit/resume
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Generic-Presentation (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-13 09:34 UTC by Wilbert Berendsen
Modified: 2020-09-18 03:54 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 7.2.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wilbert Berendsen 2004-08-13 09:34:09 UTC
Version:           0.7.0-cvs (using KDE 3.3.0, compiled sources)
Compiler:          gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)
OS:                Linux (i686) release 2.6.7-gentoo-r11

During a slideshow it would be nice to be able to pause the show, or to go back or forward.

This could be implemented using keyboard (could not find a key except ESC to abort the show), or with a little borderless popup window that appears when a user moves the mouse or so.

ALso it would be nice if I could resume a show of an album. Sometimes during view of an album I see something, e.g. an incorrectly rotated image. I go out the slideshow, fix the image, and would like to be able to resume the slideshow without having to start all over again :-)
Comment 1 Joern Ahrens 2004-08-14 11:20:10 UTC
CVS commit by jahrens: 

When the spacebar is pressed, the slideshow is interrupted until the spacebar is pressed again.

-> Additionally, it has to be added an info when the slideshow is paused, maybe an icon like this "||" or "paused" at the bottom line.

CCMAIL: 87106@bugs.kde.org


  M +81 -2     slideshow.cpp   1.7
  M +3 -2      slideshow.h   1.5


--- kdeextragear-libs-1/kipi-plugins/slideshow/slideshow.cpp  #1.6:1.7
@@ -42,4 +42,65 @@ namespace KIPISlideShowPlugin
 {
 
+/**
+ * This Timer can be interrupted to pause a slideshow
+ */
+class PauseTimer : public QTimer
+{
+public:
+    PauseTimer(QObject *parent=0, const char *name=0);
+    
+    int start(int msec, bool sshot=FALSE);
+    void stop();
+    bool pause();
+    
+private:
+    time_t  m_startTime;
+    int     m_msecRest;
+    int     m_msec;
+    bool    m_paused;
+};
+
+PauseTimer::PauseTimer(QObject *parent, const char *name) :
+    QTimer(parent, name)
+{
+    m_startTime = 0;
+    m_msecRest = 0;
+    m_paused = false;
+}
+
+int PauseTimer::start(int msec, bool sshot)
+{
+    m_startTime = time(0);
+    m_msec = msec;
+    return QTimer::start(msec, sshot);
+}
+
+bool PauseTimer::pause()
+{
+    if(!m_paused)
+    {
+        m_msecRest = m_msec - time(0) - m_startTime;
+        stop();
+    }
+    else
+    {
+        if(m_msecRest < 0)
+            start(0, true);
+        else
+            start(m_msecRest, true);
+    }
+    
+    m_paused = !m_paused;
+    return m_paused;
+}
+
+void PauseTimer::stop()
+{
+    m_startTime = 0;
+    m_msecRest = 0;
+    m_paused = false;    
+    QTimer::stop();
+}
+
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -60,5 +121,5 @@ SlideShow::SlideShow(const QStringList& 
     effect_        = 0;
     effectRunning_ = false;
-    timer_ = new QTimer(this);
+    timer_ = new PauseTimer(this);
     connect(timer_, SIGNAL(timeout()), SLOT(slotTimeOut()));
     mIntArray = 0;
@@ -373,4 +433,23 @@ void SlideShow::showEndOfShow()
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
+void SlideShow::keyPressEvent(QKeyEvent *event)
+{
+    if(!event)
+        return;
+        
+    if(event->key() == Qt::Key_Space)
+    {
+        event->accept();
+        timer_->pause();
+    }
+    else
+    {
+        event->ignore();
+        QWidget::keyPressEvent(event);
+    }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////
+
 void SlideShow::mousePressEvent(QMouseEvent *event)
 {

--- kdeextragear-libs-1/kipi-plugins/slideshow/slideshow.h  #1.4:1.5
@@ -29,5 +29,4 @@
 #include <qmap.h>
 
-class QTimer;
 class QMouseEvent;
 
@@ -35,4 +34,5 @@ namespace KIPISlideShowPlugin
 {
 
+class PauseTimer;
 class ImlibIface;
 class ImImageSS;
@@ -83,5 +83,5 @@ private:
     
     QStringList fileList_;
-    QTimer     *timer_;
+    PauseTimer *timer_;
     QTimer     *mouseMoveTimer_;
     int         fileIndex_;
@@ -102,4 +102,5 @@ protected:
     void mousePressEvent(QMouseEvent *event);
     void mouseMoveEvent(QMouseEvent *);
+    void keyPressEvent(QKeyEvent *event);
     
     int effectNone(bool);


Comment 2 Renchi Raju 2004-10-06 18:52:58 UTC

*** This bug has been marked as a duplicate of 88600 ***
Comment 3 caulier.gilles 2020-09-18 03:54:37 UTC
Fixed with #88600