12 #include <QMainWindow>
14 #include <sys/types.h>
24 class MainWindow : public QMainWindow {
31 // HTTP callback. TODO: Does perhaps not belong to MainWindow?
32 std::pair<std::string, std::string> get_queue_status() const;
38 QLabel *disk_free_label;
39 std::unique_ptr<Player> preview_player, live_player;
42 // State when doing a scrub operation on a timestamp with the mouse.
43 bool scrubbing = false;
44 int scrub_x_origin; // In pixels on the viewport.
45 int64_t scrub_pts_origin;
47 // Which element (e.g. pts_in on clip 4) we are scrubbing.
48 enum ScrubType { SCRUBBING_CLIP_LIST, SCRUBBING_PLAYLIST } scrub_type;
52 // Used to keep track of small mouse wheel motions on the camera index in the playlist.
53 int last_mousewheel_camera_row = -1;
54 int leftover_angle_degrees = 0;
56 // Some operations, notably scrubbing and scrolling, happen in so large increments
57 // that we want to group them instead of saving to disk every single time.
58 // If they happen (ie., we get a callback from the model that it's changed) while
59 // currently_deferring_model_changes, we fire off this timer. If it manages to elapse
60 // before some other event happens, we count the event. (If the other event is of the
61 // same kind, we just fire off the timer anew instead of taking any action.)
62 QTimer *defer_timeout;
63 std::string deferred_change_id;
64 StateProto deferred_state;
66 // NOTE: The undo stack always has the current state on top.
67 std::deque<StateProto> undo_stack, redo_stack;
69 // Before a change that should be deferred (see above), currently_deferring_model_changes
70 // must be set to true, and current_change_id must be given contents describing what's
71 // changed to avoid accidental grouping.
72 bool currently_deferring_model_changes = false;
73 std::string current_change_id;
75 mutable std::mutex queue_status_mu;
76 std::string queue_status; // Under queue_status_mu.
78 void cue_in_clicked();
79 void cue_out_clicked();
81 void preview_clicked();
82 void preview_angle_clicked(unsigned stream_idx);
85 void live_player_clip_done();
86 std::pair<Clip, size_t> live_player_get_next_clip();
87 void live_player_clip_progress(const std::map<size_t, double> &progress);
88 void set_output_status(const std::string &status);
89 void playlist_duplicate();
90 void playlist_remove();
91 void playlist_move(int delta);
93 void defer_timer_expired();
94 void content_changed(); // In clip_list or play_list.
95 void state_changed(const StateProto &state); // Called post-filtering.
98 enum Rounding { FIRST_AT_OR_AFTER, LAST_BEFORE };
99 void preview_single_frame(int64_t pts, unsigned stream_idx, Rounding rounding);
101 // Also covers when the playlist itself changes.
102 void playlist_selection_changed();
104 void clip_list_selection_changed(const QModelIndex ¤t, const QModelIndex &previous);
106 void resizeEvent(QResizeEvent *event) override;
107 bool eventFilter(QObject *watched, QEvent *event) override;
109 void report_disk_space(off_t free_bytes, double estimated_seconds_left);
110 void exit_triggered();
111 void export_cliplist_clip_multitrack_triggered();
112 void export_playlist_clip_interpolated_triggered();
113 void manual_triggered();
114 void about_triggered();
115 void undo_triggered();
116 void redo_triggered();
117 void quality_toggled(int quality, bool checked);
119 void highlight_camera_input(int stream_idx);
125 extern MainWindow *global_mainwindow;