Olive
viewerwidget.h
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef VIEWERWIDGET_H
22 #define VIEWERWIDGET_H
23 
24 #include <QOpenGLWidget>
25 #include <QMatrix4x4>
26 #include <QOpenGLTexture>
27 #include <QTimer>
28 #include <QThread>
29 #include <QMutex>
30 #include <QWaitCondition>
31 #include <QOpenGLFunctions>
32 
33 class Viewer;
34 class Clip;
35 struct FootageStream;
36 class QOpenGLFramebufferObject;
37 class Effect;
38 class EffectGizmo;
39 class ViewerContainer;
40 struct GLTextureCoords;
41 class RenderThread;
42 class ViewerWindow;
43 
44 class ViewerWidget : public QOpenGLWidget, QOpenGLFunctions
45 {
46  Q_OBJECT
47 public:
48  ViewerWidget(QWidget *parent = nullptr);
49  ~ViewerWidget();
50 
51  void delete_function();
52  void close_window();
53 
54  void paintGL();
55  void initializeGL();
56  Viewer* viewer;
57  ViewerContainer* container;
58 
59  bool waveform;
60  Clip* waveform_clip;
61  const FootageStream* waveform_ms;
62  double waveform_zoom;
63  int waveform_scroll;
64 
65  void frame_update();
66  RenderThread* get_renderer();
67  void set_scroll(double x, double y);
68 public slots:
69  void set_waveform_scroll(int s);
70  void set_fullscreen(int screen = 0);
71 protected:
72  void mousePressEvent(QMouseEvent *event);
73  void mouseMoveEvent(QMouseEvent *event);
74  void mouseReleaseEvent(QMouseEvent *event);
75  void wheelEvent(QWheelEvent* event);
76 private:
77  void draw_waveform_func();
78  void draw_title_safe_area();
79  void draw_gizmos();
80  EffectGizmo* get_gizmo_from_mouse(int x, int y);
81  void move_gizmos(QMouseEvent *event, bool done);
82  bool dragging;
83  void seek_from_click(int x);
84  Effect* gizmos;
85  int drag_start_x;
86  int drag_start_y;
87  int gizmo_x_mvmt;
88  int gizmo_y_mvmt;
89  EffectGizmo* selected_gizmo;
90  RenderThread* renderer;
91  ViewerWindow* window;
92  double x_scroll;
93  double y_scroll;
94 private slots:
95  void context_destroy();
96  void retry();
97  void show_context_menu();
98  void save_frame();
99  void queue_repaint();
100  void fullscreen_menu_action(QAction* action);
101  void set_fit_zoom();
102  void set_custom_zoom();
103  void set_menu_zoom(QAction *action);
104 };
105 
106 #endif // VIEWERWIDGET_H
Definition: viewercontainer.h:29
Definition: effect.h:125
Definition: viewerwindow.h:31
Definition: effect.h:166
Definition: effectgizmo.h:41
Definition: footage.h:45
Definition: viewerwidget.h:44
Definition: clip.h:53
Definition: viewer.h:45
Definition: renderthread.h:35