Qt4 - Open. Use a Frame and not a QComboBox for subtitles. (lacks still some toggle...
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 19 Mar 2007 19:42:25 +0000 (19:42 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 19 Mar 2007 19:42:25 +0000 (19:42 +0000)
modules/gui/qt4/components/open.cpp
modules/gui/qt4/components/open.hpp
modules/gui/qt4/dialogs/open.cpp
modules/gui/qt4/ui/open_file.ui

index bc90e3a..313c827 100644 (file)
@@ -71,9 +71,16 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     /* Change the text that was uncool in the usual box */
     listLabel[5]->setText( qtr( "Filter:" ) );
 
+    /* Hacks Continued Catch the close event */
+    dialogBox->installEventFilter( this );
+
+    // Hide the subtitles control by default.
+    ui.subFrame->hide();
+
+
     BUTTONACT( ui.subBrowseButton, browseFileSub() );
+    BUTTONACT( ui.subCheckBox, updateMRL());
 
-    BUTTONACT( ui.subGroupBox, updateMRL());
     CONNECT( ui.fileInput, editTextChanged(QString ), this, updateMRL());
     CONNECT( ui.subInput, editTextChanged(QString ), this, updateMRL());
     CONNECT( ui.alignSubComboBox, currentIndexChanged(int), this, updateMRL());
@@ -109,7 +116,7 @@ void FileOpenPanel::updateMRL()
 {
     QString mrl = ui.fileInput->currentText();
 
-    if( ui.subGroupBox->isChecked() ) {
+    if( ui.subCheckBox->isChecked() ) {
         mrl.append( " :sub-file=" + ui.subInput->currentText() );
         mrl.append( " :subsdec-align=" + ui.alignSubComboBox->currentText() );
         mrl.append( " :sub-rel-fontsize=" + ui.sizeSubComboBox->currentText() );
@@ -134,6 +141,18 @@ void FileOpenPanel::clear()
     ui.subInput->setEditText( "" );
 }
 
+bool FileOpenPanel::eventFilter(QObject *object, QEvent *event)
+{
+    printf( "coin\n" );
+    if ( ( object == dialogBox ) && ( event->type() == QEvent::Hide ) )
+    {
+         event->ignore();
+         return true;
+    }
+    // standard event processing
+    else
+        return QObject::eventFilter(object, event);
+}
 
 /**************************************************************************
  * Disk open
index 81ec2b4..d3e6334 100644 (file)
@@ -68,11 +68,13 @@ private:
     QStringList browse( QString );
     QFileDialog *dialogBox;
     QLineEdit *lineFileEdit;
+    bool eventFilter(QObject *, QEvent *);
 public slots:
     virtual void updateMRL();
 private slots:
     void browseFile();
     void browseFileSub();
+
 };
 
 class NetOpenPanel: public OpenPanel
index f23fe4e..4d0e433 100644 (file)
@@ -161,6 +161,7 @@ void OpenDialog::playOrEnqueue( bool b_enqueue = false )
 
 void OpenDialog::toggleAdvancedPanel()
 {
+    //FIXME does not work under Windows
     if (ui.advancedFrame->isVisible()) {
         ui.advancedFrame->hide();
         setMinimumHeight(1);
index 1cdc5e1..017f626 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>210</height>
+    <width>463</width>
+    <height>249</height>
    </rect>
   </property>
   <property name="sizePolicy" >
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="1" column="0" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Fixed</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>3</width>
-       <height>20</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item row="3" column="0" colspan="3" >
-    <widget class="QGroupBox" name="subGroupBox" >
+   <item row="4" column="0" colspan="3" >
+    <widget class="QFrame" name="subFrame" >
      <property name="sizePolicy" >
       <sizepolicy>
        <hsizetype>1</hsizetype>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
-     <property name="title" >
-      <string>Use a subtitles file</string>
-     </property>
-     <property name="checkable" >
-      <bool>true</bool>
-     </property>
-     <property name="checked" >
-      <bool>false</bool>
+     <property name="frameShape" >
+      <enum>QFrame::StyledPanel</enum>
      </property>
      <layout class="QGridLayout" >
       <property name="margin" >
-       <number>6</number>
+       <number>9</number>
       </property>
       <property name="spacing" >
-       <number>5</number>
+       <number>6</number>
       </property>
-      <item row="0" column="4" >
-       <widget class="QPushButton" name="subBrowseButton" >
-        <property name="text" >
-         <string>Browse</string>
+      <item row="1" column="7" >
+       <spacer>
+        <property name="orientation" >
+         <enum>Qt::Horizontal</enum>
         </property>
-       </widget>
+        <property name="sizeHint" >
+         <size>
+          <width>16</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
       </item>
-      <item row="0" column="0" colspan="4" >
-       <widget class="QComboBox" name="subInput" >
-        <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>7</hsizetype>
-          <vsizetype>0</vsizetype>
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
+      <item row="1" column="0" >
+       <spacer>
+        <property name="orientation" >
+         <enum>Qt::Horizontal</enum>
         </property>
-        <property name="editable" >
-         <bool>true</bool>
+        <property name="sizeHint" >
+         <size>
+          <width>16</width>
+          <height>20</height>
+         </size>
         </property>
-       </widget>
+       </spacer>
       </item>
-      <item row="1" column="1" >
-       <widget class="QComboBox" name="sizeSubComboBox" >
+      <item row="1" column="5" colspan="2" >
+       <widget class="QComboBox" name="alignSubComboBox" >
         <property name="minimumSize" >
          <size>
-          <width>100</width>
+          <width>80</width>
           <height>0</height>
          </size>
         </property>
+        <property name="currentIndex" >
+         <number>0</number>
+        </property>
+        <property name="insertPolicy" >
+         <enum>QComboBox::NoInsert</enum>
+        </property>
+        <property name="minimumContentsLength" >
+         <number>0</number>
+        </property>
         <item>
          <property name="text" >
-          <string>Very Small</string>
-         </property>
-        </item>
-        <item>
-         <property name="text" >
-          <string>Small</string>
-         </property>
-        </item>
-        <item>
-         <property name="text" >
-          <string>Normal</string>
+          <string>Left</string>
          </property>
         </item>
         <item>
          <property name="text" >
-          <string>Big</string>
+          <string>Center</string>
          </property>
         </item>
         <item>
          <property name="text" >
-          <string>Very Big</string>
+          <string>Right</string>
          </property>
         </item>
        </widget>
       </item>
-      <item row="1" column="2" >
+      <item row="1" column="4" >
+       <widget class="QLabel" name="alignSubLabel" >
+        <property name="text" >
+         <string>Alignment:</string>
+        </property>
+        <property name="buddy" >
+         <cstring>alignSubLabel</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="3" >
        <spacer>
         <property name="orientation" >
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" >
          <size>
-          <width>40</width>
-          <height>20</height>
+          <width>71</width>
+          <height>26</height>
          </size>
         </property>
        </spacer>
       </item>
-      <item row="1" column="4" >
-       <widget class="QComboBox" name="alignSubComboBox" >
+      <item row="1" column="2" >
+       <widget class="QComboBox" name="sizeSubComboBox" >
         <property name="minimumSize" >
          <size>
-          <width>80</width>
+          <width>100</width>
           <height>0</height>
          </size>
         </property>
-        <property name="currentIndex" >
-         <number>0</number>
-        </property>
-        <property name="insertPolicy" >
-         <enum>QComboBox::NoInsert</enum>
-        </property>
-        <property name="minimumContentsLength" >
-         <number>0</number>
-        </property>
         <item>
          <property name="text" >
-          <string>Left</string>
+          <string>Very Small</string>
          </property>
         </item>
         <item>
          <property name="text" >
-          <string>Center</string>
+          <string>Small</string>
          </property>
         </item>
         <item>
          <property name="text" >
-          <string>Right</string>
+          <string>Normal</string>
+         </property>
+        </item>
+        <item>
+         <property name="text" >
+          <string>Big</string>
+         </property>
+        </item>
+        <item>
+         <property name="text" >
+          <string>Very Big</string>
          </property>
         </item>
        </widget>
       </item>
-      <item row="1" column="0" >
+      <item row="1" column="1" >
        <widget class="QLabel" name="sizeSubLabel" >
         <property name="text" >
          <string>Size:</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="3" >
-       <widget class="QLabel" name="alignSubLabel" >
-        <property name="text" >
-         <string>Alignment:</string>
+      <item row="0" column="0" colspan="6" >
+       <widget class="QComboBox" name="subInput" >
+        <property name="sizePolicy" >
+         <sizepolicy>
+          <hsizetype>7</hsizetype>
+          <vsizetype>0</vsizetype>
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
         </property>
-        <property name="buddy" >
-         <cstring>alignSubLabel</cstring>
+        <property name="editable" >
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="6" colspan="2" >
+       <widget class="QPushButton" name="subBrowseButton" >
+        <property name="text" >
+         <string>Browse</string>
         </property>
        </widget>
       </item>
      </layout>
     </widget>
    </item>
-   <item row="0" column="1" colspan="2" >
-    <widget class="QWidget" native="1" name="tempWidget" />
+   <item row="3" column="0" colspan="2" >
+    <widget class="QCheckBox" name="subCheckBox" >
+     <property name="text" >
+      <string>Use a subtitles file</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="2" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Fixed</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>273</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="1" >
+    <widget class="QLabel" name="fileLabel" >
+     <property name="text" >
+      <string>File / Directory Names;</string>
+     </property>
+    </widget>
    </item>
    <item row="1" column="2" >
     <widget class="QComboBox" name="fileInput" >
      </property>
     </widget>
    </item>
-   <item row="1" column="1" >
-    <widget class="QLabel" name="fileLabel" >
-     <property name="text" >
-      <string>File / Directory Names;</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="2" >
+   <item row="5" column="1" colspan="2" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
      </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Fixed</enum>
-     </property>
      <property name="sizeHint" >
       <size>
-       <width>273</width>
-       <height>16</height>
+       <width>200</width>
+       <height>2</height>
       </size>
      </property>
     </spacer>
    </item>
-   <item row="4" column="1" colspan="2" >
+   <item row="0" column="1" colspan="2" >
+    <widget class="QWidget" native="1" name="tempWidget" />
+   </item>
+   <item row="1" column="0" >
     <spacer>
      <property name="orientation" >
-      <enum>Qt::Vertical</enum>
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Fixed</enum>
      </property>
      <property name="sizeHint" >
       <size>
-       <width>200</width>
-       <height>2</height>
+       <width>16</width>
+       <height>26</height>
       </size>
      </property>
     </spacer>