Qt4 : SimplePrefs: various fixes, remove some widgets, uniformity, cleaning and hidin...
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 25 Feb 2007 23:08:25 +0000 (23:08 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 25 Feb 2007 23:08:25 +0000 (23:08 +0000)
modules/gui/qt4/components/simple_preferences.cpp
modules/gui/qt4/dialogs/prefs_dialog.cpp
modules/gui/qt4/ui/sprefs_hotkeys.ui
modules/gui/qt4/ui/sprefs_input.ui
modules/gui/qt4/ui/sprefs_video.ui

index 96bbbde..f774808 100644 (file)
@@ -70,7 +70,6 @@ SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) :
     ADD_CATEGORY( SPrefsAudio, qtr("Audio"), audio_50x50_xpm );
     ADD_CATEGORY( SPrefsInputAndCodecs, qtr("Input and Codecs"),
                   input_and_codecs_50x50_xpm );
-//    ADD_CATEGORY( SPrefsPlaylist, qtr("Playlist"), playlist_50x50_xpm );
     ADD_CATEGORY( SPrefsInterface, qtr("Interface"), interface_50x50_xpm );
     ADD_CATEGORY( SPrefsSubtitles, qtr("Subtitles"), subtitles_50x50_xpm );
     ADD_CATEGORY( SPrefsHotkeys, qtr("Hotkeys"), hotkeys_50x50_xpm );
@@ -96,34 +95,38 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
                 controls.append( control );                               \
             }
 
-#define START_SPREFS_CAT( name )    \
-        case SPrefs ## name:        \
-        {                           \
-            Ui::SPrefs ## name ui;  \
-            ui.setupUi( panel );
+#define START_SPREFS_CAT( name , label )    \
+        case SPrefs ## name:                \
+        {                                   \
+            Ui::SPrefs ## name ui;          \
+            ui.setupUi( panel );            \
+            panel_label->setText( qtr( label ) );
 
 #define END_SPREFS_CAT      \
             break;          \
         }
+
     QVBoxLayout *panel_layout = new QVBoxLayout();
-    QString head;
     QWidget *panel = new QWidget();
-// Title Label
-        QLabel *panel_label = new QLabel;
-        QFont labelFont = QApplication::font( static_cast<QWidget*>(0) );
-        labelFont.setPointSize( labelFont.pointSize() + 4 );
-        labelFont.setBold( true );
-        panel_label->setFont( labelFont );
-    
-        // Title <hr>
-        QFrame *title_line = new QFrame;
-        title_line->setFrameShape(QFrame::HLine);
-        title_line->setFrameShadow(QFrame::Sunken);
+
+    // Title Label
+    QLabel *panel_label = new QLabel;
+    QFont labelFont = QApplication::font( static_cast<QWidget*>(0) );
+    labelFont.setPointSize( labelFont.pointSize() + 4 );
+    labelFont.setBold( true );
+    panel_label->setFont( labelFont );
+
+    // Title <hr>
+    QFrame *title_line = new QFrame;
+    title_line->setFrameShape(QFrame::HLine);
+    title_line->setFrameShadow(QFrame::Sunken);
 
     switch( number )
     {
-        START_SPREFS_CAT( Video );
-
+        START_SPREFS_CAT( Video , "General video settings" );
+         #ifndef WIN32
+            ui.directXBox->setVisible( false );
+         #endif
             CONFIG_GENERIC( "video", Bool, NULL, enableVideo );
 
             CONFIG_GENERIC( "fullscreen", Bool, NULL, fullscreen );
@@ -143,27 +146,33 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 
         END_SPREFS_CAT;
 
-        START_SPREFS_CAT( Audio );
-
+        START_SPREFS_CAT( Audio,  "General audio settings" );
+         #ifndef WIN32
+            ui.DirectXLabel->setVisible( false );
+            ui.DirectXDevice->setVisible( false );
+         #endif
+         #ifdef WIN32
+            ui.OSSBrowse->hide();
+            ui.OSSDevice->hide();
+            ui.OSSLabel->hide();
+            ui.alsaDevice->hide();
+            ui.alsaLabel->hide();
+         #endif
             CONFIG_GENERIC( "audio", Bool, NULL, enableAudio );
 
         END_SPREFS_CAT;
 
-        START_SPREFS_CAT( InputAndCodecs );
-
+        START_SPREFS_CAT( InputAndCodecs, "Input & Codecs settings"  );
 
         END_SPREFS_CAT;
 
-/*        START_SPREFS_CAT( Playlist );
-        END_SPREFS_CAT;*/
-
-        START_SPREFS_CAT( Interface );
+        START_SPREFS_CAT( Interface, "Interfaces settings" );
 
             CONFIG_GENERIC( "language", StringList, NULL, language );
 
         END_SPREFS_CAT;
 
-        START_SPREFS_CAT( Subtitles );
+        START_SPREFS_CAT( Subtitles, "Subtitles & OSD settings" );
 
             CONFIG_GENERIC( "subsdec-encoding", StringList, NULL, encoding );
             CONFIG_GENERIC( "sub-language", String, NULL, preferredLanguage );
@@ -175,15 +184,16 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 
         END_SPREFS_CAT;
 
-        START_SPREFS_CAT( Hotkeys );
+        START_SPREFS_CAT( Hotkeys, "Configure Hotkeys" );
         END_SPREFS_CAT;
         }
-  panel_layout->addWidget(panel_label);
-       panel_layout->addWidget(title_line);
-       panel_layout->addWidget( panel );
 
-       this->setLayout(panel_layout);
+    panel_layout->addWidget(panel_label);
+    panel_layout->addWidget(title_line);
+    panel_layout->addWidget( panel );
+    panel_layout->addStretch( 2 );
 
+    this->setLayout(panel_layout);
 }
 
 void SPrefsPanel::apply()
