From 22b4e6bf1e9d397f4393175f83ab71b4c2b061e7 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 31 Oct 2018 23:02:21 +0100 Subject: [PATCH] Allow previewing playlist clips. --- mainwindow.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index ee300c5..13a9bd5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -199,6 +199,17 @@ void MainWindow::queue_clicked() void MainWindow::preview_clicked() { + if (ui->playlist->hasFocus()) { + // Allow the playlist as preview iff it has focus and something is selected. + QItemSelectionModel *selected = ui->playlist->selectionModel(); + if (selected->hasSelection()) { + QModelIndex index = selected->currentIndex(); + const Clip &clip = *playlist_clips->clip(index.row()); + preview_player->play_clip(clip, index.row(), clip.stream_idx); + return; + } + } + if (cliplist_clips->empty()) return; -- 2.39.2