Summary: | advancedslideshow : option to pause, go back or forward, and quit/resume | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Wilbert Berendsen <wbsoft> |
Component: | Plugin-Generic-Presentation | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | caulier.gilles |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 7.2.0 | |
Sentry Crash Report: |
Description
Wilbert Berendsen
2004-08-13 09:34:09 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); *** This bug has been marked as a duplicate of 88600 *** Fixed with #88600 |