]> git.sesse.net Git - vlc/commitdiff
Qt: advanced_open: use QTimeEdit instead of QDoubleSpinBox
authorFrancois Cartegnie <fcvlcdev@free.fr>
Tue, 12 Jul 2011 12:21:54 +0000 (14:21 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Tue, 12 Jul 2011 12:23:06 +0000 (14:23 +0200)
modules/gui/qt4/dialogs/open.cpp
modules/gui/qt4/ui/open.ui

index c849a43803bb86e5efb75737d8ee0cb7a2e0bf5c..4cc1c7b33d4d1fa792ce6285d2fed699627aa4e8 100644 (file)
@@ -157,7 +157,7 @@ OpenDialog::OpenDialog( QWidget *parent,
     CONNECT( ui.slaveCheckbox, toggled( bool ), this, updateMRL() );
     CONNECT( ui.slaveText, textChanged( const QString& ), this, updateMRL() );
     CONNECT( ui.cacheSpinBox, valueChanged( int ), this, updateMRL() );
-    CONNECT( ui.startTimeDoubleSpinBox, valueChanged( double ), this, updateMRL() );
+    CONNECT( ui.startTimeTimeEdit,     timeChanged ( const QTime& ), this, updateMRL() );
     BUTTONACT( ui.advancedCheckBox, toggleAdvancedPanel() );
     BUTTONACT( ui.slaveBrowseButton, browseInputSlave() );
 
@@ -179,6 +179,9 @@ OpenDialog::OpenDialog( QWidget *parent,
     storedMethod = "";
     newCachingMethod( "file-caching" );
 
+    /* enforce section due to .ui bug */
+    ui.startTimeTimeEdit->setCurrentSection( QDateTimeEdit::SecondSection );
+
     setMinimumSize( sizeHint() );
     setMaximumWidth( 900 );
     resize( getSettings()->value( "opendialog-size", QSize( 500, 400 ) ).toSize() );
@@ -429,8 +432,13 @@ void OpenDialog::updateMRL() {
     }
     mrl += QString( " :%1=%2" ).arg( storedMethod ).
                                 arg( ui.cacheSpinBox->value() );
-    if( ui.startTimeDoubleSpinBox->value() ) {
-        mrl += " :start-time=" + QString::number( ui.startTimeDoubleSpinBox->value() );
+    if( ui.startTimeTimeEdit->time() != ui.startTimeTimeEdit->minimumTime() ) {
+        mrl += QString( " :start-time=%1.%2" )
+                .arg( QString::number(
+                    ui.startTimeTimeEdit->minimumTime().secsTo(
+                        ui.startTimeTimeEdit->time()
+                ) ) )
+               .arg( ui.startTimeTimeEdit->time().msec(), 3, 10, QChar('0') );
     }
     ui.advancedLineInput->setText( mrl );
     ui.mrlLine->setText( itemsMRL.join( " " ) );
index 0adf40f624c6125c17466508c626111d35a20bde..72993db32d48e49502a88c33b577c66306ec4f97 100644 (file)
          <string>Start Time</string>
         </property>
         <property name="buddy">
-         <cstring>startTimeDoubleSpinBox</cstring>
+         <cstring>startTimeTimeEdit</cstring>
         </property>
        </widget>
       </item>
-      <item row="0" column="7">
-       <spacer>
-        <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="6">
        <widget class="Line" name="line"/>
       </item>
         </property>
        </widget>
       </item>
-      <item row="0" column="5" colspan="2">
-       <widget class="QDoubleSpinBox" name="startTimeDoubleSpinBox">
+      <item row="0" column="5" colspan="3">
+       <widget class="QTimeEdit" name="startTimeTimeEdit">
         <property name="toolTip">
          <string>Change the start time for the media</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignRight</set>
         </property>
-        <property name="suffix">
-         <string>s</string>
+        <property name="currentSection">
+         <enum>QDateTimeEdit::SecondSection</enum>
+        </property>
+        <property name="displayFormat">
+         <string>HH'H':mm'm':ss's'.zzz</string>
         </property>
-        <property name="decimals">
-         <number>1</number>
+        <property name="timeSpec">
+         <enum>Qt::LocalTime</enum>
         </property>
        </widget>
       </item>
   <tabstop>Tab</tabstop>
   <tabstop>advancedCheckBox</tabstop>
   <tabstop>cacheSpinBox</tabstop>
-  <tabstop>startTimeDoubleSpinBox</tabstop>
+  <tabstop>startTimeTimeEdit</tabstop>
   <tabstop>slaveCheckbox</tabstop>
   <tabstop>slaveText</tabstop>
   <tabstop>slaveBrowseButton</tabstop>