qRegisterMetaType<Mixer::Output>("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));
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);
+ ::abort();
}
midi_mapper.set_midi_mapping(midi_mapping);
}
}
}
+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);
}
}
+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]{