[vlc-devel] [PATCH] Fix for Ticket #4345

Rémi Denis-Courmont remi at remlab.net
Sun Sep 16 22:12:15 CEST 2012


It's nice to know that the patch fixes a certain ticket. But it's not an excuse 
to not say what the patches actually changes.

Le dimanche 16 septembre 2012 01:08:03, Vasily Fomin a écrit :
> ---
>  modules/gui/qt4/dialogs/convert.cpp |   27 ++++++++++++++++++++++++---
>  modules/gui/qt4/dialogs/convert.hpp |    1 +
>  2 files changed, 25 insertions(+), 3 deletions(-)
> 
> diff --git a/modules/gui/qt4/dialogs/convert.cpp
> b/modules/gui/qt4/dialogs/convert.cpp index 0e240ff..ed780f3 100644
> --- a/modules/gui/qt4/dialogs/convert.cpp
> +++ b/modules/gui/qt4/dialogs/convert.cpp
> @@ -106,14 +106,19 @@ ConvertDialog::ConvertDialog( QWidget *parent,
> intf_thread_t *_p_intf, BUTTONACT(cancelButton,cancel());
> 
>      CONNECT(dumpBox,toggled(bool),this,dumpChecked(bool));
> +    CONNECT(profile, optionsChanged(), this,
> setDestinationFileExtension()); +    CONNECT(fileLine, editingFinished(),
> this, setDestinationFileExtension()); }
> 
>  void ConvertDialog::fileBrowse()
> -{
> +{
> +    QString fileExtension = "." + profile->getMux();
> +
>      QString fileName = QFileDialog::getSaveFileName( this, qtr( "Save
> file..." ), -            "",
> - qtr( "Containers (*.ps *.ts *.mpg *.ogg *.asf *.mp4 *.mov *.wav *.raw
> *.flv *.webm)" ) ); +        "",
> +        QString( qtr( "Containers (*" ) + fileExtension + ")" ) );
>      fileLine->setText( toNativeSeparators( fileName ) );
> +    setDestinationFileExtension();
>  }
> 
>  void ConvertDialog::cancel()
> @@ -156,3 +161,19 @@ void ConvertDialog::dumpChecked( bool checked )
>      displayBox->setEnabled( !checked );
>      profile->setEnabled( !checked );
>  }
> +
> +void ConvertDialog::setDestinationFileExtension()
> +{
> +    if ( !fileLine->text().isEmpty() ) {
> +        int index = fileLine->text().lastIndexOf( "." );
> +        QString newFileExtension = "." + profile->getMux();
> +        QString newFileName;
> +        if ( index != -1 ) {
> +            int delta = fileLine->text().length() - index;
> +            newFileName = fileLine->text().replace( index, delta,
> newFileExtension ); +        } else {
> +            newFileName = fileLine->text() + newFileExtension;
> +        }
> +        fileLine->setText( toNativeSeparators( newFileName ) );
> +    }
> +}
> diff --git a/modules/gui/qt4/dialogs/convert.hpp
> b/modules/gui/qt4/dialogs/convert.hpp index de87981..a85a0c8 100644
> --- a/modules/gui/qt4/dialogs/convert.hpp
> +++ b/modules/gui/qt4/dialogs/convert.hpp
> @@ -50,6 +50,7 @@ private slots:
>      virtual void cancel();
>      void fileBrowse();
>      void dumpChecked(bool);
> +    void setDestinationFileExtension();
>  };
> 
>  #endif

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list