X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.cpp;h=d3d298100dd5c9f492dc4c4edacbab0d62581df5;hb=f185dd186b7a9747331192ac55cb1f81e282cb0f;hp=b7510debe560f0d7d3c4079e6d4063a1c8d40168;hpb=fbd6331cd86ae938b50bd968af6690037e251c04;p=nageru diff --git a/mainwindow.cpp b/mainwindow.cpp index b7510de..d3d2981 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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; @@ -1307,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(); }