index ce6ce20..6e4ccfc 100644 (file)
 #include <QPushButton>
 #include <QCheckBox>
 #include <QScrollArea>
-#include <QLabel>
+
 PrefsDialog *PrefsDialog::instance = NULL;
 
 PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 {
      QGridLayout *main_layout = new QGridLayout(this);
      setWindowTitle( qtr( "Preferences" ) );
-     resize( 800, 450 );
-     setMaximumHeight (450);
+     resize( 800, 600 );
+     setMaximumHeight (600);
 
      tree_panel = new QWidget(0);
      tree_panel_l = new QHBoxLayout;
index 99f3a03..46d9839 100644 (file)
@@ -1,13 +1,13 @@
 <ui version="4.0" >
  <author>Jean-Baptiste Kempf</author>
  <class>SPrefsHotkeys</class>
- <widget class="QWidget" name="SPrefsVideo" >
+ <widget class="QWidget" name="SPrefsHotkeys" >
   <property name="geometry" >
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>426</width>
-    <height>474</height>
+    <width>421</width>
+    <height>511</height>
    </rect>
   </property>
   <property name="windowTitle" >
    </item>
    <item row="1" column="0" colspan="2" >
     <widget class="QTreeWidget" name="shortcutsTree" >
+     <property name="sizePolicy" >
+      <sizepolicy>
+       <hsizetype>7</hsizetype>
+       <vsizetype>3</vsizetype>
+       <horstretch>4</horstretch>
+       <verstretch>4</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize" >
+      <size>
+       <width>350</width>
+       <height>350</height>
+      </size>
+     </property>
      <property name="columnCount" >
       <number>2</number>
      </property>
@@ -58,7 +72,7 @@
        <string>Shortcut</string>
       </property>
      </column>
-   </widget>
+    </widget>
    </item>
    <item row="0" column="0" >
     <widget class="QLabel" name="label" >
index 46862d9..367c7b0 100644 (file)
@@ -1,13 +1,13 @@
 <ui version="4.0" >
  <author>Jean-Baptiste Kempf</author>
  <class>SPrefsInputAndCodecs</class>
- <widget class="QWidget" name="Spref_input" >
+ <widget class="QWidget" name="SprefsInputAndCodecs" >
   <property name="geometry" >
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>439</width>
-    <height>552</height>
+    <width>422</width>
+    <height>437</height>
    </rect>
   </property>
   <property name="windowTitle" >
       <property name="spacing" >
        <number>6</number>
       </property>
-      <item row="2" column="2" >
-       <widget class="QPushButton" name="CDDevice" >
+      <item row="0" column="0" >
+       <widget class="QLabel" name="label" >
         <property name="text" >
-         <string>Browse</string>
+         <string>Disk Device</string>
         </property>
        </widget>
       </item>
-      <item row="2" column="1" >
-       <widget class="QLineEdit" name="CDDevice" />
+      <item row="0" column="1" >
+       <widget class="QLineEdit" name="DVDDevice" />
       </item>
       <item row="0" column="2" >
        <widget class="QPushButton" name="DVDBrowse" >
         </property>
        </widget>
       </item>
-      <item row="1" column="2" >
-       <widget class="QPushButton" name="VCDBrowse" >
-        <property name="text" >
-         <string>Browse</string>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0" >
-       <widget class="QLabel" name="label_3" >
-        <property name="text" >
-         <string>Audio CD Device</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0" >
-       <widget class="QLabel" name="label_2" >
-        <property name="text" >
-         <string>VCD Device</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1" >
-       <widget class="QLineEdit" name="DVDDevice" />
-      </item>
-      <item row="0" column="0" >
-       <widget class="QLabel" name="label" >
-        <property name="text" >
-         <string>DVD Device</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1" >
-       <widget class="QLineEdit" name="VCDDevice" />
-      </item>
      </layout>
     </widget>
    </item>
       <property name="spacing" >
        <number>6</number>
       </property>
+      <item row="2" column="0" colspan="2" >
+       <widget class="QLabel" name="label" >
+        <property name="text" >
+         <string>Default Network caching in ms</string>
+        </property>
+       </widget>
+      </item>
       <item row="1" column="0" >
        <widget class="QLabel" name="label_7" >
         <property name="text" >
         </property>
        </widget>
       </item>
-      <item row="0" column="0" >
-       <widget class="QLabel" name="label_4" >
-        <property name="text" >
-         <string>UDP Default Port</string>
+      <item row="2" column="2" >
+       <widget class="QSpinBox" name="networkCache" >
+        <property name="alignment" >
+         <set>Qt::AlignRight</set>
+        </property>
+        <property name="maximum" >
+         <number>10000</number>
+        </property>
+        <property name="value" >
+         <number>300</number>
         </property>
        </widget>
       </item>
-      <item row="0" column="1" >
+      <item row="1" column="1" colspan="2" >
+       <widget class="QLineEdit" name="lineEdit" />
+      </item>
+      <item row="0" column="1" colspan="2" >
        <widget class="QSpinBox" name="UDPPort" >
         <property name="alignment" >
          <set>Qt::AlignRight</set>
         </property>
        </widget>
       </item>
-      <item row="1" column="1" >
-       <widget class="QLineEdit" name="lineEdit" />
+      <item row="0" column="0" >
+       <widget class="QLabel" name="label_4" >
+        <property name="text" >
+         <string>UDP Default Port</string>
+        </property>
+       </widget>
       </item>
      </layout>
     </widget>
      </layout>
     </widget>
    </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox_5" >
-     <property name="title" >
-      <string>Caching</string>
-     </property>
-     <layout class="QGridLayout" >
-      <property name="margin" >
-       <number>9</number>
-      </property>
-      <property name="spacing" >
-       <number>6</number>
-      </property>
-      <item row="2" column="1" >
-       <widget class="QSpinBox" name="localCache" >
-        <property name="alignment" >
-         <set>Qt::AlignRight</set>
-        </property>
-        <property name="maximum" >
-         <number>10000</number>
-        </property>
-        <property name="value" >
-         <number>300</number>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1" >
-       <widget class="QSpinBox" name="DiscCache" >
-        <property name="alignment" >
-         <set>Qt::AlignRight</set>
-        </property>
-        <property name="maximum" >
-         <number>10000</number>
-        </property>
-        <property name="value" >
-         <number>300</number>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1" >
-       <widget class="QSpinBox" name="networkCache" >
-        <property name="alignment" >
-         <set>Qt::AlignRight</set>
-        </property>
-        <property name="maximum" >
-         <number>10000</number>
-        </property>
-        <property name="value" >
-         <number>300</number>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="0" >
-       <widget class="QLabel" name="label" >
-        <property name="text" >
-         <string>Default Network caching in ms</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0" >
-       <widget class="QLabel" name="label_8" >
-        <property name="text" >
-         <string>Default Disc caching in ms</string>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0" >
-       <widget class="QLabel" name="label_9" >
-        <property name="text" >
-         <string>Default local caching in ms</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
   </layout>
  </widget>
  <resources/>
index 2fec181..238ea8e 100644 (file)
@@ -6,21 +6,31 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>426</width>
-    <height>429</height>
+    <width>400</width>
+    <height>443</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Form</string>
   </property>
-  <layout class="QGridLayout" >
+  <layout class="QVBoxLayout" >
    <property name="margin" >
     <number>9</number>
    </property>
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="2" column="0" >
+   <item>
+    <widget class="QCheckBox" name="enableVideo" >
+     <property name="text" >
+      <string>Enable video</string>
+     </property>
+     <property name="checked" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
     <widget class="QGroupBox" name="displayBox" >
      <property name="title" >
       <string>Display</string>
      </layout>
     </widget>
    </item>
-   <item row="3" column="0" >
+   <item>
     <widget class="QGroupBox" name="directXBox" >
      <property name="title" >
       <string>DirectX</string>
      </layout>
     </widget>
    </item>
-   <item row="4" column="0" >
+   <item>
     <widget class="QGroupBox" name="groupBox" >
      <property name="title" >
       <string>Video snapshots</string>
      </layout>
     </widget>
    </item>
-   <item row="0" column="0" >
-    <widget class="QCheckBox" name="enableVideo" >
-     <property name="text" >
-      <string>Enable video</string>
-     </property>
-     <property name="checked" >
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="0" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Fixed</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>7</width>
-       <height>10</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
- <includes/>
  <resources/>
  <connections/>
 </ui>