]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/vlm.cpp
qt4_vlm: fix #3938 (options must be removed from the input)
[vlc] / modules / gui / qt4 / dialogs / vlm.cpp
index 31b2a5be7844123e3644c607253a883771cd80ce..af8adea71e6b92769de1fa96dd5981f3c9959255 100644 (file)
@@ -55,9 +55,7 @@
 #include <QFileDialog>
 
 
-VLMDialog *VLMDialog::instance = NULL;
-
-VLMDialog::VLMDialog( QWidget *parent, intf_thread_t *_p_intf ) : QVLCDialog( parent, _p_intf )
+VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf )
 {
     p_vlm = vlm_New( p_intf );
 
@@ -267,7 +265,7 @@ bool VLMDialog::exportVLMConf()
 {
     QString saveVLMConfFileName = QFileDialog::getSaveFileName( this,
                                         qtr( "Save VLM configuration as..." ),
-                                        qfu( config_GetHomeDir() ),
+                                        QVLCUserDir( VLC_DOCUMENTS_DIR ),
                                         qtr( "VLM conf (*.vlm);;All (*)" ) );
 
     if( !saveVLMConfFileName.isEmpty() )
@@ -339,7 +337,7 @@ bool VLMDialog::importVLMConf()
     QString openVLMConfFileName = toNativeSeparators(
             QFileDialog::getOpenFileName(
             this, qtr( "Open VLM configuration..." ),
-            qfu( config_GetHomeDir() ),
+            QVLCUserDir( VLC_DOCUMENTS_DIR ),
             qtr( "VLM conf (*.vlm);;All (*)" ) ) );
 
     if( !openVLMConfFileName.isEmpty() )
@@ -496,11 +494,11 @@ VLMAWidget::VLMAWidget( const QString& _name,
     objLayout->addWidget( time, 1, 3, 1, 2 );*/
 
     QToolButton *modifyButton = new QToolButton;
-    modifyButton->setIcon( QIcon( QPixmap( ":/menu/settings" ) ) );
+    modifyButton->setIcon( QIcon( ":/menu/settings" ) );
     objLayout->addWidget( modifyButton, 0, 5 );
 
     QToolButton *deleteButton = new QToolButton;
-    deleteButton->setIcon( QIcon( QPixmap( ":/menu/quit" ) ) );
+    deleteButton->setIcon( QIcon( ":/menu/quit" ) );
     objLayout->addWidget( deleteButton, 0, 6 );
 
     BUTTONACT( modifyButton, modify() );
@@ -537,12 +535,12 @@ VLMBroadcast::VLMBroadcast( const QString& _name, const QString& _input,
     b_looped = _looped;
 
     playButton = new QToolButton;
-    playButton->setIcon( QIcon( QPixmap( ":/menu/play" ) ) );
+    playButton->setIcon( QIcon( ":/menu/play" ) );
     objLayout->addWidget( playButton, 1, 0 );
     b_playing = true;
 
     QToolButton *stopButton = new QToolButton;
-    stopButton->setIcon( QIcon( QPixmap( ":/toolbar/stop_b" ) ) );
+    stopButton->setIcon( QIcon( ":/toolbar/stop_b" ) );
     objLayout->addWidget( stopButton, 1, 1 );
 
     loopButton = new QToolButton;
@@ -559,9 +557,9 @@ void VLMBroadcast::update()
 {
     VLMWrapper::EditBroadcast( name, input, output, b_enabled, b_looped );
     if( b_looped )
-        loopButton->setIcon( QIcon( QPixmap( ":/buttons/playlist/repeat_all" ) ) );
+        loopButton->setIcon( QIcon( ":/buttons/playlist/repeat_all" ) );
     else
-        loopButton->setIcon( QIcon( QPixmap( ":/buttons/playlist/repeat_off" ) ) );
+        loopButton->setIcon( QIcon( ":/buttons/playlist/repeat_off" ) );
 }
 
 void VLMBroadcast::togglePlayPause()
@@ -569,12 +567,12 @@ void VLMBroadcast::togglePlayPause()
     if( b_playing )
     {
         VLMWrapper::ControlBroadcast( name, ControlBroadcastPause );
-        playButton->setIcon( QIcon( QPixmap( ":/menu/pause" ) ) );
+        playButton->setIcon( QIcon( ":/menu/pause" ) );
     }
     else
     {
         VLMWrapper::ControlBroadcast( name, ControlBroadcastPlay );
-        playButton->setIcon( QIcon( QPixmap( ":/menu/play" ) ) );
+        playButton->setIcon( QIcon( ":/menu/play" ) );
     }
     b_playing = !b_playing;
 }
@@ -588,7 +586,7 @@ void VLMBroadcast::toggleLoop()
 void VLMBroadcast::stop()
 {
     VLMWrapper::ControlBroadcast( name, ControlBroadcastStop );
-    playButton->setIcon( QIcon( QPixmap( ":/menu/play" ) ) );
+    playButton->setIcon( QIcon( ":/menu/play" ) );
 }
 
 /****************
@@ -674,9 +672,23 @@ void VLMWrapper::EditBroadcast( const QString& name, const QString& input,
     command = "setup \"" + name + "\" inputdel all";
     vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
     vlm_MessageDelete( message );
-    command = "setup \"" + name + "\" input \"" + input + "\"";
-    vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
-    vlm_MessageDelete( message );
+
+    if(!input.isEmpty())
+    {
+        QStringList inputs = input.split(":", QString::SkipEmptyParts);
+
+        command = "setup \"" + name + "\" input \"" + inputs[0].trimmed() + "\"";
+        vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+        vlm_MessageDelete( message );
+
+        for( int i = 1; i < inputs.size(); i++ )
+        {
+            command = "setup \"" + name + "\" option \"" + inputs[i].trimmed() + "\"";
+            vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+            vlm_MessageDelete( message );
+        }
+    }
+
     if( !output.isEmpty() )
     {
         command = "setup \"" + name + "\" output \"" + output + "\"";
@@ -747,9 +759,23 @@ void VLMWrapper::EditVod( const QString& name, const QString& input,
                           const QString& mux )
 {
     vlm_message_t *message;
-    QString command = "setup \"" + name + "\" input \"" + input + "\"";
-    vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
-    vlm_MessageDelete( message );
+    QString command;
+
+    if(!input.isEmpty())
+    {
+        QStringList inputs = input.split(":", QString::SkipEmptyParts);
+
+        command = "setup \"" + name + "\" input \"" + inputs[0].trimmed() + "\"";
+        vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+        vlm_MessageDelete( message );
+
+        for( int i = 1; i < inputs.size(); i++ )
+        {
+            command = "setup \"" + name + "\" option \"" + inputs[i].trimmed() + "\"";
+            vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+            vlm_MessageDelete( message );
+        }
+    }
 
     if( !output.isEmpty() )
     {
@@ -793,9 +819,23 @@ void VLMWrapper::EditSchedule( const QString& name, const QString& input,
                                const QString& mux )
 {
     vlm_message_t *message;
-    QString command = "setup \"" + name + "\" input \"" + input + "\"";
-    vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
-    vlm_MessageDelete( message );
+    QString command;
+
+    if(!input.isEmpty())
+    {
+        QStringList inputs = input.split(":", QString::SkipEmptyParts);
+
+        command = "setup \"" + name + "\" input \"" + inputs[0].trimmed() + "\"";
+        vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+        vlm_MessageDelete( message );
+
+        for( int i = 1; i < inputs.size(); i++ )
+        {
+            command = "setup \"" + name + "\" option \"" + inputs[i].trimmed() + "\"";
+            vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+            vlm_MessageDelete( message );
+        }
+    }
 
     if( !output.isEmpty() )
     {