[vlc-commits] Qt: advanced_open: use QTimeEdit instead of QDoubleSpinBox

Francois Cartegnie git at videolan.org
Tue Jul 12 14:25:21 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jul 12 14:21:54 2011 +0200| [a737917db968f26f77cb4b8a8485ff3af474b5a4] | committer: Francois Cartegnie

Qt: advanced_open: use QTimeEdit instead of QDoubleSpinBox

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

 modules/gui/qt4/dialogs/open.cpp |   14 +++++++++++---
 modules/gui/qt4/ui/open.ui       |   32 +++++++++++---------------------
 2 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/modules/gui/qt4/dialogs/open.cpp b/modules/gui/qt4/dialogs/open.cpp
index c849a43..4cc1c7b 100644
--- a/modules/gui/qt4/dialogs/open.cpp
+++ b/modules/gui/qt4/dialogs/open.cpp
@@ -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( " " ) );
diff --git a/modules/gui/qt4/ui/open.ui b/modules/gui/qt4/ui/open.ui
index 0adf40f..72993db 100644
--- a/modules/gui/qt4/ui/open.ui
+++ b/modules/gui/qt4/ui/open.ui
@@ -94,23 +94,10 @@
          <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>
@@ -178,19 +165,22 @@
         </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>
@@ -251,7 +241,7 @@
   <tabstop>Tab</tabstop>
   <tabstop>advancedCheckBox</tabstop>
   <tabstop>cacheSpinBox</tabstop>
-  <tabstop>startTimeDoubleSpinBox</tabstop>
+  <tabstop>startTimeTimeEdit</tabstop>
   <tabstop>slaveCheckbox</tabstop>
   <tabstop>slaveText</tabstop>
   <tabstop>slaveBrowseButton</tabstop>



More information about the vlc-commits mailing list