X-Git-Url: https://git.sesse.net/?p=nageru;a=blobdiff_plain;f=futatabi%2Fmainwindow.cpp;h=77a3ba35e35bebfdf31c5df258052c75dcffb1e7;hp=1ed95c3dc5ab8ed27577510eda88577d6e5efdb5;hb=7ae1d56b56be5cc80333b2f7124ecfb6a86f16e9;hpb=4d334dafa066cf9af7899a555e1145d1e4dd0b3d diff --git a/futatabi/mainwindow.cpp b/futatabi/mainwindow.cpp index 1ed95c3..77a3ba3 100644 --- a/futatabi/mainwindow.cpp +++ b/futatabi/mainwindow.cpp @@ -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(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(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() @@ -514,6 +526,7 @@ void MainWindow::stop_clicked() fake_clip.pts_out = 0; playlist_clips->set_progress({}); live_player->play(fake_clip); + ui->stop_btn->setEnabled(false); } void MainWindow::live_player_done() @@ -523,21 +536,6 @@ void MainWindow::live_player_done() ui->stop_btn->setEnabled(false); } -static string format_duration(double t) -{ - int t_ms = lrint(t * 1e3); - - int ms = t_ms % 1000; - t_ms /= 1000; - int s = t_ms % 60; - t_ms /= 60; - int m = t_ms; - - char buf[256]; - snprintf(buf, sizeof(buf), "%d:%02d.%03d", m, s, ms); - return buf; -} - void MainWindow::live_player_clip_progress(const map &progress, double time_remaining) { playlist_clips->set_progress(progress); @@ -1035,6 +1033,9 @@ void MainWindow::highlight_camera_input(int stream_idx) void MainWindow::set_output_status(const string &status) { ui->live_label->setText(QString::fromStdString("Current output (" + status + ")")); + if (live_player != nullptr) { + live_player->set_pause_status(status); + } lock_guard lock(queue_status_mu); queue_status = status;