File indexing completed on 2025-03-09 03:52:07
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2004-01-19 0007 * Description : a presentation tool. 0008 * 0009 * SPDX-FileCopyrightText: 2004 by Renchi Raju <renchi dot raju at gmail dot com> 0010 * SPDX-FileCopyrightText: 2006-2009 by Valerio Fuoglio <valerio.fuoglio@gmail.com> 0011 * SPDX-FileCopyrightText: 2009 by Andi Clemens <andi dot clemens at googlemail dot com> 0012 * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0013 * SPDX-FileCopyrightText: 2021 by Phuoc Khanh Le <phuockhanhnk94 at gmail dot com> 0014 * 0015 * SPDX-License-Identifier: GPL-2.0-or-later 0016 * 0017 * ============================================================ */ 0018 0019 #ifndef DIGIKAM_PRESENTATION_GL_H 0020 #define DIGIKAM_PRESENTATION_GL_H 0021 0022 #ifdef Q_CC_MSVC 0023 # include <winsock2.h> 0024 #endif 0025 0026 // Qt includes 0027 0028 #include <QOpenGLWidget> 0029 #include <QKeyEvent> 0030 #include <QList> 0031 #include <QMap> 0032 #include <QMouseEvent> 0033 #include <QPair> 0034 #include <QString> 0035 #include <QStringList> 0036 #include <QWheelEvent> 0037 #include <QRandomGenerator> 0038 0039 namespace DigikamGenericPresentationPlugin 0040 { 0041 0042 class PresentationContainer; 0043 0044 class PresentationGL : public QOpenGLWidget 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 0050 explicit PresentationGL(PresentationContainer* const sharedData); 0051 ~PresentationGL() override; 0052 0053 void registerEffects(); 0054 0055 static QStringList effectNames(); 0056 static QMap<QString, QString> effectNamesI18N(); 0057 0058 bool checkOpenGL() const; 0059 0060 protected: 0061 0062 void initializeGL() override; 0063 void paintGL() override; 0064 void resizeGL(int w, int h) override; 0065 0066 void mousePressEvent(QMouseEvent*) override; 0067 void mouseMoveEvent(QMouseEvent*) override; 0068 void wheelEvent(QWheelEvent*) override; 0069 void keyPressEvent(QKeyEvent*) override; 0070 0071 private: 0072 0073 typedef void (PresentationGL::*EffectMethod)(); 0074 0075 QPixmap generateOutlinedTextPixmap(const QString& text); 0076 QPixmap generateOutlinedTextPixmap(const QString& text, QFont& fn); 0077 QPixmap generateCustomOutlinedTextPixmap(const QString& text, 0078 QFont& fn, QColor& fgColor, QColor& bgColor, 0079 int opacity, bool transBg = true); 0080 0081 void paintTexture(); 0082 void advanceFrame(); 0083 void previousFrame(); 0084 void loadImage(); 0085 void montage(QImage& top, QImage& bot); 0086 EffectMethod getRandomEffect(); 0087 void showEndOfShow(); 0088 void showOverlays(); 0089 void hideOverlays(); 0090 void printFilename(QImage& layer); 0091 void printProgress(QImage& layer); 0092 void printComments(QImage& layer); 0093 0094 void effectNone(); 0095 void effectBlend(); 0096 void effectFade(); 0097 void effectRotate(); 0098 void effectBend(); 0099 void effectInOut(); 0100 void effectSlide(); 0101 void effectFlutter(); 0102 void effectCube(); 0103 0104 private Q_SLOTS: 0105 0106 void slotTimeOut(); 0107 void slotMouseMoveTimeOut(); 0108 0109 void slotPause(); 0110 void slotPlay(); 0111 void slotPrev(); 0112 void slotNext(); 0113 void slotClose(); 0114 0115 private: 0116 0117 // Disable 0118 explicit PresentationGL(QWidget*) = delete; 0119 0120 private: 0121 0122 class Private; 0123 Private* const d; 0124 }; 0125 0126 } // namespace DigikamGenericPresentationPlugin 0127 0128 #endif // DIGIKAM_PRESENTATION_GL_H