[vlc-devel] [PATCH] Fix for Ticket #4345
Vasily Fomin
vasili.fomin at gmail.com
Sun Sep 16 20:10:23 CEST 2012
---
modules/gui/qt4/dialogs/convert.cpp | 26 +++++++++++++++++++++++---
modules/gui/qt4/dialogs/convert.hpp | 1 +
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/modules/gui/qt4/dialogs/convert.cpp b/modules/gui/qt4/dialogs/convert.cpp
index 0e240ff..338d6a2 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,18 @@ void ConvertDialog::dumpChecked( bool checked )
displayBox->setEnabled( !checked );
profile->setEnabled( !checked );
}
+
+void ConvertDialog::setDestinationFileExtension()
+{
+ if ( !fileLine->text().isEmpty() ) {
+ QString newFileExtension = "." + profile->getMux();
+ QString newFileName;
+ int index = fileLine->text().lastIndexOf( "." );
+ if ( index != -1 ) {
+ newFileName = fileLine->text().left( index ).append( newFileExtension );
+ } else {
+ newFileName = fileLine->text().append( 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
--
1.7.10.4
More information about the vlc-devel
mailing list