]> git.sesse.net Git - nageru/commitdiff
Allow previewing playlist clips.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 31 Oct 2018 22:02:21 +0000 (23:02 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 31 Oct 2018 22:02:21 +0000 (23:02 +0100)
mainwindow.cpp

index ee300c51e6efecc87f3227ec4d65737a5fd5624e..13a9bd5516204473c88661c2775164c6bf9351b6 100644 (file)
@@ -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;