[vlc-devel] [RESEND] [PATCH] Qt: Enable Stop Time in media convert dialog

Filip Roséen filip at atch.se
Tue Nov 8 12:29:22 CET 2016


Hi Rajesh,

On 2016-11-08 16:14, Rajeesh K V wrote:

> From 4d5d282990215e5cefcedf19b56f738bbee2d9c3 Mon Sep 17 00:00:00 2001
> From: Rajeesh K V <rajeeshknambiar at gmail.com>
> Date: Tue, 16 Aug 2016 10:38:46 +0530
> Subject: [PATCH] Qt: Enable Stop Time in media convert dialog
> 
> Convert/Save dialog has had option to specify 'start time' but
> no option for setting 'stop time' in the interface. The backend
> 'stop-time' option was already present. This patch simply adds
> and enables the edit widget for end time in Qt interface.
> ---
>  modules/gui/qt/dialogs/open.cpp | 17 +++++++++++------
>  modules/gui/qt/ui/open.ui       | 33 +++++++++++++++++++++++++++++++++
>  2 files changed, 44 insertions(+), 6 deletions(-)

Other than the really long line in `open.cpp:TimeTomSecs`, and perhaps
the name of the function (`TimeToMilliseconds` is easier to read), it
looks alright.

 - Is there a ticket associated with this feature? If so; include
   *"Fixes #123"* in the commit message (where `123` is the *ticket-id*).

 - Given that this is a new feature, you could update `NEWS` to
   include a line under `Qt interface` saying that it is now possible
   to specify *stop-time* in the relevant dialog.

Well done; *LGTM*!

Best Regards,\
Filip

> 
> diff --git a/modules/gui/qt/dialogs/open.cpp b/modules/gui/qt/dialogs/open.cpp
> index 224cfa5..7632d23 100644
> --- a/modules/gui/qt/dialogs/open.cpp
> +++ b/modules/gui/qt/dialogs/open.cpp
> @@ -156,6 +156,7 @@ OpenDialog::OpenDialog( QWidget *parent,
>      CONNECT( ui.slaveText, textChanged( const QString& ), this, updateMRL() );
>      CONNECT( ui.cacheSpinBox, valueChanged( int ), this, updateMRL() );
>      CONNECT( ui.startTimeTimeEdit, timeChanged ( const QTime& ), this, updateMRL() );
> +    CONNECT( ui.stopTimeTimeEdit, timeChanged ( const QTime& ), this, updateMRL() );
>      BUTTONACT( ui.advancedCheckBox, toggleAdvancedPanel() );
>      BUTTONACT( ui.slaveBrowseButton, browseInputSlave() );
>  
> @@ -179,6 +180,7 @@ OpenDialog::OpenDialog( QWidget *parent,
>  
>      /* enforce section due to .ui bug */
>      ui.startTimeTimeEdit->setCurrentSection( QDateTimeEdit::SecondSection );
> +    ui.stopTimeTimeEdit->setCurrentSection( QDateTimeEdit::SecondSection );
>  
>      setMinimumSize( sizeHint() );
>      setMaximumWidth( 900 );
> @@ -427,6 +429,11 @@ void OpenDialog::updateMRL( const QStringList& item, const QString& tempMRL )
>      updateMRL();
>  }
>  
> +/* Format the time to millisectionds */
> +QString TimeTomSecs( const QTimeEdit *time ) {
> +    return QString::number( ( time->minimumTime().msecsTo( time->time() ) ) / 1000.0, 'f', 3);
> +}
> +
>  /* Update the complete MRL */
>  void OpenDialog::updateMRL() {
>      QString mrl = optionsMRL;
> @@ -436,12 +443,10 @@ void OpenDialog::updateMRL() {
>      mrl += QString( " :%1=%2" ).arg( storedMethod ).
>                                  arg( ui.cacheSpinBox->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') );
> +        mrl += " :start-time=" + TimeTomSecs( ui.startTimeTimeEdit );
> +    }
> +    if( ui.stopTimeTimeEdit->time() > ui.startTimeTimeEdit->time() ) {
> +        mrl += " :stop-time=" + TimeTomSecs( ui.stopTimeTimeEdit );
>      }
>      ui.advancedLineInput->setText( mrl );
>      ui.mrlLine->setText( itemsMRL.join( " " ) );
> diff --git a/modules/gui/qt/ui/open.ui b/modules/gui/qt/ui/open.ui
> index ea510db..f105fe4 100644
> --- a/modules/gui/qt/ui/open.ui
> +++ b/modules/gui/qt/ui/open.ui
> @@ -169,6 +169,19 @@
>          </property>
>         </widget>
>        </item>
> +      <item row="1" column="3">
> +       <widget class="QLabel" name="label_4">
> +        <property name="text">
> +         <string>Stop Time</string>
> +        </property>
> +        <property name="alignment">
> +         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
> +        </property>
> +        <property name="buddy">
> +         <cstring>stopTimeTimeEdit</cstring>
> +        </property>
> +       </widget>
> +      </item>
>        <item row="8" column="0">
>         <widget class="QLabel" name="label">
>          <property name="text">
> @@ -241,6 +254,25 @@
>          </property>
>         </widget>
>        </item>
> +      <item row="1" column="4" colspan="2">
> +       <widget class="QTimeEdit" name="stopTimeTimeEdit">
> +        <property name="toolTip">
> +         <string>Change the stop time for the media</string>
> +        </property>
> +        <property name="alignment">
> +         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
> +        </property>
> +        <property name="currentSection">
> +         <enum>QDateTimeEdit::HourSection</enum>
> +        </property>
> +        <property name="displayFormat">
> +         <string>HH'H':mm'm':ss's'.zzz</string>
> +        </property>
> +        <property name="timeSpec">
> +         <enum>Qt::LocalTime</enum>
> +        </property>
> +       </widget>
> +      </item>
>        <item row="4" column="0" colspan="6">
>         <widget class="QCheckBox" name="slaveCheckbox">
>          <property name="text">
> @@ -271,6 +303,7 @@
>    <tabstop>advancedCheckBox</tabstop>
>    <tabstop>cacheSpinBox</tabstop>
>    <tabstop>startTimeTimeEdit</tabstop>
> +  <tabstop>stopTimeTimeEdit</tabstop>
>    <tabstop>slaveCheckbox</tabstop>
>    <tabstop>slaveText</tabstop>
>    <tabstop>slaveBrowseButton</tabstop>
> -- 
> 2.7.4
> 

> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20161108/fa4db983/attachment.html>


More information about the vlc-devel mailing list