]> git.sesse.net Git - nageru/blob - mainwindow.h
Implement scrubbing for the playlist.
[nageru] / mainwindow.h
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3
4 #include <stdbool.h>
5 #include <sys/types.h>
6 #include <QMainWindow>
7
8 #include "clip_list.h"
9
10 namespace Ui {
11 class MainWindow;
12 }  // namespace Ui
13
14 class Player;
15
16 class MainWindow : public QMainWindow
17 {
18         Q_OBJECT
19
20 public:
21         MainWindow();
22
23 //private:
24         Ui::MainWindow *ui;
25
26 private:
27         Player *preview_player, *live_player;
28
29         // State when doing a scrub operation on a timestamp with the mouse.
30         bool scrubbing = false;
31         int scrub_x_origin;  // In pixels on the viewport.
32         int64_t scrub_pts_origin;
33
34         // Which element (e.g. pts_in on clip 4) we are scrubbing.
35         enum ScrubType { SCRUBBING_CLIP_LIST, SCRUBBING_PLAYLIST } scrub_type;
36         int scrub_row;
37         int scrub_column;
38
39         void queue_clicked();
40         void preview_clicked();
41         void play_clicked();
42         void live_player_clip_done();
43
44         enum Rounding { FIRST_AT_OR_AFTER, LAST_BEFORE };
45         void preview_single_frame(int64_t pts, unsigned stream_idx, Rounding rounding);
46
47         void resizeEvent(QResizeEvent *event) override;
48         bool eventFilter(QObject *watched, QEvent *event) override;
49
50 private slots:
51         void relayout();
52 };
53
54 extern MainWindow *global_mainwindow;
55
56 #endif
57