X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fmainwindow.cpp;h=96552a542d35d0dc0c65883903f270982b6b6ae9;hb=d5c507ae2f61367df3bd4b538d119b6aa3794af9;hp=d436040f0cede55578b095a7d3eeea1f8a780142;hpb=5982dac8e7df84c42f9a42c228e003c60f837f21;p=nageru diff --git a/nageru/mainwindow.cpp b/nageru/mainwindow.cpp index d436040..96552a5 100644 --- a/nageru/mainwindow.cpp +++ b/nageru/mainwindow.cpp @@ -253,30 +253,16 @@ MainWindow::MainWindow() qRegisterMetaType("Mixer::Output"); // Hook up the prev/next buttons on the audio views. - auto prev_page = [this]{ - if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL) { - ui->audio_views->setCurrentIndex((ui->audio_views->currentIndex() + 2) % 3); - } else { - ui->audio_views->setCurrentIndex(2 - ui->audio_views->currentIndex()); // Switch between 0 and 2. - } - }; - auto next_page = [this]{ - if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL) { - ui->audio_views->setCurrentIndex((ui->audio_views->currentIndex() + 1) % 3); - } else { - ui->audio_views->setCurrentIndex(2 - ui->audio_views->currentIndex()); // Switch between 0 and 2. - } - }; - connect(ui->compact_prev_page, &QAbstractButton::clicked, prev_page); - connect(ui->compact_next_page, &QAbstractButton::clicked, next_page); - connect(ui->full_prev_page, &QAbstractButton::clicked, prev_page); - connect(ui->full_next_page, &QAbstractButton::clicked, next_page); - connect(ui->video_grid_prev_page, &QAbstractButton::clicked, prev_page); - connect(ui->video_grid_next_page, &QAbstractButton::clicked, next_page); + connect(ui->compact_prev_page, &QAbstractButton::clicked, this, &MainWindow::prev_page); + connect(ui->compact_next_page, &QAbstractButton::clicked, this, &MainWindow::next_page); + connect(ui->full_prev_page, &QAbstractButton::clicked, this, &MainWindow::prev_page); + connect(ui->full_next_page, &QAbstractButton::clicked, this, &MainWindow::next_page); + connect(ui->video_grid_prev_page, &QAbstractButton::clicked, this, &MainWindow::prev_page); + connect(ui->video_grid_next_page, &QAbstractButton::clicked, this, &MainWindow::next_page); // And bind the same to PgUp/PgDown. - connect(new QShortcut(QKeySequence::MoveToNextPage, this), &QShortcut::activated, next_page); - connect(new QShortcut(QKeySequence::MoveToPreviousPage, this), &QShortcut::activated, prev_page); + connect(new QShortcut(QKeySequence::MoveToNextPage, this), &QShortcut::activated, this, &MainWindow::next_page); + connect(new QShortcut(QKeySequence::MoveToPreviousPage, this), &QShortcut::activated, this, &MainWindow::prev_page); // When the audio view changes, move the previews. connect(ui->audio_views, &QStackedWidget::currentChanged, bind(&MainWindow::audio_view_changed, this, _1)); @@ -295,7 +281,7 @@ MainWindow::MainWindow() if (!load_midi_mapping_from_file(global_flags.midi_mapping_filename, &midi_mapping)) { fprintf(stderr, "Couldn't load MIDI mapping '%s'; exiting.\n", global_flags.midi_mapping_filename.c_str()); - exit(1); + ::exit(1); } midi_mapper.set_midi_mapping(midi_mapping); } @@ -306,6 +292,24 @@ MainWindow::MainWindow() } } +void MainWindow::prev_page() +{ + if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL) { + ui->audio_views->setCurrentIndex((ui->audio_views->currentIndex() + 2) % 3); + } else { + ui->audio_views->setCurrentIndex(2 - ui->audio_views->currentIndex()); // Switch between 0 and 2. + } +} + +void MainWindow::next_page() +{ + if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL) { + ui->audio_views->setCurrentIndex((ui->audio_views->currentIndex() + 1) % 3); + } else { + ui->audio_views->setCurrentIndex(2 - ui->audio_views->currentIndex()); // Switch between 0 and 2. + } +} + void MainWindow::resizeEvent(QResizeEvent* event) { QMainWindow::resizeEvent(event); @@ -1244,6 +1248,42 @@ void MainWindow::toggle_auto_makeup_gain() } } +void MainWindow::switch_video_channel(int channel_number) +{ + global_mixer->channel_clicked(channel_number); +} + +void MainWindow::apply_transition(int transition_number) +{ + global_mixer->transition_clicked(transition_number); +} + +void MainWindow::prev_audio_view() +{ + post_to_main_thread([this]{ + prev_page(); + }); +} + +void MainWindow::next_audio_view() +{ + post_to_main_thread([this]{ + next_page(); + }); +} + +void MainWindow::begin_new_segment() +{ + global_mixer->schedule_cut(); +} + +void MainWindow::exit() +{ + post_to_main_thread([this]{ + close(); + }); +} + void MainWindow::highlight_locut(bool highlight) { post_to_main_thread([this, highlight]{