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

Pierre Lamot pierre at videolabs.io
Tue Dec 19 11:56:57 CET 2017


  This option has been added in Interface rather than Video, because it is only
  valid when the video is embeded in the interface.

---
 modules/gui/qt/components/simple_preferences.cpp |  27 +++++
 modules/gui/qt/ui/sprefs_interface.ui            | 130 ++++++++++++-----------
 2 files changed, 97 insertions(+), 60 deletions(-)

diff --git a/modules/gui/qt/components/simple_preferences.cpp b/modules/gui/qt/components/simple_preferences.cpp
index 74b1903aeb..1994aaecc0 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>
@@ -749,8 +750,31 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             CONFIG_BOOL( "embedded-video", embedVideo );
             CONFIG_BOOL( "qt-video-autoresize", resizingBox );
             CONNECT( ui.embedVideo, toggled( bool ), ui.resizingBox, setEnabled( bool ) );
+            CONNECT( ui.embedVideo, toggled( bool ), ui.resizingBox, setEnabled( bool ) );
             ui.resizingBox->setEnabled( ui.embedVideo->isChecked() );

+            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);
+            }
+            CONNECT( ui.embedVideo, toggled( bool ), ui.fullscreenScreenBox, setEnabled( bool ) );
+            CONNECT( ui.embedVideo, toggled( bool ), ui.fullscreenScreenLabel, setEnabled( bool ) );
+            ui.fullscreenScreenBox->setEnabled( ui.embedVideo->isChecked() );
+            ui.fullscreenScreenLabel->setEnabled( ui.embedVideo->isChecked() );
+
             CONFIG_BOOL( "qt-fs-controller", fsController );
             CONFIG_BOOL( "qt-system-tray", systrayBox );
             CONFIG_GENERIC( "qt-notification", IntegerList, ui.notificationComboLabel,
@@ -1030,6 +1054,9 @@ void SPrefsPanel::apply()
         if( qobject_cast<QComboBox *>(optionWidgets["styleCB"]) )
             getSettings()->setValue( "MainWindow/QtStyle",
                 qobject_cast<QComboBox *>(optionWidgets["styleCB"])->currentText() );
+
+        int i_fullscreenScreen =  qobject_cast<QComboBox *>(optionWidgets["fullscreenScreenB"])->currentData().toInt();
+        config_PutInt( p_intf, "qt-fullscreen-screennumber", i_fullscreenScreen );
 #ifdef _WIN32
     saveLang();
 #endif
diff --git a/modules/gui/qt/ui/sprefs_interface.ui b/modules/gui/qt/ui/sprefs_interface.ui
index 2593eae93f..074066e50a 100644
--- a/modules/gui/qt/ui/sprefs_interface.ui
+++ b/modules/gui/qt/ui/sprefs_interface.ui
@@ -8,7 +8,7 @@
     <x>0</x>
     <y>0</y>
     <width>700</width>
-    <height>785</height>
+    <height>792</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -30,7 +30,7 @@
       <item>
        <widget class="QLabel" name="label">
         <property name="text">
-         <string>Menus language:</string>
+         <string>&Menus language:</string>
         </property>
         <property name="buddy">
          <cstring>langCombo</cstring>
@@ -55,7 +55,7 @@
       <item row="0" column="4">
        <widget class="QRadioButton" name="skins">
         <property name="text">
-         <string>Use custom skin</string>
+         <string>Use custom s&kin</string>
         </property>
        </widget>
       </item>
@@ -91,7 +91,7 @@
          <string>This is VLC's default interface, with a native look and feel.</string>
         </property>
         <property name="text">
-         <string>Use native style</string>
+         <string>Use nati&ve style</string>
         </property>
         <property name="checked">
          <bool>true</bool>
@@ -171,6 +171,35 @@
              <property name="bottomMargin">
               <number>0</number>
              </property>
+             <item row="1" column="4">
+              <spacer name="horizontalSpacer_7">
+               <property name="orientation">
+                <enum>Qt::Horizontal</enum>
+               </property>
+               <property name="sizeHint" stdset="0">
+                <size>
+                 <width>20</width>
+                 <height>20</height>
+                </size>
+               </property>
+              </spacer>
+             </item>
+             <item row="9" column="0">
+              <widget class="QLabel" name="stylesLabel">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="text">
+                <string>Force window style:</string>
+               </property>
+               <property name="buddy">
+                <cstring>stylesCombo</cstring>
+               </property>
+              </widget>
+             </item>
              <item row="1" column="2" colspan="2">
               <widget class="QCheckBox" name="resizingBox">
                <property name="text">
@@ -178,12 +207,6 @@
                </property>
               </widget>
              </item>
-             <item row="5" column="2" colspan="2">
-              <widget class="QComboBox" name="notificationCombo"/>
-             </item>
-             <item row="9" column="2" colspan="2">
-              <widget class="QComboBox" name="stylesCombo"/>
-             </item>
              <item row="0" column="0" colspan="5">
               <widget class="QCheckBox" name="fsController">
                <property name="text">
@@ -191,12 +214,8 @@
                </property>
               </widget>
              </item>
-             <item row="3" column="2" colspan="2">
-              <widget class="QCheckBox" name="pauseMinimizedBox">
-               <property name="text">
-                <string>Pause playback when minimized</string>
-               </property>
-              </widget>
+             <item row="11" column="2" colspan="2">
+              <widget class="QComboBox" name="autoRaiseComboBox"/>
              </item>
              <item row="5" column="0">
               <widget class="QLabel" name="notificationComboLabel">
@@ -208,6 +227,33 @@
                </property>
               </widget>
              </item>
+             <item row="11" column="0">
+              <widget class="QLabel" name="autoRaiseLabel">
+               <property name="text">
+                <string>Auto raising the interface:</string>
+               </property>
+              </widget>
+             </item>
+             <item row="9" column="2" colspan="2">
+              <widget class="QComboBox" name="stylesCombo"/>
+             </item>
+             <item row="1" column="0">
+              <widget class="QCheckBox" name="embedVideo">
+               <property name="text">
+                <string>Integrate video in interface</string>
+               </property>
+              </widget>
+             </item>
+             <item row="4" column="0" colspan="2">
+              <widget class="QCheckBox" name="systrayBox">
+               <property name="text">
+                <string>Show systray icon</string>
+               </property>
+              </widget>
+             </item>
+             <item row="5" column="2" colspan="2">
+              <widget class="QComboBox" name="notificationCombo"/>
+             </item>
              <item row="3" column="0">
               <widget class="QCheckBox" name="minimalviewBox">
                <property name="text">
@@ -215,26 +261,17 @@
                </property>
               </widget>
              </item>
-             <item row="9" column="0">
-              <widget class="QLabel" name="stylesLabel">
-               <property name="sizePolicy">
-                <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
-                 <horstretch>0</horstretch>
-                 <verstretch>0</verstretch>
-                </sizepolicy>
-               </property>
+             <item row="13" column="0">
+              <widget class="QLabel" name="fullscreenScreenLabel">
                <property name="text">
-                <string>Force window style:</string>
-               </property>
-               <property name="buddy">
-                <cstring>stylesCombo</cstring>
+                <string>Fullscreen display</string>
                </property>
               </widget>
              </item>
-             <item row="1" column="0">
-              <widget class="QCheckBox" name="embedVideo">
+             <item row="3" column="2" colspan="2">
+              <widget class="QCheckBox" name="pauseMinimizedBox">
                <property name="text">
-                <string>Integrate video in interface</string>
+                <string>Pause playback when minimized</string>
                </property>
               </widget>
              </item>
@@ -251,35 +288,8 @@
                </property>
               </spacer>
              </item>
-             <item row="1" column="4">
-              <spacer name="horizontalSpacer_7">
-               <property name="orientation">
-                <enum>Qt::Horizontal</enum>
-               </property>
-               <property name="sizeHint" stdset="0">
-                <size>
-                 <width>20</width>
-                 <height>20</height>
-                </size>
-               </property>
-              </spacer>
-             </item>
-             <item row="4" column="0" colspan="2">
-              <widget class="QCheckBox" name="systrayBox">
-               <property name="text">
-                <string>Show systray icon</string>
-               </property>
-              </widget>
-             </item>
-             <item row="11" column="0">
-              <widget class="QLabel" name="autoRaiseLabel">
-               <property name="text">
-                <string>Auto raising the interface:</string>
-               </property>
-              </widget>
-             </item>
-             <item row="11" column="2" colspan="2">
-              <widget class="QComboBox" name="autoRaiseComboBox"/>
+             <item row="13" column="2" colspan="2">
+              <widget class="QComboBox" name="fullscreenScreenBox"/>
              </item>
             </layout>
            </widget>
--
2.14.1


More information about the vlc-devel mailing list