digiKam
glviewerwidget.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 : 2007-02-11
7  * Description : a tool to show image using an OpenGL interface.
8  *
9  * Copyright (C) 2007-2008 by Markus Leuthold <kusi at forum dot titlis dot org>
10  * Copyright (C) 2008-2022 by Gilles Caulier <caulier dot gilles 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) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_GLVIEWER_PLUGIN_GLVIEWER_WIDGET_H
25 #define DIGIKAM_GLVIEWER_PLUGIN_GLVIEWER_WIDGET_H
26 
27 // Qt includes
28 
29 #include <QCursor>
30 #include <QDir>
31 #include <QKeyEvent>
32 #include <QMouseEvent>
33 #include <QTimer>
34 #include <QWheelEvent>
35 #include <QUrl>
36 
37 // Local includes
38 
39 #include "glviewertexture.h"
40 #include "glviewerglobal.h"
41 #include "dplugin.h"
42 #include "dinfointerface.h"
43 
44 using namespace Digikam;
45 
47 {
48 
49 class GLViewerWidget : public QOpenGLWidget
50 {
51  Q_OBJECT
52 
53 public:
54 
55  explicit GLViewerWidget(DPlugin* const plugin,
56  DInfoInterface* const iface);
57  ~GLViewerWidget() override;
58 
59  void prevImage();
60  void nextImage();
61  bool listOfFilesIsEmpty() const;
62 
63  OGLstate getOGLstate() const;
64 
65 private:
66 
67  void initializeGL() override;
68  void resizeGL(int w, int h) override;
69  void paintGL() override;
70 
71  bool isReallyFullScreen() const;
72 
73  void keyPressEvent(QKeyEvent* e) override;
74  void keyReleaseEvent(QKeyEvent* e) override;
75  void wheelEvent(QWheelEvent* e) override;
76  void mouseMoveEvent(QMouseEvent* e) override;
77  void mousePressEvent(QMouseEvent* e) override;
78  void mouseDoubleClickEvent(QMouseEvent* e) override;
79  void mouseReleaseEvent(QMouseEvent* e) override;
80 
81  GLViewerTexture* loadImage(int file_index) const;
82  void drawImage(GLViewerTexture* const tex);
83  void downloadTexture(GLViewerTexture* const tex);
84 
85  void zoom(int mdelta,
86  const QPoint& pos,
87  float factor);
88 
89 private Q_SLOTS:
90 
91  void slotTimeoutMouseMove();
92 
93 private:
94 
95  // Disable
96  explicit GLViewerWidget(QWidget*) = delete;
97 
98 private:
99 
100  class Private;
101  Private* const d;
102 };
103 
104 } // namespace DigikamGenericGLViewerPlugin
105 
106 #endif // DIGIKAM_GLVIEWER_PLUGIN_GLVIEWER_WIDGET_H
Definition: glviewertexture.h:44
Definition: glviewerwidget.h:50
Definition: dinfointerface.h:56
Definition: dplugin.h:61
Definition: glviewerglobal.h:35
OGLstate
Definition: glviewerglobal.h:38
Definition: datefolderview.cpp:43