X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.cpp;h=136890d93826d4b71c276eb896755eb648d9b27c;hb=142184354968cd1b1918f35772bb6f9f0b1351d6;hp=36ea55ee3f8883fbe4e97fa484570bc26e70e8ee;hpb=0066ae51753e9ba7dbe54ab9c6f24fd861db41a2;p=nageru diff --git a/mainwindow.cpp b/mainwindow.cpp index 36ea55e..136890d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,7 @@ #include "aboutdialog.h" #include "alsa_pool.h" #include "clickable_label.h" +#include "context_menus.h" #include "correlation_meter.h" #include "disk_space_estimator.h" #include "ellipsis_label.h" @@ -196,18 +198,29 @@ MainWindow::MainWindow() // The menus. connect(ui->cut_action, &QAction::triggered, this, &MainWindow::cut_triggered); connect(ui->exit_action, &QAction::triggered, this, &MainWindow::exit_triggered); + connect(ui->manual_action, &QAction::triggered, this, &MainWindow::manual_triggered); connect(ui->about_action, &QAction::triggered, this, &MainWindow::about_triggered); connect(ui->simple_audio_mode, &QAction::triggered, this, &MainWindow::simple_audio_mode_triggered); connect(ui->multichannel_audio_mode, &QAction::triggered, this, &MainWindow::multichannel_audio_mode_triggered); connect(ui->input_mapping_action, &QAction::triggered, this, &MainWindow::input_mapping_triggered); connect(ui->midi_mapping_action, &QAction::triggered, this, &MainWindow::midi_mapping_triggered); + connect(ui->timecode_stream_action, &QAction::triggered, this, &MainWindow::timecode_stream_triggered); + connect(ui->timecode_stdout_action, &QAction::triggered, this, &MainWindow::timecode_stdout_triggered); - if (global_flags.x264_video_to_http) { + ui->timecode_stream_action->setChecked(global_flags.display_timecode_in_stream); + ui->timecode_stdout_action->setChecked(global_flags.display_timecode_on_stdout); + + if (global_flags.x264_video_to_http && isinf(global_flags.x264_crf)) { connect(ui->x264_bitrate_action, &QAction::triggered, this, &MainWindow::x264_bitrate_triggered); } else { ui->x264_bitrate_action->setEnabled(false); } + connect(ui->video_menu, &QMenu::aboutToShow, [this]{ + fill_hdmi_sdi_output_device_menu(ui->hdmi_sdi_output_device_menu); + fill_hdmi_sdi_output_resolution_menu(ui->hdmi_sdi_output_resolution_menu); + }); + // Hook up the transition buttons. (Keyboard shortcuts are set in set_transition_names().) // TODO: Make them dynamic. connect(ui->transition_btn1, &QPushButton::clicked, bind(&MainWindow::transition_clicked, this, 0)); @@ -251,7 +264,6 @@ MainWindow::MainWindow() } midi_mapper.refresh_highlights(); midi_mapper.refresh_lights(); - midi_mapper.start_thread(); } void MainWindow::resizeEvent(QResizeEvent* event) @@ -366,6 +378,7 @@ void MainWindow::mixer_created(Mixer *mixer) midi_mapper.refresh_highlights(); midi_mapper.refresh_lights(); + midi_mapper.start_thread(); struct sigaction act; memset(&act, 0, sizeof(act)); @@ -563,6 +576,15 @@ void MainWindow::exit_triggered() close(); } +void MainWindow::manual_triggered() +{ + if (!QDesktopServices::openUrl(QUrl("https://nageru.sesse.net/doc/"))) { + QMessageBox msgbox; + msgbox.setText("Could not launch manual in web browser.\nPlease see https://nageru.sesse.net/doc/ manually."); + msgbox.exec(); + } +} + void MainWindow::about_triggered() { AboutDialog().exec(); @@ -620,6 +642,16 @@ void MainWindow::midi_mapping_triggered() MIDIMappingDialog(&midi_mapper).exec(); } +void MainWindow::timecode_stream_triggered() +{ + global_mixer->set_display_timecode_in_stream(ui->timecode_stream_action->isChecked()); +} + +void MainWindow::timecode_stdout_triggered() +{ + global_mixer->set_display_timecode_on_stdout(ui->timecode_stdout_action->isChecked()); +} + void MainWindow::gain_staging_knob_changed(unsigned bus_index, int value) { if (bus_index == 0) { @@ -855,9 +887,9 @@ void MainWindow::relayout() double remaining_height = height; // Allocate the height; the most important part is to keep the main displays - // at 16:9 if at all possible. + // at the right aspect if at all possible. double me_width = ui->me_preview->width(); - double me_height = me_width * 9.0 / 16.0 + ui->label_preview->height() + ui->preview_vertical_layout->spacing(); + double me_height = me_width * double(global_flags.height) / double(global_flags.width) + ui->label_preview->height() + ui->preview_vertical_layout->spacing(); // TODO: Scale the widths when we need to do this. if (me_height / double(height) > 0.8) { @@ -877,7 +909,7 @@ void MainWindow::relayout() double preview_label_height = previews[0]->title_bar->geometry().height() + previews[0]->main_vertical_layout->spacing(); int preview_total_width = ui->preview_displays->geometry().width() - (previews.size() - 1) * ui->preview_displays->spacing(); - double preview_height = min(remaining_height - preview_label_height, (preview_total_width / double(previews.size())) * 9.0 / 16.0); + double preview_height = min(remaining_height - preview_label_height, (preview_total_width / double(previews.size())) * double(global_flags.height) / double(global_flags.width)); remaining_height -= preview_height + preview_label_height + ui->vertical_layout->spacing(); ui->vertical_layout->setStretch(0, lrintf(me_height)); @@ -891,7 +923,7 @@ void MainWindow::relayout() ui->compact_audio_layout->setStretch(2, lrintf(preview_height + preview_label_height)); // Set the widths for the previews. - double preview_width = preview_height * 16.0 / 9.0; + double preview_width = preview_height * double(global_flags.width) / double(global_flags.height); for (unsigned i = 0; i < previews.size(); ++i) { ui->preview_displays->setStretch(i, lrintf(preview_width)); } @@ -1290,6 +1322,9 @@ void MainWindow::set_white_balance(int channel_number, int x, int y) void MainWindow::audio_state_changed() { post_to_main_thread([this]{ + if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::SIMPLE) { + return; + } InputMapping mapping = global_audio_mixer->get_input_mapping(); for (unsigned bus_index = 0; bus_index < mapping.buses.size(); ++bus_index) { const InputMapping::Bus &bus = mapping.buses[bus_index];