Qt4 - VLM Export in the interface. Patch by Jean-Fran├žois Massol, adapted by me.
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 28 Jan 2008 07:03:23 +0000 (07:03 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 28 Jan 2008 07:03:23 +0000 (07:03 +0000)
modules/gui/qt4/dialogs/vlm.cpp
modules/gui/qt4/dialogs/vlm.hpp

index 554130f..97b12f4 100644 (file)
@@ -51,6 +51,7 @@
 #include <QSpinBox>
 #include <QHeaderView>
 #include <QScrollArea>
 #include <QSpinBox>
 #include <QHeaderView>
 #include <QScrollArea>
+#include <QFileDialog>
 
 static const char *psz_type[] = { "Broadcast", "Schedule", "VOD" };
 
 
 static const char *psz_type[] = { "Broadcast", "Schedule", "VOD" };
 
@@ -129,9 +130,13 @@ VLMDialog::VLMDialog( QWidget *parent, intf_thread_t *_p_intf ) : QVLCDialog( pa
         new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
     vlmItemLayout->addItem( spacer );
 
         new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
     vlmItemLayout->addItem( spacer );
 
+    QPushButton *exportButton = new QPushButton( qtr( "Export" ) );
+    ui.buttonBox->addButton( exportButton, QDialogButtonBox::ActionRole );
+
     QPushButton *closeButton = new QPushButton( qtr( "Close" ) );
     ui.buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
 
     QPushButton *closeButton = new QPushButton( qtr( "Close" ) );
     ui.buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
 
+
     showScheduleWidget( QVLM_Broadcast );
 
     /* Connect the comboBox to show the right Widgets */
     showScheduleWidget( QVLM_Broadcast );
 
     /* Connect the comboBox to show the right Widgets */
@@ -143,6 +148,7 @@ VLMDialog::VLMDialog( QWidget *parent, intf_thread_t *_p_intf ) : QVLCDialog( pa
              this, selectVLMItem( int ) );
 
     BUTTONACT( closeButton, close() );
              this, selectVLMItem( int ) );
 
     BUTTONACT( closeButton, close() );
+    BUTTONACT( exportButton, exportVLMConf() );
     BUTTONACT( ui.addButton, addVLMItem() );
     BUTTONACT( ui.clearButton, clearWidgets() );
     BUTTONACT( ui.saveButton, saveModifications() );
     BUTTONACT( ui.addButton, addVLMItem() );
     BUTTONACT( ui.clearButton, clearWidgets() );
     BUTTONACT( ui.saveButton, saveModifications() );
@@ -245,6 +251,30 @@ void VLMDialog::addVLMItem()
     clearWidgets();
 }
 
     clearWidgets();
 }
 
+// FIXME : VOD are not exported to the file
+bool VLMDialog::exportVLMConf()
+{
+    QString saveVLMConfFileName = QFileDialog::getSaveFileName(
+            this, qtr( "Choose a filename to save the VLM configuration..." ),
+            qfu( p_intf->p_libvlc->psz_homedir ),
+            qtr( "VLM conf (*.vlm) ;; All (*.*)" ) );
+
+    if( !saveVLMConfFileName.isEmpty() )
+    {
+        vlm_message_t *message;
+        QString command = "save \"" + saveVLMConfFileName + "\"";
+        vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
+        vlm_MessageDelete( message );
+        return true;
+    }
+    return false;
+}
+
+// TODO : import configuration file
+bool VLMDialog::importVLMConf()
+{
+}
+
 void VLMDialog::clearWidgets()
 {
     ui.nameLedit->clear();
 void VLMDialog::clearWidgets()
 {
     ui.nameLedit->clear();
index 3fecdee..557b7ed 100644 (file)
@@ -109,6 +109,8 @@ private slots:
     void selectVLMItem( int );
     void selectInput();
     void selectOutput();
     void selectVLMItem( int );
     void selectInput();
     void selectOutput();
+    bool exportVLMConf();
+    bool importVLMConf();
 };
 
 class VLMWrapper
 };
 
 class VLMWrapper