digiKam
presentationwidget.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 : 2003-02-16
7  * Description : a presentation tool.
8  *
9  * Copyright (C) 2006-2009 by Valerio Fuoglio <valerio dot fuoglio at gmail dot com>
10  * Copyright (C) 2009 by Andi Clemens <andi dot clemens at googlemail dot com>
11  * Copyright (C) 2003-2005 by Renchi Raju <renchi dot raju at gmail dot com>
12  * Copyright (C) 2012-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
13  * Copyright (C) 2021 by Phuoc Khanh Le <phuockhanhnk94 at gmail dot com>
14  *
15  * This program is free software; you can redistribute it
16  * and/or modify it under the terms of the GNU General
17  * Public License as published by the Free Software Foundation;
18  * either version 2, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * ============================================================ */
26 
27 #ifndef DIGIKAM_PRESENTATION_WIDGET_H
28 #define DIGIKAM_PRESENTATION_WIDGET_H
29 
30 // Qt includes
31 
32 #include <QList>
33 #include <QMap>
34 #include <QPair>
35 #include <QPixmap>
36 #include <QPolygon>
37 #include <QString>
38 #include <QStringList>
39 #include <QWidget>
40 #include <QRandomGenerator>
41 
42 class QKeyEvent;
43 class QMouseEvent;
44 class QPaintEvent;
45 class QWheelEvent;
46 
48 {
49 
50 class PresentationContainer;
51 
52 class PresentationWidget : public QWidget
53 {
54  Q_OBJECT
55 
56 public:
57 
58  typedef int (PresentationWidget::*EffectMethod)(bool);
59 
60 public:
61 
62  explicit PresentationWidget(PresentationContainer* const sharedData);
63  ~PresentationWidget() override;
64 
65  void registerEffects();
66 
67  static QStringList effectNames();
68  static QMap<QString, QString> effectNamesI18N();
69 
70 protected:
71 
72  void mousePressEvent(QMouseEvent*) override;
73  void mouseMoveEvent(QMouseEvent*) override;
74  void wheelEvent(QWheelEvent*) override;
75  void keyPressEvent(QKeyEvent*) override;
76 
77  int effectNone(bool);
78  int effectChessboard(bool doInit);
79  int effectMeltdown(bool doInit);
80  int effectSweep(bool doInit);
81  int effectMosaic(bool doInit);
82  int effectCubism(bool doInit);
83  int effectRandom(bool doInit);
84  int effectGrowing(bool doInit);
85  int effectHorizLines(bool doInit);
86  int effectVertLines(bool doInit);
87  int effectMultiCircleOut(bool doInit);
88  int effectSpiralIn(bool doInit);
89  int effectCircleOut(bool doInit);
90  int effectBlobs(bool doInit);
91 
92  void paintEvent(QPaintEvent*) override;
93  void startPainter();
94 
95 protected:
96 
100  int m_px;
101  int m_py;
102  int m_psx;
103  int m_psy;
105  QPixmap m_buffer;
106 
107 private Q_SLOTS:
108 
109  void slotTimeOut();
110  void slotMouseMoveTimeOut();
111 
112  void slotPause();
113  void slotPlay();
114  void slotPrev();
115  void slotNext();
116  void slotClose();
117  void slotRemoveImageFromList();
118 
119  void slotVideoLoaded(bool);
120  void slotVideoFinished();
121 
122 private:
123 
124  void loadNextImage();
125  void loadPrevImage();
126  void showCurrentImage();
127  void printFilename();
128  void printComments();
129  void printProgress();
130  void showEndOfShow();
131  void showOverlays();
132  void hideOverlays();
133  void readSettings();
134 
135  EffectMethod getRandomEffect();
136 
137 private:
138 
139  // Disable
140  explicit PresentationWidget(QWidget*) = delete;
141 
142 private:
143 
144  class Private;
145  Private* const d;
146  QRandomGenerator *randomGenerator;
147 };
148 
149 } // namespace DigikamGenericPresentationPlugin
150 
151 #endif // DIGIKAM_PRESENTATION_WIDGET_H
Definition: presentationcontainer.h:54
Definition: presentationwidget.h:53
int effectSweep(bool doInit)
Definition: presentationwidget.cpp:1245
int m_py
Definition: presentationwidget.h:101
void startPainter()
Definition: presentationwidget.cpp:887
PresentationWidget(PresentationContainer *const sharedData)
Definition: presentationwidget.cpp:187
int effectMultiCircleOut(bool doInit)
Definition: presentationwidget.cpp:1558
int effectRandom(bool doInit)
Definition: presentationwidget.cpp:1430
int effectMeltdown(bool doInit)
Definition: presentationwidget.cpp:1181
int effectCubism(bool doInit)
Definition: presentationwidget.cpp:1390
int effectGrowing(bool doInit)
Definition: presentationwidget.cpp:1437
int m_psx
Definition: presentationwidget.h:102
int effectChessboard(bool doInit)
Definition: presentationwidget.cpp:1140
QPixmap m_buffer
Definition: presentationwidget.h:105
int effectSpiralIn(bool doInit)
Definition: presentationwidget.cpp:1612
int effectCircleOut(bool doInit)
Definition: presentationwidget.cpp:1686
static QMap< QString, QString > effectNamesI18N()
Definition: presentationwidget.cpp:1025
void wheelEvent(QWheelEvent *) override
Definition: presentationwidget.cpp:777
void mousePressEvent(QMouseEvent *) override
Definition: presentationwidget.cpp:710
bool m_startPainter
Definition: presentationwidget.h:98
void registerEffects()
Definition: presentationwidget.cpp:986
int m_psy
Definition: presentationwidget.h:103
void paintEvent(QPaintEvent *) override
Definition: presentationwidget.cpp:828
static QStringList effectNames()
Definition: presentationwidget.cpp:1003
int effectVertLines(bool doInit)
Definition: presentationwidget.cpp:1516
int(PresentationWidget::* EffectMethod)(bool)
Definition: presentationwidget.h:58
int effectBlobs(bool doInit)
Definition: presentationwidget.cpp:1730
~PresentationWidget() override
Definition: presentationwidget.cpp:358
bool m_simplyShow
Definition: presentationwidget.h:97
int m_px
Definition: presentationwidget.h:100
int effectNone(bool)
Definition: presentationwidget.cpp:1133
void mouseMoveEvent(QMouseEvent *) override
Definition: presentationwidget.cpp:731
void keyPressEvent(QKeyEvent *) override
Definition: presentationwidget.cpp:694
bool m_firstPainter
Definition: presentationwidget.h:99
bool m_endOfShow
Definition: presentationwidget.h:104
int effectHorizLines(bool doInit)
Definition: presentationwidget.cpp:1474
int effectMosaic(bool doInit)
Definition: presentationwidget.cpp:1325
Definition: presentation_audiopage.cpp:46