File indexing completed on 2024-04-28 04:21:24

0001 // SPDX-FileCopyrightText: 2012-2022 Jesper K. Pedersen <blackie@kde.org>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #ifndef VIDEOTHUMBNAILCYCLER_H
0006 #define VIDEOTHUMBNAILCYCLER_H
0007 
0008 #include <kpabase/FileName.h>
0009 
0010 #include <QObject>
0011 
0012 class QTimer;
0013 class QImage;
0014 
0015 namespace DB
0016 {
0017 class FileName;
0018 }
0019 namespace ImageManager
0020 {
0021 class VideoThumbnails;
0022 }
0023 
0024 namespace ThumbnailView
0025 {
0026 
0027 class ThumbnailModel;
0028 
0029 /**
0030   \brief Class which is responsible for cycling the video thumbnails in the thumbnail viewer
0031   \see \ref videothumbnails
0032 */
0033 class VideoThumbnailCycler : public QObject
0034 {
0035     Q_OBJECT
0036 public:
0037     explicit VideoThumbnailCycler(ThumbnailModel *model, QObject *parent = nullptr);
0038     static VideoThumbnailCycler *instance();
0039     void setActive(const DB::FileName &id);
0040     void stopCycle();
0041 
0042 private Q_SLOTS:
0043     void gotFrame(const QImage &image);
0044 
0045 private:
0046     void resetPreviousThumbail();
0047     bool isVideo(const DB::FileName &fileName) const;
0048     void startCycle();
0049 
0050     static VideoThumbnailCycler *s_instance;
0051     DB::FileName m_fileName;
0052     QTimer *m_timer;
0053     ImageManager::VideoThumbnails *m_thumbnails;
0054     ThumbnailModel *m_model;
0055 };
0056 
0057 }
0058 #endif // VIDEOTHUMBNAILCYCLER_H
0059 // vi:expandtab:tabstop=4 shiftwidth=4: