digiKam
presentationgl.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 : 2004-01-19
7  * Description : a presentation tool.
8  *
9  * Copyright (C) 2004 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2006-2009 by Valerio Fuoglio <valerio.fuoglio@gmail.com>
11  * Copyright (C) 2009 by Andi Clemens <andi dot clemens at googlemail 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_GL_H
28 #define DIGIKAM_PRESENTATION_GL_H
29 
30 #ifdef Q_CC_MSVC
31 # include <winsock2.h>
32 #endif
33 
34 // Qt includes
35 
36 #include <QOpenGLWidget>
37 #include <QKeyEvent>
38 #include <QList>
39 #include <QMap>
40 #include <QMouseEvent>
41 #include <QPair>
42 #include <QString>
43 #include <QStringList>
44 #include <QWheelEvent>
45 #include <QRandomGenerator>
46 
48 {
49 
50 class PresentationContainer;
51 
52 class PresentationGL : public QOpenGLWidget
53 {
54  Q_OBJECT
55 
56 public:
57 
58  explicit PresentationGL(PresentationContainer* const sharedData);
59  ~PresentationGL() override;
60 
61  void registerEffects();
62 
63  static QStringList effectNames();
64  static QMap<QString, QString> effectNamesI18N();
65 
66  bool checkOpenGL() const;
67 
68 protected:
69 
70  void initializeGL() override;
71  void paintGL() override;
72  void resizeGL(int w, int h) override;
73 
74  void mousePressEvent(QMouseEvent*) override;
75  void mouseMoveEvent(QMouseEvent*) override;
76  void wheelEvent(QWheelEvent*) override;
77  void keyPressEvent(QKeyEvent*) override;
78 
79 private:
80 
81  typedef void (PresentationGL::*EffectMethod)();
82 
83  QPixmap generateOutlinedTextPixmap(const QString& text);
84  QPixmap generateOutlinedTextPixmap(const QString& text, QFont& fn);
85  QPixmap generateCustomOutlinedTextPixmap(const QString& text,
86  QFont& fn, QColor& fgColor, QColor& bgColor,
87  int opacity, bool transBg = true);
88 
89  void paintTexture();
90  void advanceFrame();
91  void previousFrame();
92  void loadImage();
93  void montage(QImage& top, QImage& bot);
94  EffectMethod getRandomEffect();
95  void showEndOfShow();
96  void showOverlays();
97  void hideOverlays();
98  void printFilename(QImage& layer);
99  void printProgress(QImage& layer);
100  void printComments(QImage& layer);
101 
102  void effectNone();
103  void effectBlend();
104  void effectFade();
105  void effectRotate();
106  void effectBend();
107  void effectInOut();
108  void effectSlide();
109  void effectFlutter();
110  void effectCube();
111 
112 private Q_SLOTS:
113 
114  void slotTimeOut();
115  void slotMouseMoveTimeOut();
116 
117  void slotPause();
118  void slotPlay();
119  void slotPrev();
120  void slotNext();
121  void slotClose();
122 
123 private:
124 
125  // Disable
126  explicit PresentationGL(QWidget*) = delete;
127 
128 private:
129 
130  class Private;
131  Private* const d;
132  QRandomGenerator *randomGenerator;
133 };
134 
135 } // namespace DigikamGenericPresentationPlugin
136 
137 #endif // DIGIKAM_PRESENTATION_GL_H
Definition: presentationcontainer.h:54
void keyPressEvent(QKeyEvent *) override
Definition: presentationgl.cpp:426
void paintGL() override
Definition: presentationgl.cpp:386
static QStringList effectNames()
Definition: presentationgl.cpp:552
void resizeGL(int w, int h) override
Definition: presentationgl.cpp:416
void mouseMoveEvent(QMouseEvent *) override
Definition: presentationgl.cpp:464
void registerEffects()
Definition: presentationgl.cpp:539
bool checkOpenGL() const
Definition: presentationgl.cpp:1886
static QMap< QString, QString > effectNamesI18N()
Definition: presentationgl.cpp:570
void mousePressEvent(QMouseEvent *) override
Definition: presentationgl.cpp:443
PresentationGL(PresentationContainer *const sharedData)
Definition: presentationgl.cpp:168
void initializeGL() override
Definition: presentationgl.cpp:335
~PresentationGL() override
Definition: presentationgl.cpp:312
void wheelEvent(QWheelEvent *) override
Definition: presentationgl.cpp:511
Definition: presentation_audiopage.cpp:46