[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: group simple prefs look-n-feel selection into sub-widget

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Thu Mar 10 09:05:42 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
483bbe56 by Lyndon Brown at 2022-03-10T08:41:26+00:00
qt: group simple prefs look-n-feel selection into sub-widget

Rather than have a grid covering the entire contents of the look-n-feel
groupbox, which creates unnecessary complexity, use a sub-widget to group
together and layout the radio controls and the line underneath, letting the
parent layout thus just be a simple vertical-box. Using a widget rather
than just a sub-layout is necessary if we are to be able to do things like
hide the new selection sub-widget when not applicable.

The difference is almost identical, the radio controls are just spaced a
few pixels further apart.

This puts us in a position to hide the selection control and preview image
if skinning is not available (the previous layout did not work for this).

- - - - -
2c2b1871 by Lyndon Brown at 2022-03-10T08:41:26+00:00
qt: hide skinning controls in simple prefs if skinning unavailable

I.e. if compiled without skins2, hide the skinning bits.

- - - - -


2 changed files:

- modules/gui/qt/dialogs/preferences/simple_preferences.cpp
- modules/gui/qt/dialogs/preferences/sprefs_interface.ui


Changes:

=====================================
modules/gui/qt/dialogs/preferences/simple_preferences.cpp
=====================================
@@ -776,17 +776,25 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
             ui.osGroupBox->hide();
 #endif
 
-            /* interface */
-            char *psz_intf = config_GetPsz( "intf" );
-            if( psz_intf )
+            if( !module_exists( "skins2" ) )
             {
-                if( strstr( psz_intf, "skin" ) )
-                    ui.skins->setChecked( true );
-            } else {
-                /* defaults to qt */
-                ui.qt->setChecked( true );
+                ui.LooknfeelSelection->hide();
+                ui.mainPreview->hide();
+            }
+            else
+            {
+                /* interface */
+                char *psz_intf = config_GetPsz( "intf" );
+                if( psz_intf )
+                {
+                    if( strstr( psz_intf, "skin" ) )
+                        ui.skins->setChecked( true );
+                } else {
+                    /* defaults to qt */
+                    ui.qt->setChecked( true );
+                }
+                free( psz_intf );
             }
-            free( psz_intf );
 
             optionWidgets["skinRB"] = ui.skins;
             optionWidgets["qtRB"] = ui.qt;


=====================================
modules/gui/qt/dialogs/preferences/sprefs_interface.ui
=====================================
@@ -48,77 +48,95 @@
      <property name="title">
       <string>Look and feel</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout">
+     <layout class="QVBoxLayout" name="LooknfeelLayout">
       <property name="bottomMargin">
        <number>0</number>
       </property>
-      <item row="0" column="4">
-       <widget class="QRadioButton" name="skins">
-        <property name="text">
-         <string>Use custom skin</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="6">
-       <spacer name="horizontalSpacer">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>40</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-      <item row="0" column="1">
-       <spacer name="horizontalSpacer_4">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>40</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-      <item row="0" column="2">
-       <widget class="QRadioButton" name="qt">
-        <property name="toolTip">
-         <string>This is VLC's default interface, with a native look and feel.</string>
-        </property>
-        <property name="text">
-         <string>Use native style</string>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="3">
-       <spacer name="horizontalSpacer_5">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>40</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-      <item row="1" column="2" colspan="3">
-       <widget class="Line" name="line">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
+      <item>
+       <widget class="QWidget" name="LooknfeelSelection" native="true">
+        <layout class="QGridLayout" name="LooknfeelSelection_l">
+         <property name="leftMargin">
+          <number>0</number>
+         </property>
+         <property name="topMargin">
+          <number>0</number>
+         </property>
+         <property name="rightMargin">
+          <number>0</number>
+         </property>
+         <property name="bottomMargin">
+          <number>0</number>
+         </property>
+         <item row="0" column="4">
+          <widget class="QRadioButton" name="skins">
+           <property name="text">
+            <string>Use custom skin</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="5">
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item row="0" column="1">
+          <spacer name="horizontalSpacer_4">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item row="0" column="2">
+          <widget class="QRadioButton" name="qt">
+           <property name="toolTip">
+            <string>This is VLC's default interface, with a native look and feel.</string>
+           </property>
+           <property name="text">
+            <string>Use native style</string>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="3">
+          <spacer name="horizontalSpacer_5">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item row="1" column="2" colspan="3">
+          <widget class="Line" name="line">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </widget>
       </item>
-      <item row="2" column="0" rowspan="6" colspan="7">
+      <item>
        <widget class="QStackedWidget" name="styleStackedWidget">
         <property name="currentIndex">
          <number>0</number>



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bccef1d574824910ab2e0f0d997e66320a3f63a5...2c2b187127f0a721c6c77e12ba1ccd58c0b0a659

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bccef1d574824910ab2e0f0d997e66320a3f63a5...2c2b187127f0a721c6c77e12ba1ccd58c0b0a659
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list