]> git.sesse.net Git - nageru/commitdiff
Make cue in/out highlight the right cell. More logical, and also helps with jogging.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 8 Jan 2019 22:51:52 +0000 (23:51 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 8 Jan 2019 22:51:52 +0000 (23:51 +0100)
futatabi/mainwindow.cpp

index 154537c7c4c05791c8532d8f35eb29536d3a46a2..77a3ba35e35bebfdf31c5df258052c75dcffb1e7 100644 (file)
@@ -273,21 +273,33 @@ void MainWindow::cue_in_clicked()
 {
        if (!cliplist_clips->empty() && cliplist_clips->back()->pts_out < 0) {
                cliplist_clips->mutable_back()->pts_in = current_pts;
-               return;
+       } else {
+               Clip clip;
+               clip.pts_in = max<int64_t>(current_pts - lrint(global_flags.cue_point_padding_seconds * TIMEBASE), 0);
+               cliplist_clips->add_clip(clip);
+               playlist_selection_changed();
        }
-       Clip clip;
-       clip.pts_in = max<int64_t>(current_pts - lrint(global_flags.cue_point_padding_seconds * TIMEBASE), 0);
-       cliplist_clips->add_clip(clip);
-       playlist_selection_changed();
+
+       // Select the item so that we can jog it.
+       ui->clip_list->setFocus();
+       QModelIndex index = cliplist_clips->index(cliplist_clips->size() - 1, int(ClipList::Column::IN));
+       ui->clip_list->selectionModel()->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect);
        ui->clip_list->scrollToBottom();
 }
 
 void MainWindow::cue_out_clicked()
 {
-       if (!cliplist_clips->empty()) {
-               cliplist_clips->mutable_back()->pts_out = current_pts + lrint(global_flags.cue_point_padding_seconds * TIMEBASE);
-               // TODO: select the row in the clip list?
+       if (cliplist_clips->empty()) {
+               return;
        }
+
+       cliplist_clips->mutable_back()->pts_out = current_pts + lrint(global_flags.cue_point_padding_seconds * TIMEBASE);
+
+       // Select the item so that we can jog it.
+       ui->clip_list->setFocus();
+       QModelIndex index = cliplist_clips->index(cliplist_clips->size() - 1, int(ClipList::Column::OUT));
+       ui->clip_list->selectionModel()->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect);
+       ui->clip_list->scrollToBottom();
 }
 
 void MainWindow::queue_clicked()