From: Steinar H. Gunderson Date: Wed, 16 Jan 2019 23:16:19 +0000 (+0100) Subject: Only enable play if something is actually selected. X-Git-Tag: 1.8.2~13 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=1572c05240f8bc82683a31b6c2df979101b12474;hp=b7a32af3a037f9fa70cf54f992314f68279c1204 Only enable play if something is actually selected. --- diff --git a/futatabi/mainwindow.cpp b/futatabi/mainwindow.cpp index 23a286b..3ecab3f 100644 --- a/futatabi/mainwindow.cpp +++ b/futatabi/mainwindow.cpp @@ -603,16 +603,11 @@ void MainWindow::lock_blink_timer_expired() void MainWindow::play_clicked() { - if (playlist_clips->empty()) - return; - QItemSelectionModel *selected = ui->playlist->selectionModel(); - unsigned start_row; if (!selected->hasSelection()) { - start_row = 0; - } else { - start_row = selected->selectedRows(0)[0].row(); + return; } + unsigned start_row = selected->selectedRows(0)[0].row(); vector clips; for (unsigned row = start_row; row < playlist_clips->size(); ++row) { @@ -895,8 +890,8 @@ void MainWindow::playlist_selection_changed() ui->playlist_move_down_btn->setEnabled( any_selected && selected->selectedRows().back().row() < int(playlist_clips->size()) - 1); - ui->play_btn->setEnabled(!playlist_clips->empty()); - midi_mapper.set_play_enabled(!playlist_clips->empty()); + ui->play_btn->setEnabled(any_selected); + midi_mapper.set_play_enabled(any_selected); if (!any_selected) { set_output_status("paused");