[vlc-devel] [PATCH v2 9/9] Qt: spref, add option to select the fullscreen screen

Pierre Lamot pierre at videolabs.io
Wed Dec 20 17:58:13 CET 2017


---
 modules/gui/qt/components/simple_preferences.cpp | 26 +++++++++++++++++
 modules/gui/qt/ui/sprefs_video.ui                | 36 ++++++++++++++++--------
 2 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/modules/gui/qt/components/simple_preferences.cpp b/modules/gui/qt/components/simple_preferences.cpp
index cc530e22cf..7121998135 100644
--- a/modules/gui/qt/components/simple_preferences.cpp
+++ b/modules/gui/qt/components/simple_preferences.cpp
@@ -42,6 +42,7 @@
 
 #include <QStyleFactory>
 #include <QSettings>
+#include <QScreen>
 #include <QtAlgorithms>
 #include <QDir>
 #include <assert.h>
@@ -361,6 +362,24 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             CONFIG_BOOL( "video-deco", windowDecorations );
             CONFIG_GENERIC( "vout", StringList, ui.voutLabel, outputModule );
 
+            optionWidgets["fullscreenScreenB"] = ui.fullscreenScreenBox;
+            ui.fullscreenScreenBox->addItem( qtr("Automatic"), -1 );
+            int i_screenCount = 0;
+            foreach( QScreen* screen, QGuiApplication::screens() )
+            {
+                ui.fullscreenScreenBox->addItem( screen->name(), i_screenCount );
+                i_screenCount++;
+            }
+            p_config =  config_FindConfig( "qt-fullscreen-screennumber" );
+            if( p_config )
+            {
+                int i_defaultScreen = p_config->value.i + 1;
+                if ( i_defaultScreen < 0 || i_defaultScreen > ( ui.fullscreenScreenBox->count() - 1 ) )
+                    ui.fullscreenScreenBox->setCurrentIndex( 0 );
+                else
+                    ui.fullscreenScreenBox->setCurrentIndex(p_config->value.i + 1);
+            }
+
 #ifdef _WIN32
             CONFIG_BOOL( "directx-overlay", overlay );
             CONFIG_BOOL( "directx-hw-yuv", hwYUVBox );
@@ -1037,6 +1056,13 @@ void SPrefsPanel::apply()
         break;
     }
 
+    case SPrefsVideo:
+    {
+        int i_fullscreenScreen =  qobject_cast<QComboBox *>(optionWidgets["fullscreenScreenB"])->currentData().toInt();
+        config_PutInt( p_intf, "qt-fullscreen-screennumber", i_fullscreenScreen );
+        break;
+    }
+
     case SPrefsAudio:
     {
         bool b_checked =
diff --git a/modules/gui/qt/ui/sprefs_video.ui b/modules/gui/qt/ui/sprefs_video.ui
index 766f747c2e..d4eb81d569 100644
--- a/modules/gui/qt/ui/sprefs_video.ui
+++ b/modules/gui/qt/ui/sprefs_video.ui
@@ -46,6 +46,23 @@
          <string>Display</string>
         </property>
         <layout class="QGridLayout" name="gridLayout">
+         <item row="3" column="0">
+          <widget class="QLabel" name="voutLabel">
+           <property name="text">
+            <string>O&utput</string>
+           </property>
+           <property name="buddy">
+            <cstring>outputModule</cstring>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="0">
+          <widget class="QCheckBox" name="windowDecorations">
+           <property name="text">
+            <string>Window decorations</string>
+           </property>
+          </widget>
+         </item>
          <item row="0" column="0">
           <widget class="QCheckBox" name="fullscreen">
            <property name="text">
@@ -60,20 +77,16 @@
            </property>
           </widget>
          </item>
-         <item row="3" column="0">
-          <widget class="QLabel" name="voutLabel">
+         <item row="4" column="1">
+          <widget class="QComboBox" name="fullscreenScreenBox"/>
+         </item>
+         <item row="4" column="0">
+          <widget class="QLabel" name="fullscreenScreenLabel">
            <property name="text">
-            <string>O&utput</string>
+            <string>Fullscreen Display</string>
            </property>
            <property name="buddy">
-            <cstring>outputModule</cstring>
-           </property>
-          </widget>
-         </item>
-         <item row="2" column="0">
-          <widget class="QCheckBox" name="windowDecorations">
-           <property name="text">
-            <string>Window decorations</string>
+            <cstring>fullscreenScreenBox</cstring>
            </property>
           </widget>
          </item>
@@ -305,6 +318,7 @@
   <tabstop>fullscreen</tabstop>
   <tabstop>windowDecorations</tabstop>
   <tabstop>outputModule</tabstop>
+  <tabstop>fullscreenScreenBox</tabstop>
   <tabstop>overlay</tabstop>
   <tabstop>hwYUVBox</tabstop>
   <tabstop>kvaFixT23</tabstop>
-- 
2.14.1



More information about the vlc-devel mailing list