]> git.sesse.net Git - nageru/commitdiff
Fix some instances of unneeded dataChanged() signals, making it impossible to edit...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 26 Sep 2018 17:01:23 +0000 (19:01 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 26 Sep 2018 17:01:23 +0000 (19:01 +0200)
clip_list.h
mainwindow.cpp

index 126d1d5bc340e2fb1b04b85ee26361ab5f328acb..db3a479dd723a4c717493a22a898f6da1660272b 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;
@@ -114,10 +114,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 set_currently_playing(int index);  // -1 = none.
index 8377c74d4320d4ec27ace875334cba8710dcdac0..d6353844b95dd7589f3c1a0c53b08d99b9417d69 100644 (file)
@@ -118,7 +118,7 @@ MainWindow::MainWindow()
 void MainWindow::cue_in_clicked()
 {
        if (!cliplist_clips->empty() && cliplist_clips->back()->pts_out < 0) {
-               cliplist_clips->back()->pts_in = current_pts;
+               cliplist_clips->mutable_back()->pts_in = current_pts;
                return;
        }
        Clip clip;
@@ -130,7 +130,7 @@ void MainWindow::cue_in_clicked()
 void MainWindow::cue_out_clicked()
 {
        if (!cliplist_clips->empty()) {
-               cliplist_clips->back()->pts_out = current_pts;
+               cliplist_clips->mutable_back()->pts_out = current_pts;
                // TODO: select the row in the clip list?
        }
 }
@@ -388,7 +388,7 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event)
                        int64_t pts = scrub_pts_origin + adjusted_offset * scrub_sensitivity;
 
                        if (scrub_type == SCRUBBING_CLIP_LIST) {
-                               ClipProxy clip = cliplist_clips->clip(scrub_row);
+                               ClipProxy clip = cliplist_clips->mutable_clip(scrub_row);
                                if (scrub_column == int(ClipList::Column::IN)) {
                                        pts = std::max<int64_t>(pts, 0);
                                        pts = std::min(pts, clip->pts_out);
@@ -401,7 +401,7 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event)
                                        preview_single_frame(pts, stream_idx, LAST_BEFORE);
                                }
                        } else {
-                               ClipProxy clip = playlist_clips->clip(scrub_row);
+                               ClipProxy clip = playlist_clips->mutable_clip(scrub_row);
                                if (scrub_column == int(PlayList::Column::IN)) {
                                        pts = std::max<int64_t>(pts, 0);
                                        pts = std::min(pts, clip->pts_out);
@@ -442,7 +442,7 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event)
                if (column == -1 || row == -1) return false;
 
                ClipProxy clip = (watched == ui->clip_list->viewport()) ?
-                       cliplist_clips->clip(row) : playlist_clips->clip(row);
+                       cliplist_clips->mutable_clip(row) : playlist_clips->mutable_clip(row);
                if (watched == ui->playlist->viewport()) {
                        stream_idx = clip->stream_idx;
                }