File indexing completed on 2025-03-09 03:52:09
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2003-02-16 0007 * Description : a presentation tool. 0008 * 0009 * SPDX-FileCopyrightText: 2006-2009 by Valerio Fuoglio <valerio dot fuoglio at gmail dot com> 0010 * SPDX-FileCopyrightText: 2009 by Andi Clemens <andi dot clemens at googlemail dot com> 0011 * SPDX-FileCopyrightText: 2003-2005 by Renchi Raju <renchi dot raju at gmail 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_WIDGET_H 0020 #define DIGIKAM_PRESENTATION_WIDGET_H 0021 0022 // Qt includes 0023 0024 #include <QList> 0025 #include <QMap> 0026 #include <QPair> 0027 #include <QPixmap> 0028 #include <QPolygon> 0029 #include <QString> 0030 #include <QStringList> 0031 #include <QWidget> 0032 #include <QRandomGenerator> 0033 0034 class QKeyEvent; 0035 class QMouseEvent; 0036 class QPaintEvent; 0037 class QWheelEvent; 0038 0039 namespace DigikamGenericPresentationPlugin 0040 { 0041 0042 class PresentationContainer; 0043 0044 class PresentationWidget : public QWidget 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 0050 typedef int (PresentationWidget::*EffectMethod)(bool); 0051 0052 public: 0053 0054 explicit PresentationWidget(PresentationContainer* const sharedData); 0055 ~PresentationWidget() override; 0056 0057 void registerEffects(); 0058 0059 static QStringList effectNames(); 0060 static QMap<QString, QString> effectNamesI18N(); 0061 0062 protected: 0063 0064 void mousePressEvent(QMouseEvent*) override; 0065 void mouseMoveEvent(QMouseEvent*) override; 0066 void wheelEvent(QWheelEvent*) override; 0067 void keyPressEvent(QKeyEvent*) override; 0068 0069 int effectNone(bool); 0070 int effectChessboard(bool doInit); 0071 int effectMeltdown(bool doInit); 0072 int effectSweep(bool doInit); 0073 int effectMosaic(bool doInit); 0074 int effectCubism(bool doInit); 0075 int effectRandom(bool doInit); 0076 int effectGrowing(bool doInit); 0077 int effectHorizLines(bool doInit); 0078 int effectVertLines(bool doInit); 0079 int effectMultiCircleOut(bool doInit); 0080 int effectSpiralIn(bool doInit); 0081 int effectCircleOut(bool doInit); 0082 int effectBlobs(bool doInit); 0083 0084 void paintEvent(QPaintEvent*) override; 0085 void startPainter(); 0086 0087 protected: 0088 0089 bool m_simplyShow; 0090 bool m_startPainter; 0091 bool m_firstPainter; 0092 int m_px; 0093 int m_py; 0094 int m_psx; 0095 int m_psy; 0096 bool m_endOfShow; 0097 QPixmap m_buffer; 0098 0099 private Q_SLOTS: 0100 0101 void slotTimeOut(); 0102 void slotMouseMoveTimeOut(); 0103 0104 void slotPause(); 0105 void slotPlay(); 0106 void slotPrev(); 0107 void slotNext(); 0108 void slotClose(); 0109 void slotRemoveImageFromList(); 0110 0111 void slotVideoLoaded(bool); 0112 void slotVideoFinished(); 0113 0114 private: 0115 0116 void loadNextImage(); 0117 void loadPrevImage(); 0118 void showCurrentImage(); 0119 void printFilename(); 0120 void printComments(); 0121 void printProgress(); 0122 void showEndOfShow(); 0123 void showOverlays(); 0124 void hideOverlays(); 0125 void readSettings(); 0126 0127 EffectMethod getRandomEffect(); 0128 0129 private: 0130 0131 // Disable 0132 explicit PresentationWidget(QWidget*) = delete; 0133 0134 private: 0135 0136 class Private; 0137 Private* const d; 0138 QRandomGenerator *randomGenerator; 0139 }; 0140 0141 } // namespace DigikamGenericPresentationPlugin 0142 0143 #endif // DIGIKAM_PRESENTATION_WIDGET_H