X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.cpp;h=9f61c36ebe1b5497afd7ff5524246b4f3830646f;hb=9e821958485d7f5845c3b24635df1f3243092e02;hp=6c1c790b41f30098b428b8e6be9af3aaa72b94a1;hpb=9e47a2f661b9d292598ef0277e507458e3dad62f;p=nageru diff --git a/mainwindow.cpp b/mainwindow.cpp index 6c1c790..9f61c36 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -129,7 +129,6 @@ void slave_fader(NonLinearFader *master, NonLinearFader *slave) }); } -constexpr unsigned DB_NO_FLAGS = 0x0; constexpr unsigned DB_WITH_SIGN = 0x1; constexpr unsigned DB_BARE = 0x2; @@ -322,8 +321,15 @@ void MainWindow::mixer_created(Mixer *mixer) connect(ui_display->display, &GLWidget::color_updated, this, &MainWindow::update_channel_color); // Hook up the keyboard key. - QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_1 + i), this); - connect(shortcut, &QShortcut::activated, bind(&MainWindow::channel_clicked, this, i)); + QShortcut *shortcut = nullptr; + if (i < 9) { + shortcut = new QShortcut(QKeySequence(Qt::Key_1 + i), this); + } else if (i == 9) { + shortcut = new QShortcut(QKeySequence(Qt::Key_0), this); + } + if (shortcut != nullptr) { + connect(shortcut, &QShortcut::activated, bind(&MainWindow::channel_clicked, this, i)); + } // Hook up the quick-cut key. if (i < strlen(qwerty)) { @@ -370,13 +376,13 @@ void MainWindow::mixer_created(Mixer *mixer) }); connect(ui->gainstaging_knob, &QAbstractSlider::valueChanged, bind(&MainWindow::gain_staging_knob_changed, this, simple_bus_index, _1)); - connect(ui->gainstaging_auto_checkbox, &QCheckBox::stateChanged, [this, simple_bus_index](int state){ + connect(ui->gainstaging_auto_checkbox, &QCheckBox::stateChanged, [this](int state){ global_audio_mixer->set_gain_staging_auto(simple_bus_index, state == Qt::Checked); midi_mapper.refresh_lights(); }); connect(ui->compressor_threshold_knob, &QDial::valueChanged, bind(&MainWindow::compressor_threshold_knob_changed, this, simple_bus_index, _1)); - connect(ui->compressor_enabled, &QCheckBox::stateChanged, [this, simple_bus_index](int state){ + connect(ui->compressor_enabled, &QCheckBox::stateChanged, [this](int state){ global_audio_mixer->set_compressor_enabled(simple_bus_index, state == Qt::Checked); midi_mapper.refresh_lights(); }); @@ -414,6 +420,9 @@ void MainWindow::mixer_created(Mixer *mixer) analyzer.reset(new Analyzer); + global_mixer->set_theme_menu_callback(bind(&MainWindow::setup_theme_menu, this)); + setup_theme_menu(); + struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_handler = schedule_cut_signal; @@ -808,6 +817,27 @@ void MainWindow::update_eq_label(unsigned bus_index, EQBand band, float gain_db) } } +void MainWindow::setup_theme_menu() +{ + std::vector theme_menu_entries = global_mixer->get_theme_menu(); + + if (theme_menu != nullptr) { + ui->menuBar->removeAction(theme_menu->menuAction()); + theme_menu = nullptr; + } + + if (!theme_menu_entries.empty()) { + theme_menu = new QMenu("&Theme"); + for (const Theme::MenuEntry &entry : theme_menu_entries) { + QAction *action = theme_menu->addAction(QString::fromStdString(entry.text)); + connect(action, &QAction::triggered, [entry] { + global_mixer->theme_menu_entry_clicked(entry.lua_ref); + }); + } + ui->menuBar->insertMenu(ui->menu_Help->menuAction(), theme_menu); + } +} + void MainWindow::limiter_threshold_knob_changed(int value) { float threshold_dbfs = value * 0.1f;