]> git.sesse.net Git - nageru/blobdiff - mainwindow.cpp
Make it possible to choose the DeckLink output video mode through the GUI.
[nageru] / mainwindow.cpp
index 0eda02d3a5c82bcdc8d8763971ccf225faa393aa..fc7b6eaa196fab68e4f226072620a70e2c85a688 100644 (file)
@@ -12,6 +12,7 @@
 #include <QApplication>
 #include <QBoxLayout>
 #include <QCheckBox>
+#include <QDesktopServices>
 #include <QDial>
 #include <QDialog>
 #include <QEvent>
@@ -196,6 +197,7 @@ 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);
@@ -251,7 +253,6 @@ MainWindow::MainWindow()
        }
        midi_mapper.refresh_highlights();
        midi_mapper.refresh_lights();
-       midi_mapper.start_thread();
 }
 
 void MainWindow::resizeEvent(QResizeEvent* event)
@@ -366,6 +367,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));
@@ -529,13 +531,6 @@ void MainWindow::setup_audio_expanded_view()
                                global_audio_mixer->reset_peak(bus_index);
                                midi_mapper.refresh_lights();
                        });
-
-               // Set up the compression attenuation meter.
-               VUMeter *reduction_meter = ui_audio_expanded_view->reduction_meter;
-               reduction_meter->set_min_level(0.0f);
-               reduction_meter->set_max_level(10.0f);
-               reduction_meter->set_ref_level(0.0f);
-               reduction_meter->set_flip(true);
        }
 
        update_cutoff_labels(global_audio_mixer->get_locut_cutoff());
@@ -570,6 +565,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();
@@ -817,7 +821,7 @@ void MainWindow::audio_level_callback(float level_lufs, float peak_db, vector<Au
                                        level.current_level_dbfs[0], level.current_level_dbfs[1]);
                                view->peak_meter->set_peak(
                                        level.peak_level_dbfs[0], level.peak_level_dbfs[1]);
-                               view->reduction_meter->set_level(level.compressor_attenuation_db);
+                               view->reduction_meter->set_reduction_db(level.compressor_attenuation_db);
                                view->gainstaging_knob->blockSignals(true);
                                view->gainstaging_knob->setValue(lrintf(level.gain_staging_db * 10.0f));
                                view->gainstaging_knob->blockSignals(false);
@@ -862,9 +866,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) {
@@ -884,7 +888,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));
@@ -898,7 +902,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));
        }
@@ -1297,6 +1301,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];