]> git.sesse.net Git - nageru/blobdiff - clip_list.h
Mark play progress with background color in the play list.
[nageru] / clip_list.h
index 64d06cd29f19633da0b82c1f9355442c49bcb44f..2d37eab4fda0959e23e004f78cdd4120523f6188 100644 (file)
@@ -68,10 +68,10 @@ public:
        size_t size() const { return clips.size(); }
        bool empty() const { return clips.empty(); }
 
-       ClipProxy clip(size_t index) { return ClipProxy(clips[index], this, index); }
+       ClipProxy mutable_clip(size_t index) { return ClipProxy(clips[index], this, index); }
        const Clip *clip(size_t index) const { return &clips[index]; }
 
-       ClipProxy back() { return clip(size() - 1); }
+       ClipProxy mutable_back() { return mutable_clip(size() - 1); }
        const Clip *back() const { return clip(size() - 1); }
 
        void emit_data_changed(size_t row) override;
@@ -104,16 +104,23 @@ public:
        bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
 
        void add_clip(const Clip &clip);
+
+       // <last> is inclusive in all of these.
+       void duplicate_clips(size_t first, size_t last);
+       void erase_clips(size_t first, size_t last);
+       // <delta> is -1 to move upwards, +1 to move downwards.
+       void move_clips(size_t first, size_t last, int delta);
+
        size_t size() const { return clips.size(); }
        bool empty() const { return clips.empty(); }
 
-       ClipProxy clip(size_t index) { return ClipProxy(clips[index], this, index); }
+       ClipProxy mutable_clip(size_t index) { return ClipProxy(clips[index], this, index); }
        const Clip *clip(size_t index) const { return &clips[index]; }
 
-       ClipProxy back() { return clip(size() - 1); }
+       ClipProxy mutable_back() { return mutable_clip(size() - 1); }
        const Clip *back() const { return clip(size() - 1); }
 
-       void set_currently_playing(int index);  // -1 = none.
+       void set_currently_playing(int index, double progress);  // -1 = none.
        int get_currently_playing() const { return currently_playing_index; }
 
        void emit_data_changed(size_t row) override;
@@ -121,6 +128,7 @@ public:
 private:
        std::vector<Clip> clips;
        int currently_playing_index = -1;
+       double play_progress = 0.0;
 };
 
 #endif  // !defined (_CLIP_LIST_H)