[vlc-commits] commit: Qt: Fix simple preferences according to new ui modes ( Francois Cartegnie )

git at videolan.org git at videolan.org
Fri Mar 12 22:20:18 CET 2010


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Mar 12 14:11:26 2010 +0100| [e17ee1aae6a85d6cc0b81f6161b9aac541336ce0] | committer: Jean-Baptiste Kempf 

Qt: Fix simple preferences according to new ui modes

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e17ee1aae6a85d6cc0b81f6161b9aac541336ce0
---

 modules/gui/qt4/components/preferences_widgets.cpp |   36 +++++++++++----
 modules/gui/qt4/components/preferences_widgets.hpp |   11 +++--
 modules/gui/qt4/components/simple_preferences.cpp  |   10 ++--
 modules/gui/qt4/ui/sprefs_interface.ui             |   47 +++++---------------
 4 files changed, 49 insertions(+), 55 deletions(-)

diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp
index 4f9f21f..90c8bc7 100644
--- a/modules/gui/qt4/components/preferences_widgets.cpp
+++ b/modules/gui/qt4/components/preferences_widgets.cpp
@@ -205,16 +205,34 @@ InterfacePreviewWidget::InterfacePreviewWidget ( QWidget *parent ) : QLabel( par
     setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
 }
 
-void InterfacePreviewWidget::setPreview( int comboid )
-{
-    /* Need to move resources references as soon as qt4.cpp
-       local defines has been moved somewhere else
-    */
-    static const char pixmaps[][28] = { ":/prefsmenu/sample_classic",
-                                        ":/prefsmenu/sample_complete",
-                                        ":/prefsmenu/sample_minimal",
-                                        ":/prefsmenu/sample_skins" };
-    setPixmap( QPixmap( pixmaps[ comboid ] ) );
+void InterfacePreviewWidget::setNormalPreview( bool b_minimal )
+{
+    setPreview( ( b_minimal )?MINIMAL:COMPLETE );
+}
+
+void InterfacePreviewWidget::setPreview( enum_style e_style )
+{
+    QString pixmapLocationString(":/prefsmenu/");
+
+    switch( e_style )
+    {
+    default:
+    case CLASSIC:
+        pixmapLocationString += "sample_classic";
+        break;
+    case COMPLETE:
+        pixmapLocationString += "sample_complete";
+        break;
+    case MINIMAL:
+        pixmapLocationString += "sample_minimal";
+        break;
+    case SKINS:
+        pixmapLocationString += "sample_skins";
+        break;
+    }
+
+    setPixmap( QPixmap( pixmapLocationString ) );
+    update();
 }
 
 
diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp
index 420f835..df6120b 100644
--- a/modules/gui/qt4/components/preferences_widgets.hpp
+++ b/modules/gui/qt4/components/preferences_widgets.hpp
@@ -63,12 +63,13 @@ class InterfacePreviewWidget : public QLabel
     Q_OBJECT
 public:
     InterfacePreviewWidget( QWidget * );
+    enum enum_style { CLASSIC,  // aka VLC 0.8.6
+                 COMPLETE, // aka MPC
+                 MINIMAL,  // aka WMP12 minimal
+                 SKINS };
 public slots:
-    /* 0: sample_classic, aka VLC 0.8.6
-       1: sample_complete, aka MPC
-       2: sample_minimal, aka WMP12 minimal
-       3: sample_skins */
-    void setPreview( int );
+    void setPreview( enum_style );
+    void setNormalPreview( bool b_minimal );
 };
 
 /*******************************************************
diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp
index 9ab4e5e..9520772 100644
--- a/modules/gui/qt4/components/simple_preferences.cpp
+++ b/modules/gui/qt4/components/simple_preferences.cpp
@@ -564,12 +564,12 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             ui.native_zone->setEnabled( ui.qt4->isChecked() );
             CONNECT( ui.qt4, toggled( bool ), ui.native_zone, setEnabled( bool ) );
 
-            CONNECT( ui.displayModeBox, currentIndexChanged( int ),
-                     ui.mainPreview, setPreview( int ) );
-            ui.skinsPreview->setPreview( 3 ); /* skins_preview resource index */
+            CONNECT( ui.minimalviewBox, toggled( bool ),
+                     ui.mainPreview, setNormalPreview( bool ) );
+            CONFIG_BOOL( "qt-minimal-view", minimalviewBox );
+            ui.mainPreview->setNormalPreview( ui.minimalviewBox->isChecked() );
+            ui.skinsPreview->setPreview( InterfacePreviewWidget::SKINS );
 
-            CONFIG_GENERIC( "qt-display-mode", IntegerList, ui.displayLabel,
-                            displayModeBox );
             CONFIG_BOOL( "embedded-video", embedVideo );
             CONFIG_BOOL( "qt-fs-controller", fsController );
             CONFIG_BOOL( "qt-system-tray", systrayBox );
diff --git a/modules/gui/qt4/ui/sprefs_interface.ui b/modules/gui/qt4/ui/sprefs_interface.ui
index 87bd924..0877d40 100644
--- a/modules/gui/qt4/ui/sprefs_interface.ui
+++ b/modules/gui/qt4/ui/sprefs_interface.ui
@@ -342,35 +342,6 @@
          <property name="margin">
           <number>0</number>
          </property>
-         <item row="0" column="1">
-          <widget class="QComboBox" name="displayModeBox">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-          </widget>
-         </item>
-         <item row="0" column="0">
-          <widget class="QLabel" name="displayLabel">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="layoutDirection">
-            <enum>Qt::LeftToRight</enum>
-           </property>
-           <property name="text">
-            <string>Display mode:</string>
-           </property>
-           <property name="alignment">
-            <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
-           </property>
-          </widget>
-         </item>
          <item row="4" column="0">
           <widget class="QCheckBox" name="resizingBox">
            <property name="text">
@@ -405,17 +376,24 @@
            </property>
           </widget>
          </item>
-         <item row="6" column="0">
+         <item row="5" column="1">
+          <widget class="QCheckBox" name="sysPop">
+           <property name="text">
+            <string> Systray popup when minimized</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
           <widget class="QCheckBox" name="fsController">
            <property name="text">
             <string>Show controls in full screen mode</string>
            </property>
           </widget>
          </item>
-         <item row="5" column="1">
-          <widget class="QCheckBox" name="sysPop">
+         <item row="0" column="0">
+          <widget class="QCheckBox" name="minimalviewBox">
            <property name="text">
-            <string> Systray popup when minimized</string>
+            <string>Minimal view mode (no toolbars)</string>
            </property>
           </widget>
          </item>
@@ -446,9 +424,6 @@
         <property name="alignment">
          <set>Qt::AlignHCenter|Qt::AlignTop</set>
         </property>
-        <property name="buddy">
-         <cstring>displayModeBox</cstring>
-        </property>
        </widget>
       </item>
       <item row="8" column="0" colspan="2">



More information about the vlc-commits mailing list