]> git.sesse.net Git - nageru/blob - mainwindow.h
Add functionality for scrubbing in/out points in the clip list.
[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         int scrub_row;
36         ClipList::Column scrub_column;
37
38         void queue_clicked();
39         void preview_clicked();
40         void play_clicked();
41         void live_player_clip_done();
42
43         enum Rounding { FIRST_AT_OR_AFTER, LAST_BEFORE };
44         void preview_single_frame(int64_t pts, unsigned stream_idx, Rounding rounding);
45
46         void resizeEvent(QResizeEvent *event) override;
47         bool eventFilter(QObject *watched, QEvent *event) override;
48
49 private slots:
50         void relayout();
51 };
52
53 extern MainWindow *global_mainwindow;
54
55 #endif
56