connect(play, &QShortcut::activated, ui->play_btn, &QPushButton::click);
connect(ui->play_btn, &QPushButton::clicked, this, &MainWindow::play_clicked);
+ QShortcut *next = new QShortcut(QKeySequence(Qt::Key_N), this);
+ connect(next, &QShortcut::activated, ui->next_btn, &QPushButton::click);
+ connect(ui->next_btn, &QPushButton::clicked, this, &MainWindow::next_clicked);
+
connect(ui->stop_btn, &QPushButton::clicked, this, &MainWindow::stop_clicked);
ui->stop_btn->setEnabled(false);
playlist_selection_changed();
}
+void MainWindow::next_clicked()
+{
+ live_player->skip_to_next();
+}
+
void MainWindow::stop_clicked()
{
Clip fake_clip;
if (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut) {
enable_or_disable_preview_button();
+ playlist_selection_changed();
hidden_jog_column = -1;
}
enable_or_disable_preview_button();
QItemSelectionModel *selected = ui->playlist->selectionModel();
- bool any_selected = selected->hasSelection();
+ bool any_selected = ui->playlist->hasFocus() && selected->hasSelection();
ui->playlist_duplicate_btn->setEnabled(any_selected);
ui->playlist_remove_btn->setEnabled(any_selected);
ui->playlist_move_up_btn->setEnabled(
any_selected && selected->selectedRows().back().row() < int(playlist_clips->size()) - 1);
ui->play_btn->setEnabled(any_selected);
+ ui->next_btn->setEnabled(ui->stop_btn->isEnabled()); // TODO: Perhaps not if we're on the last clip?
+ midi_mapper.set_next_ready(ui->next_btn->isEnabled() ? MIDIMapper::On : MIDIMapper::Off);
+
+ // NOTE: The hidden button is still reachable by keyboard or MIDI.
+ if (any_selected) {
+ ui->play_btn->setVisible(true);
+ } else if (ui->stop_btn->isEnabled()) { // Playing.
+ ui->play_btn->setVisible(false);
+ } else {
+ ui->play_btn->setVisible(true);
+ }
+ ui->next_btn->setVisible(!ui->play_btn->isVisible());
+
if (ui->stop_btn->isEnabled()) { // Playing.
midi_mapper.set_play_enabled(MIDIMapper::On);
} else if (any_selected) {
});
}
+void MainWindow::next()
+{
+ post_to_main_thread([this] {
+ next_clicked();
+ });
+}
+
void MainWindow::toggle_lock()
{
post_to_main_thread([this] {