]> git.sesse.net Git - nageru/blobdiff - mainwindow.cpp
Fix so that you can't right-click on non-signal channels anymore.
[nageru] / mainwindow.cpp
index b7510debe560f0d7d3c4079e6d4063a1c8d40168..d46c87c38e7766b667230057482814f8879646ca 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()) {
@@ -282,6 +289,7 @@ void MainWindow::mixer_created(Mixer *mixer)
        // Make the previews.
        unsigned num_previews = mixer->get_num_channels();
 
+       const char qwerty[] = "QWERTYUIOP";
        for (unsigned i = 0; i < num_previews; ++i) {
                Mixer::Output output = Mixer::Output(Mixer::OUTPUT_INPUT0 + i);
 
@@ -304,6 +312,12 @@ void MainWindow::mixer_created(Mixer *mixer)
                QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_1 + i), this);
                connect(shortcut, &QShortcut::activated, bind(&MainWindow::channel_clicked, this, i));
 
+               // Hook up the quick-cut key.
+               if (i < strlen(qwerty)) {
+                       QShortcut *shortcut = new QShortcut(QKeySequence(qwerty[i]), this);
+                       connect(shortcut, &QShortcut::activated, bind(&MainWindow::quick_cut_activated, this, i));
+               }
+
                // Hook up the white balance button (irrelevant if invisible).
                ui_display->wb_button->setVisible(mixer->get_supports_set_wb(output));
                connect(ui_display->wb_button, &QPushButton::clicked, bind(&MainWindow::wb_button_clicked, this, i));
@@ -1281,6 +1295,15 @@ 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);
+}
+
 void MainWindow::wb_button_clicked(int channel_number)
 {
        current_wb_pick_display = channel_number;