File indexing completed on 2024-04-28 04:18:53
0001 // vim: set tabstop=4 shiftwidth=4 expandtab: 0002 /* 0003 Gwenview: an image viewer 0004 Copyright 2007 Aurélien Gâteau <agateau@kde.org> 0005 0006 This program is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU General Public License 0008 as published by the Free Software Foundation; either version 2 0009 of the License, or (at your option) any later version. 0010 0011 This program is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 GNU General Public License for more details. 0015 0016 You should have received a copy of the GNU General Public License 0017 along with this program; if not, write to the Free Software 0018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0019 0020 */ 0021 #ifndef SLIDESHOW_H 0022 #define SLIDESHOW_H 0023 0024 #include <lib/gwenviewlib_export.h> 0025 0026 // Qt 0027 #include <QObject> 0028 #include <QUrl> 0029 0030 // KF 0031 0032 class QAction; 0033 0034 namespace Gwenview 0035 { 0036 struct SlideShowPrivate; 0037 class GWENVIEWLIB_EXPORT SlideShow : public QObject 0038 { 0039 Q_OBJECT 0040 public: 0041 enum NavigationEndNotification { 0042 NeverWarn, 0043 WarnOnSlideshow, 0044 AlwaysWarn, 0045 }; 0046 Q_ENUM(NavigationEndNotification) 0047 0048 explicit SlideShow(QObject *parent); 0049 ~SlideShow() override; 0050 0051 void start(const QList<QUrl> &urls); 0052 void pause(); 0053 0054 QAction *loopAction() const; 0055 QAction *randomAction() const; 0056 0057 /** @return true if the slideshow is running */ 0058 bool isRunning() const; 0059 0060 /** 0061 * @return interval in seconds 0062 */ 0063 int interval() const; 0064 /** 0065 * @return position in time slot for current image in milliseconds 0066 */ 0067 int position() const; 0068 0069 public Q_SLOTS: 0070 void setInterval(int); 0071 void setCurrentUrl(const QUrl &url); 0072 0073 /** 0074 * Resume slideshow and go to next url. 0075 */ 0076 void resumeAndGoToNextUrl(); 0077 0078 Q_SIGNALS: 0079 void goToUrl(const QUrl &); 0080 /** 0081 * Slideshow has been started or paused 0082 */ 0083 void stateChanged(bool running); 0084 /** 0085 * Emitted when interval has been changed 0086 * @param interval interval in seconds 0087 */ 0088 void intervalChanged(int interval); 0089 0090 private Q_SLOTS: 0091 void goToNextUrl(); 0092 void updateConfig(); 0093 void slotRandomActionToggled(bool on); 0094 0095 private: 0096 SlideShowPrivate *const d; 0097 }; 0098 0099 } // namespace 0100 0101 #endif // SLIDESHOW_H