[vlc-commits] Qt: Automatic file extension in Transcode/Save
Vasily Fomin
git at videolan.org
Mon Sep 17 01:20:30 CEST 2012
vlc | branch: master | Vasily Fomin <vasili.fomin at gmail.com> | Sun Sep 16 20:10:23 2012 +0200| [6119143e1819a61c0b08380da696a8e8ce613e93] | committer: Jean-Baptiste Kempf
Qt: Automatic file extension in Transcode/Save
Close #4345
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6119143e1819a61c0b08380da696a8e8ce613e93
---
modules/gui/qt4/dialogs/convert.cpp | 25 +++++++++++++++++++++++--
modules/gui/qt4/dialogs/convert.hpp | 1 +
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt4/dialogs/convert.cpp b/modules/gui/qt4/dialogs/convert.cpp
index 0e240ff..6cabe09 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() )
+ {
+ 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
More information about the vlc-commits
mailing list