digiKam
slideshowloader.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2005-04-21
7  * Description : slide show tool using preview of pictures.
8  *
9  * Copyright (C) 2005-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2019-2020 by Minh Nghia Duong <minhnghiaduong997 at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_SLIDE_SHOW_LOADER_H
26 #define DIGIKAM_SLIDE_SHOW_LOADER_H
27 
28 // Qt includes
29 
30 #include <QKeyEvent>
31 #include <QMouseEvent>
32 #include <QPaintEvent>
33 #include <QWheelEvent>
34 #include <QStackedWidget>
35 
36 // Local includes
37 
38 #include "digikam_export.h"
39 #include "dinfointerface.h"
40 #include "loadingdescription.h"
41 #include "slideshowsettings.h"
42 #include "dimg.h"
43 
44 using namespace Digikam;
45 
47 {
48 
49 class SlideShowLoader : public QStackedWidget
50 {
51  Q_OBJECT
52 
53 public:
54 
56  {
57  ErrorView = 0,
60  EndView
61  };
62 
63 public:
64 
65  explicit SlideShowLoader(SlideShowSettings* const settings);
66  ~SlideShowLoader() override;
67 
68  void setCurrentItem(const QUrl& url);
69  QUrl currentItem() const;
70 
71  void setShortCutPrefixes(const QMap<QString, QString>& prefixes);
72 
73 Q_SIGNALS:
74 
75  void signalLastItemUrl(const QUrl&);
76 
77 public Q_SLOTS:
78 
79  void slotRemoveImageFromList();
80  void slotLoadNextItem();
81  void slotLoadPrevItem();
82  void slotPause();
83  void slotPlay();
84 
85  void slotAssignRating(int);
86  void slotAssignColorLabel(int);
87  void slotAssignPickLabel(int);
88  void slotToggleTag(int tag);
89 
90  void slotHandleShortcut(const QString& shortcut, int val);
91 
92 protected:
93 
94  void mousePressEvent(QMouseEvent*) override;
95  void keyPressEvent(QKeyEvent*) override;
96  void wheelEvent(QWheelEvent*) override;
97 
98 private Q_SLOTS:
99 
100  void slotMouseMoveTimeOut();
101  void slotImageLoaded(bool);
102  void slotScreenSelected(int);
103  void slotVideoLoaded(bool);
104  void slotVideoFinished();
105 
106 private:
107 
108  void setCurrentView(SlideShowViewMode);
109  bool eventFilter(QObject* obj, QEvent* ev) override;
110  void preloadNextItem();
111  void endOfSlide();
112  void inhibitScreenSaver();
113  void allowScreenSaver();
114  void dispatchCurrentInfoChange(const QUrl& url);
115  void makeCornerRectangles(const QRect& desktopRect, const QSize& size,
116  QRect* const topLeft, QRect* const topRight,
117  QRect* const topLeftLarger, QRect* const topRightLarger);
118 
119 private:
120 
121  // Disable
122  explicit SlideShowLoader(QWidget*) = delete;
123 
124 private:
125 
126  class Private;
127  Private* const d;
128 };
129 
130 } // namespace DigikamGenericSlideShowPlugin
131 
132 #endif // DIGIKAM_SLIDE_SHOW_LOADER_H
Definition: slideshowloader.h:50
SlideShowViewMode
Definition: slideshowloader.h:56
@ VideoView
Definition: slideshowloader.h:59
@ ImageView
Definition: slideshowloader.h:58
Definition: slideshowsettings.h:52
Definition: slideshowloader.cpp:70
Definition: datefolderview.cpp:43