]> git.sesse.net Git - nageru/blobdiff - glwidget.cpp
Change from RGBA to BGRA; slightly more Intel GPU-friendly, and Caspar uses that...
[nageru] / glwidget.cpp
index 9aba1b3d61aa144d1f1d7c8ebc1cc832751c5b22..27f290db351b755d7e255c174f7ca468589ef624 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "audio_mixer.h"
 #include "context.h"
+#include "context_menus.h"
 #include "flags.h"
 #include "mainwindow.h"
 #include "mixer.h"
@@ -109,6 +110,8 @@ void GLWidget::paintGL()
        check_error();
        frame.setup_chain();
        check_error();
+       glDisable(GL_FRAMEBUFFER_SRGB);
+       check_error();
        frame.chain->render_to_screen();
        check_error();
 
@@ -132,43 +135,20 @@ void GLWidget::show_live_context_menu(const QPoint &pos)
 
        // Add a submenu for selecting output card, with an action for each card.
        QMenu card_submenu;
-       QActionGroup card_group(&card_submenu);
-
-       int current_card = global_mixer->get_output_card_index();
-
-       QAction *none_action = new QAction("None", &card_group);
-       none_action->setCheckable(true);
-       if (current_card == -1) {
-               none_action->setChecked(true);
-       }
-       none_action->setData(-1);
-       card_submenu.addAction(none_action);
-
-       unsigned num_cards = global_mixer->get_num_cards();
-       for (unsigned card_index = 0; card_index < num_cards; ++card_index) {
-               if (!global_mixer->card_can_be_used_as_output(card_index)) {
-                       continue;
-               }
-
-               QString description(QString::fromStdString(global_mixer->get_output_card_description(card_index)));
-               QAction *action = new QAction(description, &card_group);
-               action->setCheckable(true);
-               if (current_card == int(card_index)) {
-                       action->setChecked(true);
-               }
-               action->setData(card_index);
-               card_submenu.addAction(action);
-       }
-
-       card_submenu.setTitle("HDMI/SDI output");
+       fill_hdmi_sdi_output_device_menu(&card_submenu);
+       card_submenu.setTitle("HDMI/SDI output device");
        menu.addMenu(&card_submenu);
 
-       // Show the menu and look at the result.
-       QAction *selected_item = menu.exec(global_pos);
-       if (selected_item != nullptr) {
-               int output_card = selected_item->data().toInt(nullptr);
-               global_mixer->set_output_card(output_card);
-       }
+       // Add a submenu for choosing the output resolution. Since this is
+       // card-dependent, it is disabled if we haven't chosen a card
+       // (but it's still there so that the user will know it exists).
+       QMenu resolution_submenu;
+       fill_hdmi_sdi_output_resolution_menu(&resolution_submenu);
+       resolution_submenu.setTitle("HDMI/SDI output resolution");
+       menu.addMenu(&resolution_submenu);
+
+       // Show the menu; if there's an action selected, it will deal with it itself.
+       menu.exec(global_pos);
 }
 
 void GLWidget::show_preview_context_menu(unsigned signal_num, const QPoint &pos)
@@ -287,7 +267,10 @@ void GLWidget::show_preview_context_menu(unsigned signal_num, const QPoint &pos)
        // And a master clock selector.
        QAction *master_clock_action = new QAction("Use as master clock", &menu);
        master_clock_action->setCheckable(true);
-       if (global_mixer->get_master_clock() == signal_num) {
+       if (global_mixer->get_output_card_index() != -1) {
+               master_clock_action->setChecked(false);
+               master_clock_action->setEnabled(false);
+       } else if (global_mixer->get_master_clock() == signal_num) {
                master_clock_action->setChecked(true);
                master_clock_action->setEnabled(false);
        }