[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 87106] wish: slideshowplugin: option to pause,
From:       Joern Ahrens <kde () jokele ! de>
Date:       2004-08-14 9:20:13
Message-ID: 20040814092013.10872.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
      
http://bugs.kde.org/show_bug.cgi?id=87106      




------- Additional Comments From kde jokele de  2004-08-14 11:20 -------
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);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic