UI: simple prefs menu UI fixes and enhancement
authorFrancois Cartegnie <fcvlcdev@free.fr>
Sun, 7 Jun 2009 12:46:15 +0000 (14:46 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 8 Jun 2009 15:15:06 +0000 (17:15 +0200)
UI: new resources for prefs menu

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/components/preferences_widgets.hpp
modules/gui/qt4/components/simple_preferences.cpp
modules/gui/qt4/pixmaps/sample_classic.png [new file with mode: 0644]
modules/gui/qt4/pixmaps/sample_complete.png [new file with mode: 0644]
modules/gui/qt4/pixmaps/sample_minimal.png [new file with mode: 0644]
modules/gui/qt4/qt4.cpp
modules/gui/qt4/ui/sprefs_interface.ui
modules/gui/qt4/vlc.qrc

index 0536932..2b2163d 100644 (file)
@@ -199,6 +199,29 @@ void ConfigControl::doApply( intf_thread_t *p_intf )
     }
 }
 
+/*******************************************************
+ * Simple widgets
+ *******************************************************/
+InterfacePreviewWidget::InterfacePreviewWidget
+        ( QWidget *parent ) : QLabel( parent, 0 )
+{
+    setGeometry( 0, 0, 128, 100 );
+    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
+    */
+    char * pixmaps[] = { ":/prefsmenu/sample_classic",
+                         ":/prefsmenu/sample_complete",
+                         ":/prefsmenu/sample_minimal" };
+    setPixmap( QPixmap( pixmaps[ comboid ] ) );
+}
+
+
+
 /**************************************************************************
  * String-based controls
  *************************************************************************/
index 3a0f5e1..b42bc0a 100644 (file)
@@ -53,6 +53,23 @@ class QGridLayout;
 class QDialogButtonBox;
 class QVBoxLayout;
 
+/*******************************************************
+ * Simple widgets
+ *******************************************************/
+
+class InterfacePreviewWidget : public QLabel
+{
+    Q_OBJECT
+public:
+    InterfacePreviewWidget( QWidget * );
+public slots:
+    void setPreview( int );
+};
+
+/*******************************************************
+ * Variable controls
+ *******************************************************/
+
 class ConfigControl : public QObject
 {
     Q_OBJECT
index 4a3b369..7da97f6 100644 (file)
@@ -473,10 +473,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             CONFIG_GENERIC( "language", StringList, ui.languageLabel, language );
             BUTTONACT( ui.assoButton, assoDialog() );
 #else
-            ui.language->hide();
-            ui.languageLabel->hide();
-            ui.assoName->hide();
-            ui.assoButton->hide();
+            ui.languageBox->hide();
+            ui.assoBox->hide();
 #endif
 
             /* interface */
@@ -485,14 +483,27 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             {
                 if( strstr( psz_intf, "skin" ) )
                     ui.skins->setChecked( true );
-                else if( strstr( psz_intf, "qt" ) )
-                    ui.qt4->setChecked( true );
+            } else {
+                /* defaults to qt */
+                ui.qt4->setChecked( true );
             }
             free( psz_intf );
 
             optionWidgets.append( ui.skins );
             optionWidgets.append( ui.qt4 );
 
+            ui.skins_zone->setEnabled( ui.skins->isChecked() );
+            CONNECT( ui.skins, toggled( bool ), ui.skins_zone, setEnabled( bool ) );
+
+            ui.native_zone->setEnabled( ui.qt4->isChecked() );
+            CONNECT( ui.qt4, toggled( bool ), ui.native_zone, setEnabled( bool ) );
+
+            InterfacePreviewWidget *preview = new InterfacePreviewWidget( this );
+            ( (QGridLayout *) ui.LooknfeelBox->layout() )->
+                    addWidget( preview, 1, 0, 1, 2 );
+            CONNECT( ui.displayModeBox, currentIndexChanged( int ),
+                     preview, setPreview( int ) );
+            
             CONFIG_GENERIC( "qt-display-mode", IntegerList, ui.displayLabel,
                             displayModeBox );
             CONFIG_GENERIC( "embedded-video", Bool, NULL, embedVideo );
@@ -510,17 +521,21 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             CONFIG_GENERIC( "qt-updates-notif", Bool, NULL, updatesBox );
             CONFIG_GENERIC_NO_BOOL( "qt-updates-days", Integer, NULL,
                     updatesDays );
+            ui.updatenotifier_zone->setEnabled( ui.updatesBox->isChecked() );
             CONNECT( ui.updatesBox, toggled( bool ),
-                     ui.updatesDays, setEnabled( bool ) );
+                     ui.updatenotifier_zone, setEnabled( bool ) );
 #else
             ui.updatesBox->hide();
-            ui.updatesDays->hide();
+            ui.updatenotifier_zone->hide();
 #endif
             /* ONE INSTANCE options */
 #if defined( WIN32 ) || defined( HAVE_DBUS ) || defined(__APPLE__)
             CONFIG_GENERIC( "one-instance", Bool, NULL, OneInterfaceMode );
             CONFIG_GENERIC( "playlist-enqueue", Bool, NULL,
                     EnqueueOneInterfaceMode );
+            ui.EnqueueOneInterfaceMode->setEnabled( ui.OneInterfaceMode->isChecked() );
+            CONNECT( ui.OneInterfaceMode, toggled( bool ),
+                     ui.EnqueueOneInterfaceMode, setEnabled( bool ) );
 #else
             ui.OneInterfaceBox->hide();
 #endif
@@ -613,6 +628,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 #undef CONFIG_GENERIC
 }
 
+
 void SPrefsPanel::updateAudioOptions( int number)
 {
     QString value = qobject_cast<QComboBox *>(optionWidgets[audioOutCoB])
diff --git a/modules/gui/qt4/pixmaps/sample_classic.png b/modules/gui/qt4/pixmaps/sample_classic.png
new file mode 100644 (file)
index 0000000..e5dab5c
Binary files /dev/null and b/modules/gui/qt4/pixmaps/sample_classic.png differ
diff --git a/modules/gui/qt4/pixmaps/sample_complete.png b/modules/gui/qt4/pixmaps/sample_complete.png
new file mode 100644 (file)
index 0000000..285e7f8
Binary files /dev/null and b/modules/gui/qt4/pixmaps/sample_complete.png differ
diff --git a/modules/gui/qt4/pixmaps/sample_minimal.png b/modules/gui/qt4/pixmaps/sample_minimal.png
new file mode 100644 (file)
index 0000000..ffbe44c
Binary files /dev/null and b/modules/gui/qt4/pixmaps/sample_minimal.png differ
index e350775..bfc0f88 100644 (file)
@@ -149,9 +149,9 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
                                   "as lyrics, album arts...\n" \
                              " - minimal mode with limited controls" )
 
-#define QT_NORMAL_MODE_TEXT N_( "Classic look" )
-#define QT_ALWAYS_VIDEO_MODE_TEXT N_( "Complete look with information area" )
-#define QT_MINIMAL_MODE_TEXT N_( "Minimal look with no menus" )
+#define QT_NORMAL_MODE_TEXT N_( "Classic" )
+#define QT_ALWAYS_VIDEO_MODE_TEXT N_( "Complete (with information area)" )
+#define QT_MINIMAL_MODE_TEXT N_( "Minimal (without menu)" )
 
 #define QT_FULLSCREEN_TEXT N_( "Show a controller in fullscreen mode" )
 #define QT_NATIVEOPEN_TEXT N_( "Embed the file browser in open dialog" )
index 11e73b4..bff4665 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>732</width>
-    <height>604</height>
+    <height>657</height>
    </rect>
   </property>
   <property name="sizePolicy">
    <string>Form</string>
   </property>
   <layout class="QGridLayout" name="gridLayout_3">
-   <item row="0" column="0">
-    <widget class="QLabel" name="languageLabel">
-     <property name="text">
-      <string>Language</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1">
-    <widget class="QComboBox" name="language"/>
-   </item>
    <item row="2" column="0" colspan="2">
     <widget class="QGroupBox" name="OneInterfaceBox">
      <property name="title">
         </property>
        </widget>
       </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="assoName">
-        <property name="text">
-         <string>File associations:</string>
-        </property>
-       </widget>
-      </item>
       <item row="0" column="1" colspan="2">
        <widget class="QCheckBox" name="EnqueueOneInterfaceMode">
         <property name="text">
         </property>
        </widget>
       </item>
-      <item row="1" column="2">
-       <widget class="QPushButton" name="assoButton">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>Association Setup</string>
-        </property>
-       </widget>
-      </item>
      </layout>
     </widget>
    </item>
-   <item row="3" column="0" colspan="2">
+   <item row="4" column="0" colspan="2">
     <widget class="QGroupBox" name="groupBox_2">
      <property name="title">
       <string>Privacy / Network Interaction</string>
@@ -82,7 +52,7 @@
       <item row="0" column="0">
        <widget class="QLabel" name="artFetchLabel">
         <property name="text">
-         <string>Album art download policy</string>
+         <string>Album art download policy:</string>
         </property>
        </widget>
       </item>
         </property>
        </widget>
       </item>
-      <item row="1" column="2">
-       <widget class="QSpinBox" name="updatesDays">
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="suffix">
-         <string> days</string>
-        </property>
-       </widget>
-      </item>
       <item row="2" column="0">
        <widget class="QCheckBox" name="saveRecentlyPlayed">
         <property name="text">
         <item>
          <widget class="QLabel" name="filterLabel">
           <property name="text">
-           <string>Filter</string>
+           <string>Filter:</string>
           </property>
           <property name="alignment">
            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </item>
        </layout>
       </item>
+      <item row="1" column="1" colspan="2">
+       <widget class="QWidget" name="updatenotifier_zone" native="true">
+        <layout class="QHBoxLayout" name="horizontalLayout_5">
+         <item>
+          <widget class="QLabel" name="label">
+           <property name="text">
+            <string>every</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="updatesDays">
+           <property name="alignment">
+            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+           </property>
+           <property name="suffix">
+            <string> days</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
    <item row="1" column="0" colspan="2">
-    <widget class="QGroupBox" name="groupBox">
+    <widget class="QGroupBox" name="LooknfeelBox">
      <property name="title">
-      <string>Interface Type</string>
+      <string>Look and feel</string>
      </property>
      <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="0" colspan="2">
-       <widget class="QRadioButton" name="qt4">
-        <property name="text">
-         <string>Native</string>
-        </property>
-       </widget>
-      </item>
       <item row="0" column="2" colspan="4">
        <widget class="QLabel" name="defaultLabel">
         <property name="sizePolicy">
         </property>
        </widget>
       </item>
-      <item row="1" column="2">
-       <widget class="QLabel" name="displayLabel">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>Display mode</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="3" colspan="3">
-       <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="2" column="2" colspan="2">
-       <widget class="QCheckBox" name="embedVideo">
-        <property name="text">
-         <string>Embed video in interface</string>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="2" colspan="2">
-       <widget class="QCheckBox" name="fsController">
-        <property name="text">
-         <string>Show a controller in fullscreen</string>
-        </property>
-       </widget>
-      </item>
-      <item row="5" column="0" colspan="2">
+      <item row="6" column="0" colspan="2">
        <widget class="QRadioButton" name="skins">
         <property name="text">
-         <string>Skins</string>
+         <string>Use custom skin</string>
         </property>
        </widget>
       </item>
-      <item row="5" column="2" colspan="4">
+      <item row="6" column="2" colspan="4">
        <widget class="QLabel" name="skinsLabel">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
         </property>
        </widget>
       </item>
-      <item row="6" column="0" colspan="2">
-       <widget class="QLabel" name="skinFileLabel">
-        <property name="text">
-         <string>Skin file</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>fileSkin</cstring>
+      <item row="5" column="0" colspan="6">
+       <widget class="Line" name="line">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
         </property>
        </widget>
       </item>
-      <item row="6" column="2" colspan="3">
-       <widget class="QLineEdit" name="fileSkin">
+      <item row="7" column="2" colspan="4">
+       <widget class="QWidget" name="skins_zone" native="true">
+        <property name="enabled">
+         <bool>true</bool>
+        </property>
         <property name="sizePolicy">
-         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QLabel" name="skinFileLabel">
+           <property name="text">
+            <string>Skin resource file:</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+           </property>
+           <property name="buddy">
+            <cstring>fileSkin</cstring>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLineEdit" name="fileSkin">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="skinBrowse">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>Choose...</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+      <item row="0" column="0" colspan="2">
+       <widget class="QRadioButton" name="qt4">
+        <property name="text">
+         <string>Use native style</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
        </widget>
       </item>
-      <item row="6" column="5">
-       <widget class="QPushButton" name="skinBrowse">
+      <item row="1" column="2" colspan="4">
+       <widget class="QWidget" name="native_zone" native="true">
+        <layout class="QGridLayout" name="gridLayout_4">
+         <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="7" column="1">
+          <widget class="QCheckBox" name="fsController">
+           <property name="text">
+            <string>Show controls in full screen mode</string>
+           </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="1">
+          <widget class="QCheckBox" name="systrayBox">
+           <property name="text">
+            <string>Show systray icon</string>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="0">
+          <widget class="QCheckBox" name="resizingBox">
+           <property name="text">
+            <string>Resize interface to video size</string>
+           </property>
+          </widget>
+         </item>
+         <item row="7" column="0">
+          <widget class="QCheckBox" name="embedVideo">
+           <property name="text">
+            <string>Embed video in interface</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="0" column="0" colspan="2">
+    <widget class="QGroupBox" name="languageBox">
+     <property name="title">
+      <string>Language</string>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_3">
+      <item>
+       <widget class="QLabel" name="languageLabel">
+        <property name="text">
+         <string>Menus language:</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QComboBox" name="language"/>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="3" column="0" colspan="2">
+    <widget class="QGroupBox" name="assoBox">
+     <property name="title">
+      <string>File associations</string>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_4">
+      <item>
+       <widget class="QPushButton" name="assoButton">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
           <horstretch>0</horstretch>
          </sizepolicy>
         </property>
         <property name="text">
-         <string>Browse...</string>
+         <string>Set up associations...</string>
         </property>
        </widget>
       </item>
-      <item row="4" column="0" colspan="6">
-       <widget class="Line" name="line">
+      <item>
+       <spacer name="horizontalSpacer">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
-       </widget>
-      </item>
-      <item row="3" column="4" colspan="2">
-       <widget class="QCheckBox" name="systrayBox">
-        <property name="text">
-         <string>Systray icon</string>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="4" colspan="2">
-       <widget class="QCheckBox" name="resizingBox">
-        <property name="text">
-         <string>Resize interface to video size</string>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
         </property>
-       </widget>
+       </spacer>
       </item>
      </layout>
     </widget>
   </layout>
  </widget>
  <tabstops>
-  <tabstop>language</tabstop>
   <tabstop>qt4</tabstop>
-  <tabstop>displayModeBox</tabstop>
   <tabstop>OneInterfaceMode</tabstop>
-  <tabstop>assoButton</tabstop>
   <tabstop>artFetcher</tabstop>
   <tabstop>updatesBox</tabstop>
-  <tabstop>updatesDays</tabstop>
  </tabstops>
  <resources/>
  <connections/>
index 18ff878..ec4309c 100644 (file)
@@ -92,4 +92,9 @@
   <file alias="lock">pixmaps/lock.png</file>
   <file alias="playlist_remove" >pixmaps/playlist/remove.png</file>
  </qresource>
+ <qresource prefix="/prefsmenu" >
+        <file alias="sample_classic" >pixmaps/sample_classic.png</file>
+        <file alias="sample_complete" >pixmaps/sample_complete.png</file>
+        <file alias="sample_minimal" >pixmaps/sample_minimal.png</file>
+ </qresource>
 </RCC>