]> git.sesse.net Git - nageru/blobdiff - clip_list.h
Remove some debugging code.
[nageru] / clip_list.h
index 2d37eab4fda0959e23e004f78cdd4120523f6188..c853263c13e28047048fcaa7c53aa59df6253d41 100644 (file)
@@ -9,11 +9,13 @@
 #include <string>
 
 #include "defs.h"
+#include "state.pb.h"
 
 struct Clip {
        int64_t pts_in = -1, pts_out = -1;  // pts_in is inclusive, pts_out is exclusive.
        std::string descriptions[NUM_CAMERAS];
        unsigned stream_idx = 0;  // For the playlist only.
+       double fade_time_seconds = 0.5;  // For the playlist only.
 };
 
 class DataChangedReceiver {
@@ -44,7 +46,7 @@ class ClipList : public QAbstractTableModel, public DataChangedReceiver {
        Q_OBJECT
 
 public:
-       ClipList() {}
+       explicit ClipList(const ClipListProto &serialized);
 
        enum class Column {
                IN,
@@ -74,8 +76,13 @@ public:
        ClipProxy mutable_back() { return mutable_clip(size() - 1); }
        const Clip *back() const { return clip(size() - 1); }
 
+       ClipListProto serialize() const;
+
        void emit_data_changed(size_t row) override;
 
+signals:
+       void any_content_changed();
+
 private:
        std::vector<Clip> clips;
 };
@@ -84,7 +91,7 @@ class PlayList : public QAbstractTableModel, public DataChangedReceiver {
        Q_OBJECT
 
 public:
-       PlayList() {}
+       explicit PlayList(const ClipListProto &serialized);
 
        enum class Column {
                PLAYING,
@@ -93,6 +100,7 @@ public:
                DURATION,
                CAMERA,
                DESCRIPTION,
+               FADE_TIME,
                NUM_COLUMNS
        };
 
@@ -120,11 +128,17 @@ public:
        ClipProxy mutable_back() { return mutable_clip(size() - 1); }
        const Clip *back() const { return clip(size() - 1); }
 
+       // TODO: Move these out of PlayList.
        void set_currently_playing(int index, double progress);  // -1 = none.
        int get_currently_playing() const { return currently_playing_index; }
 
+       ClipListProto serialize() const;
+
        void emit_data_changed(size_t row) override;
 
+signals:
+       void any_content_changed();
+
 private:
        std::vector<Clip> clips;
        int currently_playing_index = -1;