]> git.sesse.net Git - nageru/blobdiff - futatabi/mainwindow.h
Implement undo/redo.
[nageru] / futatabi / mainwindow.h
index 7f8c57ac805a79928573a01e76e17e5916ab8d39..36126744eba8b370e91cb70557a2448052c70bba 100644 (file)
@@ -5,6 +5,8 @@
 #include "db.h"
 #include "state.pb.h"
 
+#include <deque>
+#include <memory>
 #include <mutex>
 #include <QLabel>
 #include <QMainWindow>
@@ -24,6 +26,7 @@ class MainWindow : public QMainWindow {
 
 public:
        MainWindow();
+       ~MainWindow();
 
        // HTTP callback. TODO: Does perhaps not belong to MainWindow?
        std::pair<std::string, std::string> get_queue_status() const;
@@ -33,7 +36,7 @@ public:
 
 private:
        QLabel *disk_free_label;
-       Player *preview_player, *live_player;
+       std::unique_ptr<Player> preview_player, live_player;
        DB db;
 
        // State when doing a scrub operation on a timestamp with the mouse.
@@ -60,6 +63,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.
@@ -100,6 +106,12 @@ 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 highlight_camera_input(int stream_idx);