Olive
viewer.h
1 #ifndef VIEWER_H
2 #define VIEWER_H
3 
4 #include <QDockWidget>
5 #include <QTimer>
6 #include <QIcon>
7 
8 class Timeline;
9 class Media;
10 struct Sequence;
11 class TimelineHeader;
12 class ResizableScrollBar;
13 class ViewerContainer;
14 class LabelSlider;
15 class QPushButton;
16 class QLabel;
17 
18 #include "project/marker.h"
19 #include "ui/viewerwidget.h"
20 
21 bool frame_rate_is_droppable(float rate);
22 long timecode_to_frame(const QString& s, int view, double frame_rate);
23 QString frame_to_timecode(long f, int view, double frame_rate);
24 
25 class Viewer : public QDockWidget
26 {
27  Q_OBJECT
28 
29 public:
30  explicit Viewer(QWidget *parent = nullptr);
31  ~Viewer();
32 
33  bool is_focused();
34  bool is_main_sequence();
35  void set_main_sequence();
36  void set_media(Media *m);
37  void compose();
38  void set_playpause_icon(bool play);
39  void update_playhead_timecode(long p);
40  void update_end_timecode();
41  void update_header_zoom();
42  void clear_in();
43  void clear_out();
44  void clear_inout_point();
45  void set_in_point();
46  void set_out_point();
47  void set_zoom(bool in);
48  void set_panel_name(const QString& n);
49 
50  // playback functions
51  void seek(long p);
52  void play(bool in_to_out = false);
53  void pause();
54  bool playing;
55  long playhead_start;
56  qint64 start_msecs;
57  QTimer playback_updater;
58  bool just_played;
59 
60  void cue_recording(long start, long end, int track);
61  void uncue_recording();
62  bool is_recording_cued();
63  long recording_start;
64  long recording_end;
65  int recording_track;
66 
67  void reset_all_audio();
68  void update_parents(bool reload_fx = false);
69 
70  int get_playback_speed();
71 
72  ViewerWidget* viewer_widget;
73 
74  Media* media;
75  Sequence* seq;
76  QVector<Marker>* marker_ref;
77 
78  void set_marker();
79 
80  TimelineHeader* headers;
81 
82  void resizeEvent(QResizeEvent *event);
83 
84 public slots:
85  void play_wake();
86  void go_to_start();
87  void go_to_in();
88  void previous_frame();
89  void toggle_play();
90  void increase_speed();
91  void decrease_speed();
92  void next_frame();
93  void go_to_out();
94  void go_to_end();
95  void close_media();
96  void update_viewer();
97 
98 private slots:
99  void update_playhead();
100  void timer_update();
101  void recording_flasher_update();
102  void resize_move(double d);
103 
104 private:
105  void update_window_title();
106  void clean_created_seq();
107  void set_sequence(bool main, Sequence* s);
108  bool main_sequence;
109  bool created_sequence;
110  long cached_end_frame;
111  QString panel_name;
112  double minimum_zoom;
113  bool playing_in_to_out;
114  long last_playhead;
115  void set_zoom_value(double d);
116  void set_sb_max();
117  void set_playback_speed(int s);
118 
119  long get_seq_in();
120  long get_seq_out();
121 
122  QIcon playIcon;
123 
124  void setup_ui();
125 
126  ResizableScrollBar* horizontal_bar;
127  ViewerContainer* viewer_container;
128  LabelSlider* current_timecode_slider;
129  QLabel* end_timecode;
130 
131  QPushButton* go_to_start_button;
132  QPushButton* prev_frame_button;
133  QPushButton* play_button;
134  QPushButton* next_frame_button;
135  QPushButton* go_to_end_frame;
136 
137  bool cue_recording_internal;
138  QTimer recording_flasher;
139 
140  long previous_playhead;
141  int playback_speed;
142 };
143 
144 #endif // VIEWER_H
Definition: sequence.h:13
Definition: viewercontainer.h:9
Definition: timeline.h:71
Definition: timelineheader.h:11
Definition: media.h:20
Definition: viewerwidget.h:24
The LabelSlider class.
Definition: labelslider.h:20
Definition: resizablescrollbar.h:6
Definition: viewer.h:25