[vlc-devel] commit: qt4: add .vlm at the end of the export file if needed. ( Rémi Duraffort )
git version control
git at videolan.org
Sun Feb 15 17:10:39 CET 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Feb 15 17:02:35 2009 +0100| [3b124a6ca0a7256a308a7ae71c449f7c29a93ff6] | committer: Rémi Duraffort
qt4: add .vlm at the end of the export file if needed.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3b124a6ca0a7256a308a7ae71c449f7c29a93ff6
---
modules/gui/qt4/dialogs/vlm.cpp | 39 +++++++++++++++++++++++++++------------
1 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/modules/gui/qt4/dialogs/vlm.cpp b/modules/gui/qt4/dialogs/vlm.cpp
index b8232d3..e9aa171 100644
--- a/modules/gui/qt4/dialogs/vlm.cpp
+++ b/modules/gui/qt4/dialogs/vlm.cpp
@@ -264,20 +264,35 @@ void VLMDialog::addVLMItem()
/* TODO : VOD are not exported to the file */
bool VLMDialog::exportVLMConf()
{
- QString saveVLMConfFileName = QFileDialog::getSaveFileName(
- this, qtr( "Save VLM configuration as..." ),
- qfu( config_GetHomeDir() ),
- qtr( "VLM conf (*.vlm);;All (*)" ) );
-
- if( !saveVLMConfFileName.isEmpty() )
+ QFileDialog* qfd = new QFileDialog( this, qtr( "Save VLM configuration as..." ),
+ qfu( config_GetHomeDir() ),
+ qtr( "VLM conf (*.vlm);;All (*)" ) );
+ qfd->setFileMode( QFileDialog::AnyFile );
+ qfd->setAcceptMode( QFileDialog::AcceptSave );
+ qfd->setConfirmOverwrite( true );
+
+ bool exported = false;
+ if( qfd->exec() == QDialog::Accepted )
{
- vlm_message_t *message;
- QString command = "save \"" + saveVLMConfFileName + "\"";
- vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
- vlm_MessageDelete( message );
- return true;
+ QString saveVLMConfFileName = qfd->selectedFiles().first();
+ QString filter = qfd->selectedFilter();
+
+ // If *.vlm is selected, add .vlm at the end if needed
+ if( filter.contains( "VLM" ) && !saveVLMConfFileName.contains( ".vlm" ) )
+ saveVLMConfFileName.append( ".vlm" );
+
+ if( !saveVLMConfFileName.isEmpty() )
+ {
+ vlm_message_t *message;
+ QString command = "save \"" + saveVLMConfFileName + "\"";
+ vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
+ vlm_MessageDelete( message );
+ exported = true;
+ }
}
- return false;
+
+ delete qfd;
+ return exported;
}
void VLMDialog::mediasPopulator()
More information about the vlc-devel
mailing list