[vlc-devel] commit: Use native dialog for saving VLM files. (Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Jul 24 12:16:15 CEST 2009


vlc | branch: 1.0-bugfix | Jean-Baptiste Kempf <jb at videolan.org> | Fri Jul 24 11:10:45 2009 +0200| [dfe0e8cdcd01717b8f964221367ffbab4abc9c86] | committer: Jean-Baptiste Kempf 

Use native dialog for saving VLM files.
(cherry picked from commit 6a4c2d796ce2318d54da8d1e45f35ca439461a8a)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dfe0e8cdcd01717b8f964221367ffbab4abc9c86
---

 modules/gui/qt4/dialogs/vlm.cpp |   32 +++++++++-----------------------
 1 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/modules/gui/qt4/dialogs/vlm.cpp b/modules/gui/qt4/dialogs/vlm.cpp
index f9954ce..679eede 100644
--- a/modules/gui/qt4/dialogs/vlm.cpp
+++ b/modules/gui/qt4/dialogs/vlm.cpp
@@ -265,35 +265,21 @@ void VLMDialog::addVLMItem()
 /* TODO : VOD are not exported to the file */
 bool VLMDialog::exportVLMConf()
 {
-    QFileDialog* qfd = new QFileDialog( this, qtr( "Save VLM configuration as..." ),
+    QString saveVLMConfFileName = QFileDialog::getSaveFileName( 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 )
+    if( !saveVLMConfFileName.isEmpty() )
     {
-        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;
-        }
+        vlm_message_t *message;
+        QString command = "save \"" + saveVLMConfFileName + "\"";
+        vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
+        vlm_MessageDelete( message );
+        return true;
     }
 
-    delete qfd;
-    return exported;
+    return false;
 }
 
 void VLMDialog::mediasPopulator()




More information about the vlc-devel mailing list