1 #include <QActionGroup>
11 void fill_hdmi_sdi_output_device_menu(QMenu *menu)
14 QActionGroup *card_group = new QActionGroup(menu);
15 int current_card = global_mixer->get_output_card_index();
17 QAction *none_action = new QAction("None", card_group);
18 none_action->setCheckable(true);
19 if (current_card == -1) {
20 none_action->setChecked(true);
22 QObject::connect(none_action, &QAction::triggered, []{ global_mixer->set_output_card(-1); });
23 menu->addAction(none_action);
25 unsigned num_cards = global_mixer->get_num_cards();
26 for (unsigned card_index = 0; card_index < num_cards; ++card_index) {
27 if (!global_mixer->card_can_be_used_as_output(card_index)) {
31 QString description(QString::fromStdString(global_mixer->get_output_card_description(card_index)));
32 QAction *action = new QAction(description, card_group);
33 action->setCheckable(true);
34 if (current_card == int(card_index)) {
35 action->setChecked(true);
37 QObject::connect(action, &QAction::triggered, [card_index]{ global_mixer->set_output_card(card_index); });
38 menu->addAction(action);
42 void fill_hdmi_sdi_output_resolution_menu(QMenu *menu)
45 int current_card = global_mixer->get_output_card_index();
46 if (current_card == -1) {
47 menu->setEnabled(false);
51 menu->setEnabled(true);
52 QActionGroup *resolution_group = new QActionGroup(menu);
53 uint32_t current_mode = global_mixer->get_output_video_mode();
54 map<uint32_t, bmusb::VideoMode> video_modes = global_mixer->get_available_output_video_modes();
55 for (const auto &mode : video_modes) {
56 QString description(QString::fromStdString(mode.second.name));
57 QAction *action = new QAction(description, resolution_group);
58 action->setCheckable(true);
59 if (current_mode == mode.first) {
60 action->setChecked(true);
62 const uint32_t mode_id = mode.first;
63 QObject::connect(action, &QAction::triggered, [mode_id]{ global_mixer->set_output_video_mode(mode_id); });
64 menu->addAction(action);