]> git.sesse.net Git - nageru/blobdiff - futatabi/mainwindow.h
Only enable the preview button if we can actually preview something.
[nageru] / futatabi / mainwindow.h
index 7f8c57ac805a79928573a01e76e17e5916ab8d39..d7e037c37ee7205a6c177d22509ce25f85fa990b 100644 (file)
@@ -5,36 +5,46 @@
 #include "db.h"
 #include "state.pb.h"
 
-#include <mutex>
 #include <QLabel>
 #include <QMainWindow>
+#include <QNetworkAccessManager>
+#include <deque>
+#include <memory>
+#include <mutex>
 #include <stdbool.h>
-#include <sys/types.h>
 #include <string>
+#include <sys/types.h>
 #include <utility>
 
 namespace Ui {
 class MainWindow;
 }  // namespace Ui
 
+struct FrameOnDisk;
+class JPEGFrameView;
 class Player;
+class QPushButton;
+class QTableView;
 
 class MainWindow : public QMainWindow {
        Q_OBJECT
 
 public:
        MainWindow();
+       ~MainWindow();
 
        // HTTP callback. TODO: Does perhaps not belong to MainWindow?
        std::pair<std::string, std::string> get_queue_status() const;
 
-//private:
-       Ui::MainWindow *ui;
+       void display_frame(unsigned stream_idx, const FrameOnDisk &frame);
 
 private:
+       Ui::MainWindow *ui;
+
        QLabel *disk_free_label;
-       Player *preview_player, *live_player;
+       std::unique_ptr<Player> preview_player, live_player;
        DB db;
+       unsigned num_cameras;
 
        // State when doing a scrub operation on a timestamp with the mouse.
        bool scrubbing = false;
@@ -42,7 +52,8 @@ private:
        int64_t scrub_pts_origin;
 
        // Which element (e.g. pts_in on clip 4) we are scrubbing.
-       enum ScrubType { SCRUBBING_CLIP_LIST, SCRUBBING_PLAYLIST } scrub_type;
+       enum ScrubType { SCRUBBING_CLIP_LIST,
+                        SCRUBBING_PLAYLIST } scrub_type;
        int scrub_row;
        int scrub_column;
 
@@ -60,6 +71,9 @@ private:
        std::string deferred_change_id;
        StateProto deferred_state;
 
+       // NOTE: The undo stack always has the current state on top.
+       std::deque<StateProto> undo_stack, redo_stack;
+
        // Before a change that should be deferred (see above), currently_deferring_model_changes
        // must be set to true, and current_change_id must be given contents describing what's
        // changed to avoid accidental grouping.
@@ -69,15 +83,27 @@ private:
        mutable std::mutex queue_status_mu;
        std::string queue_status;  // Under queue_status_mu.
 
+       struct FrameAndDisplay {
+               QFrame *frame;
+               JPEGFrameView *display;
+               QPushButton *preview_btn;
+       };
+       std::vector<FrameAndDisplay> displays;
+
+       // Used to get tally information, if a tally URL is set.
+       QNetworkAccessManager http;
+       QNetworkReply *http_reply = nullptr;
+
+       void change_num_cameras();
        void cue_in_clicked();
        void cue_out_clicked();
        void queue_clicked();
        void preview_clicked();
        void preview_angle_clicked(unsigned stream_idx);
        void play_clicked();
-       void live_player_clip_done();
-       std::pair<Clip, size_t> live_player_get_next_clip();
-       void live_player_clip_progress(const std::map<size_t, double> &progress);
+       void stop_clicked();
+       void live_player_done();
+       void live_player_clip_progress(const std::map<uint64_t, double> &progress, double time_remaining);
        void set_output_status(const std::string &status);
        void playlist_duplicate();
        void playlist_remove();
@@ -86,8 +112,10 @@ private:
        void defer_timer_expired();
        void content_changed();  // In clip_list or play_list.
        void state_changed(const StateProto &state);  // Called post-filtering.
+       void save_settings();
 
-       enum Rounding { FIRST_AT_OR_AFTER, LAST_BEFORE };
+       enum Rounding { FIRST_AT_OR_AFTER,
+                       LAST_BEFORE };
        void preview_single_frame(int64_t pts, unsigned stream_idx, Rounding rounding);
 
        // Also covers when the playlist itself changes.
@@ -100,8 +128,23 @@ private:
 
        void report_disk_space(off_t free_bytes, double estimated_seconds_left);
        void exit_triggered();
+       void export_cliplist_clip_multitrack_triggered();
+       void export_playlist_clip_interpolated_triggered();
+       void manual_triggered();
+       void about_triggered();
+       void undo_triggered();
+       void redo_triggered();
+       void quality_toggled(int quality, bool checked);
+       void padding_toggled(double seconds, bool checked);
 
        void highlight_camera_input(int stream_idx);
+       void enable_or_disable_preview_button();
+
+       template<class Model>
+       void replace_model(QTableView *view, Model **model, Model *new_model);
+
+       void start_tally();
+       void tally_received();
 
 private slots:
        void relayout();