]> git.sesse.net Git - nageru/blobdiff - mainwindow.cpp
Fix a crash if exiting while we are still trying to re-find an ALSA card from a loade...
[nageru] / mainwindow.cpp
index eb7fb54a769d9f30022ef581fe82efc77ffc3b85..d3d298100dd5c9f492dc4c4edacbab0d62581df5 100644 (file)
@@ -253,6 +253,13 @@ MainWindow::MainWindow()
        connect(new QShortcut(QKeySequence::MoveToNextPage, this), &QShortcut::activated, switch_page);
        connect(new QShortcut(QKeySequence::MoveToPreviousPage, this), &QShortcut::activated, switch_page);
 
+       if (global_flags.enable_quick_cut_keys) {
+               ui->quick_cut_enable_action->setChecked(true);
+       }
+       connect(ui->quick_cut_enable_action, &QAction::changed, [this](){
+               global_flags.enable_quick_cut_keys = ui->quick_cut_enable_action->isChecked();
+       });
+
        last_audio_level_callback = steady_clock::now() - seconds(1);
 
        if (!global_flags.midi_mapping_filename.empty()) {
@@ -1290,6 +1297,9 @@ void MainWindow::channel_clicked(int channel_number)
 
 void MainWindow::quick_cut_activated(int channel_number)
 {
+       if (!global_flags.enable_quick_cut_keys) {
+               return;
+       }
        global_mixer->channel_clicked(channel_number);
        global_mixer->transition_clicked(0);
 }
@@ -1320,6 +1330,16 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event)
 
 void MainWindow::closeEvent(QCloseEvent *event)
 {
+       if (global_mixer->get_num_connected_clients() > 0) {
+               QMessageBox::StandardButton reply =
+                       QMessageBox::question(this, "Nageru", "There are clients connected. Do you really want to quit?",
+                               QMessageBox::Yes | QMessageBox::No);
+               if (reply != QMessageBox::Yes) {
+                       event->ignore();
+                       return;
+               }
+       }
+
        analyzer->hide();
        event->accept();
 }