1 /*****************************************************************************
2 * vlm.cpp : VLM Management
3 ****************************************************************************
4 * Copyright © 2008 the VideoLAN team
7 * Authors: Jean-Baptiste Kempf <jb@videolan.org>
8 * Jean-François Massol <jf.massol -at- gmail.com>
9 * Clément Sténac <zorglub@videolan.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * ( at your option ) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
30 #include "dialogs/vlm.hpp"
33 #include "dialogs/open.hpp"
34 #include "dialogs/sout.hpp"
38 #include <QVBoxLayout>
39 #include <QStackedWidget>
42 #include <QGridLayout>
45 #include <QToolButton>
47 #include <QPushButton>
48 #include <QHBoxLayout>
49 #include <QDateTimeEdit>
52 #include <QHeaderView>
53 #include <QScrollArea>
54 #include <QFileDialog>
56 static const char *psz_type[] = { "Broadcast", "Schedule", "VOD" };
58 VLMDialog *VLMDialog::instance = NULL;
60 VLMDialog::VLMDialog( QWidget *parent, intf_thread_t *_p_intf ) : QVLCDialog( parent, _p_intf )
62 p_vlm = vlm_New( p_intf );
66 msg_Warn( p_intf, "Couldn't build VLM object ");
69 vlmWrapper = new VLMWrapper( p_vlm );
73 ui.saveButton->hide();
75 #define ADDMEDIATYPES( str, type ) ui.mediaType->addItem( qtr( str ), QVariant( type ) );
76 ADDMEDIATYPES( "Broadcast", QVLM_Broadcast );
77 ADDMEDIATYPES( "Schedule", QVLM_Schedule );
78 ADDMEDIATYPES( "Video On Demand ( VOD )", QVLM_VOD );
82 QGridLayout *schetimelayout = new QGridLayout( ui.schedBox );
83 QLabel *schetimelabel = new QLabel( qtr( "Hours / Minutes / Seconds:" ) );
84 schetimelayout->addWidget( schetimelabel, 0, 0 );
85 QLabel *schedatelabel = new QLabel( qtr( "Day / Month / Year:" ) );
86 schetimelayout->addWidget( schedatelabel, 1, 0 );
87 QLabel *scherepeatLabel = new QLabel( qtr( "Repeat:" ) );
88 schetimelayout->addWidget( scherepeatLabel, 2, 0 );
89 QLabel *scherepeatTimeLabel = new QLabel( qtr( "Repeat delay:" ) );
90 schetimelayout->addWidget( scherepeatTimeLabel, 3, 0 );
92 time = new QDateTimeEdit( QTime::currentTime() );
93 time->setAlignment( Qt::AlignRight );
94 time->setDisplayFormat( "hh:mm:ss" );
95 schetimelayout->addWidget( time, 0, 1, 1, 3 );
97 date = new QDateTimeEdit( QDate::currentDate() );
98 date->setAlignment( Qt::AlignRight );
99 date->setCalendarPopup( true );
101 date->setDisplayFormat( "dd MM yyyy" );
103 date->setDisplayFormat( "dd MMMM yyyy" );
105 schetimelayout->addWidget( date, 1, 1, 1, 3 );
107 scherepeatnumber = new QSpinBox;
108 scherepeatnumber->setAlignment( Qt::AlignRight );
109 schetimelayout->addWidget( scherepeatnumber, 2, 1, 1, 3 );
111 repeatDays = new QSpinBox;
112 repeatDays->setAlignment( Qt::AlignRight );
113 schetimelayout->addWidget( repeatDays, 3, 1, 1, 1 );
114 repeatDays->setSuffix( qtr(" days") );
116 repeatTime = new QDateTimeEdit;
117 repeatTime->setAlignment( Qt::AlignRight );
118 schetimelayout->addWidget( repeatTime, 3, 2, 1, 2 );
119 repeatTime->setDisplayFormat( "hh:mm:ss" );
122 ui.vlmItemScroll->setFrameStyle( QFrame::NoFrame );
123 ui.vlmItemScroll->setWidgetResizable( true );
124 vlmItemWidget = new QWidget;
125 vlmItemLayout = new QVBoxLayout( vlmItemWidget );
126 vlmItemWidget->setLayout( vlmItemLayout );
127 ui.vlmItemScroll->setWidget( vlmItemWidget );
129 QSpacerItem *spacer =
130 new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
131 vlmItemLayout->addItem( spacer );
133 QPushButton *importButton = new QPushButton( qtr( "Import" ) );
134 ui.buttonBox->addButton( importButton, QDialogButtonBox::ActionRole );
136 QPushButton *exportButton = new QPushButton( qtr( "Export" ) );
137 ui.buttonBox->addButton( exportButton, QDialogButtonBox::ActionRole );
139 QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
140 ui.buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
143 showScheduleWidget( QVLM_Broadcast );
145 /* Connect the comboBox to show the right Widgets */
146 CONNECT( ui.mediaType, currentIndexChanged( int ),
147 this, showScheduleWidget( int ) );
149 /* Connect the leftList to show the good VLMItem */
150 CONNECT( ui.vlmListItem, currentRowChanged( int ),
151 this, selectVLMItem( int ) );
153 BUTTONACT( closeButton, close() );
154 BUTTONACT( exportButton, exportVLMConf() );
155 BUTTONACT( importButton, importVLMConf() );
156 BUTTONACT( ui.addButton, addVLMItem() );
157 BUTTONACT( ui.clearButton, clearWidgets() );
158 BUTTONACT( ui.saveButton, saveModifications() );
159 BUTTONACT( ui.inputButton, selectInput() );
160 BUTTONACT( ui.outputButton, selectOutput() );
163 VLMDialog::~VLMDialog()
167 /* FIXME :you have to destroy vlm here to close
168 * but we shouldn't destroy vlm here in case somebody else wants it */
175 void VLMDialog::showScheduleWidget( int i )
177 ui.schedBox->setVisible( ( i == QVLM_Schedule ) );
178 ui.loopBCast->setVisible( ( i == QVLM_Broadcast ) );
179 ui.vodBox->setVisible( ( i == QVLM_VOD ) );
182 void VLMDialog::selectVLMItem( int i )
185 ui.vlmItemScroll->ensureWidgetVisible( vlmItems.at( i ) );
188 bool VLMDialog::isNameGenuine( QString name )
190 for( int i = 0; i < vlmItems.size(); i++ )
192 if( vlmItems.at( i )->name == name )
198 void VLMDialog::addVLMItem()
200 int vlmItemCount = vlmItems.size();
202 /* Take the name and Check it */
203 QString name = ui.nameLedit->text();
204 if( name.isEmpty() || !isNameGenuine( name ) )
206 msg_Err( p_intf, "VLM Name is empty or already exists, I can't do it" );
210 int type = ui.mediaType->itemData( ui.mediaType->currentIndex() ).toInt();
212 QString typeShortName;
213 QString inputText = ui.inputLedit->text();
214 QString outputText = ui.outputLedit->text();
215 bool b_checked = ui.enableCheck->isChecked();
216 bool b_looped = ui.loopBCast->isChecked();
217 QDateTime schetime = time->dateTime();
218 QDateTime schedate = date->dateTime();
219 int repeatnum = scherepeatnumber->value();
220 int repeatdays = repeatDays->value();
221 VLMAWidget * vlmAwidget;
226 typeShortName = "Bcast";
227 vlmAwidget = new VLMBroadcast( name, inputText, outputText,
228 b_checked, b_looped, this );
229 VLMWrapper::AddBroadcast( name, inputText, outputText, b_checked,
233 typeShortName = "VOD";
234 vlmAwidget = new VLMVod( name, inputText, outputText,
235 b_checked, ui.muxLedit->text(), this );
236 VLMWrapper::AddVod( name, inputText, outputText, b_checked );
239 typeShortName = "Sched";
240 vlmAwidget = new VLMSchedule( name, inputText, outputText,
241 schetime, schedate, repeatnum,
242 repeatdays, b_checked, this );
243 VLMWrapper::AddSchedule( name, inputText, outputText, schetime,
244 schedate, repeatnum, repeatdays, b_checked);
247 msg_Warn( p_intf, "Something bad happened" );
251 /* Add an Item of the Side List */
252 ui.vlmListItem->addItem( typeShortName + " : " + name );
253 ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );
255 /* Add a new VLMAWidget on the main List */
257 vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
258 vlmItems.append( vlmAwidget );
262 // FIXME : VOD are not exported to the file
263 bool VLMDialog::exportVLMConf()
265 QString saveVLMConfFileName = QFileDialog::getSaveFileName(
266 this, qtr( "Choose a filename to save the VLM configuration..." ),
267 qfu( config_GetHomeDir() ),
268 qtr( "VLM conf (*.vlm) ;; All (*.*)" ) );
270 if( !saveVLMConfFileName.isEmpty() )
272 vlm_message_t *message;
273 QString command = "save \"" + saveVLMConfFileName + "\"";
274 vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
275 vlm_MessageDelete( message );
281 void VLMDialog::mediasPopulator()
286 QString typeShortName;
288 vlm_media_t ***ppp_dsc = (vlm_media_t ***)malloc( sizeof( vlm_media_t ) );
290 /* Get medias informations and numbers */
291 vlm_Control( p_vlm, VLM_GET_MEDIAS, ppp_dsc, &i_nMedias );
293 /* Loop on all of them */
294 for( int i = 0; i < i_nMedias; i++ )
296 VLMAWidget * vlmAwidget;
297 vlmItemCount = vlmItems.size();
299 QString mediaName = qfu( (*ppp_dsc)[i]->psz_name );
300 /* It may have several inputs, we take the first one by default
301 - an evolution will be to manage these inputs in the gui */
302 QString inputText = qfu( (*ppp_dsc)[i]->ppsz_input[0] );
304 QString outputText = qfu( (*ppp_dsc)[i]->psz_output );
306 /* Schedule media is a quite especial, maybe there is another way to grab informations */
307 if( (*ppp_dsc)[i]->b_vod )
309 typeShortName = "VOD";
310 QString mux = qfu( (*ppp_dsc)[i]->vod.psz_mux );
311 vlmAwidget = new VLMVod( mediaName, inputText, outputText,
312 (*ppp_dsc)[i]->b_enabled, mux, this );
316 typeShortName = "Bcast";
317 vlmAwidget = new VLMBroadcast( mediaName, inputText, outputText,
318 (*ppp_dsc)[i]->b_enabled, (*ppp_dsc)[i]->broadcast.b_loop, this );
320 /* Add an Item of the Side List */
321 ui.vlmListItem->addItem( typeShortName + " : " + mediaName );
322 ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );
324 /* Add a new VLMAWidget on the main List */
325 vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
326 vlmItems.append( vlmAwidget );
333 bool VLMDialog::importVLMConf()
335 QString openVLMConfFileName = QFileDialog::getOpenFileName(
336 this, qtr( "Open a VLM Configuration File" ),
337 qfu( config_GetHomeDir() ),
338 qtr( "VLM conf (*.vlm) ;; All (*.*)" ) );
340 if( !openVLMConfFileName.isEmpty() )
342 vlm_message_t *message;
344 QString command = "load \"" + openVLMConfFileName + "\"";
345 status = vlm_ExecuteCommand( p_vlm, qtu( command ) , &message );
346 vlm_MessageDelete( message );
353 msg_Warn( p_intf, "Failed to import vlm configuration file : %s", qtu( command ) );
361 void VLMDialog::clearWidgets()
363 ui.nameLedit->clear();
364 ui.inputLedit->clear();
365 ui.outputLedit->clear();
366 time->setTime( QTime::currentTime() );
367 date->setDate( QDate::currentDate() );
368 ui.enableCheck->setChecked( true );
369 ui.nameLedit->setReadOnly( false );
370 ui.loopBCast->setChecked( false );
371 ui.muxLedit->clear();
372 ui.saveButton->hide();
373 ui.addButton->show();
376 void VLMDialog::selectInput()
378 OpenDialog *o = OpenDialog::getInstance( this, p_intf, false, SELECT, true );
380 ui.inputLedit->setText( o->getMRL() );
383 void VLMDialog::selectOutput()
385 SoutDialog *s = SoutDialog::getInstance( this, p_intf, false );
386 if( s->exec() == QDialog::Accepted )
387 ui.outputLedit->setText( s->getMrl() );
390 /* Object Modification */
391 void VLMDialog::removeVLMItem( VLMAWidget *vlmObj )
393 int index = vlmItems.indexOf( vlmObj );
394 if( index < 0 ) return;
395 delete ui.vlmListItem->takeItem( index );
396 vlmItems.removeAt( index );
399 /* HERE BE DRAGONS VLM REQUEST */
402 void VLMDialog::startModifyVLMItem( VLMAWidget *vlmObj )
404 currentIndex = vlmItems.indexOf( vlmObj );
405 if( currentIndex < 0 ) return;
407 ui.vlmListItem->setCurrentRow( currentIndex );
408 ui.nameLedit->setText( vlmObj->name );
409 ui.inputLedit->setText( vlmObj->input );
410 ui.outputLedit->setText( vlmObj->output );
411 ui.enableCheck->setChecked( vlmObj->b_enabled );
413 switch( vlmObj->type )
416 ui.loopBCast->setChecked( (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped );
419 ui.muxLedit->setText( (qobject_cast<VLMVod *>(vlmObj))->mux );
422 time->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schetime );
423 date->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schedate );
427 ui.nameLedit->setReadOnly( true );
428 ui.addButton->hide();
429 ui.saveButton->show();
432 void VLMDialog::saveModifications()
434 VLMAWidget *vlmObj = vlmItems.at( currentIndex );
437 vlmObj->input = ui.inputLedit->text();
438 vlmObj->output = ui.outputLedit->text();
439 vlmObj->setChecked( ui.enableCheck->isChecked() );
440 vlmObj->b_enabled = ui.enableCheck->isChecked();
441 switch( vlmObj->type )
444 (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped = ui.loopBCast->isChecked();
447 (qobject_cast<VLMVod *>(vlmObj))->mux = ui.muxLedit->text();
450 (qobject_cast<VLMSchedule *>(vlmObj))->schetime = time->dateTime();
451 (qobject_cast<VLMSchedule *>(vlmObj))->schedate = date->dateTime();
452 (qobject_cast<VLMSchedule *>(vlmObj))->rNumber = scherepeatnumber->value();
453 (qobject_cast<VLMSchedule *>(vlmObj))->rDays = repeatDays->value();
457 vlmObj->update(); /* It should call the correct function is VLMAWidget
458 is abstract, but I am far from sure... FIXME ? */
463 /*********************************
464 * VLMAWidget - Abstract class
465 ********************************/
467 VLMAWidget::VLMAWidget( QString _name,
473 : QGroupBox( _name, _parent )
479 b_enabled = _enabled;
482 setCheckable( true );
483 setChecked( b_enabled );
485 objLayout = new QGridLayout( this );
486 setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum );
488 nameLabel = new QLabel;
489 objLayout->addWidget( nameLabel, 0, 0, 1, 4 );
491 /*QLabel *time = new QLabel( "--:--/--:--" );
492 objLayout->addWidget( time, 1, 3, 1, 2 );*/
494 QToolButton *modifyButton = new QToolButton;
495 modifyButton->setIcon( QIcon( QPixmap( ":/settings" ) ) );
496 objLayout->addWidget( modifyButton, 0, 5 );
498 QToolButton *deleteButton = new QToolButton;
499 deleteButton->setIcon( QIcon( QPixmap( ":/quit" ) ) );
500 objLayout->addWidget( deleteButton, 0, 6 );
502 BUTTONACT( modifyButton, modify() );
503 BUTTONACT( deleteButton, del() );
504 CONNECT( this, clicked( bool ), this, toggleEnabled( bool ) );
507 void VLMAWidget::modify()
509 parent->startModifyVLMItem( this );
512 void VLMAWidget::del()
514 parent->removeVLMItem( this );
517 void VLMAWidget::toggleEnabled( bool b_enable )
519 VLMWrapper::EnableItem( name, b_enable );
525 VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output,
526 bool _enabled, bool _looped, VLMDialog *_parent)
527 : VLMAWidget( _name, _input, _output,
528 _enabled, _parent, QVLM_Broadcast )
530 nameLabel->setText( "Broadcast: " + name );
531 type = QVLM_Broadcast;
534 playButton = new QToolButton;
535 playButton->setIcon( QIcon( QPixmap( ":/play_16px" ) ) );
536 objLayout->addWidget( playButton, 1, 0 );
539 QToolButton *stopButton = new QToolButton;
540 stopButton->setIcon( QIcon( QPixmap( ":/stop_16px" ) ) );
541 objLayout->addWidget( stopButton, 1, 1 );
543 loopButton = new QToolButton;
544 objLayout->addWidget( loopButton, 1, 2 );
546 BUTTONACT( playButton, togglePlayPause() );
547 BUTTONACT( stopButton, stop() );
548 BUTTONACT( loopButton, toggleLoop() );
553 void VLMBroadcast::update()
555 VLMWrapper::EditBroadcast( name, input, output, b_enabled, b_looped );
557 loopButton->setIcon( QIcon( QPixmap( ":/repeat_all" ) ) );
559 loopButton->setIcon( QIcon( QPixmap( ":/repeat_off" ) ) );
562 void VLMBroadcast::togglePlayPause()
564 if( b_playing = true )
566 VLMWrapper::ControlBroadcast( name, ControlBroadcastPause );
567 playButton->setIcon( QIcon( QPixmap( ":/pause_16px" ) ) );
571 VLMWrapper::ControlBroadcast( name, ControlBroadcastPlay );
572 playButton->setIcon( QIcon( QPixmap( ":/play_16px" ) ) );
574 b_playing = !b_playing;
577 void VLMBroadcast::toggleLoop()
579 b_enabled = !b_enabled;
583 void VLMBroadcast::stop()
585 VLMWrapper::ControlBroadcast( name, ControlBroadcastStop );
586 playButton->setIcon( QIcon( QPixmap( ":/play_16px" ) ) );
592 VLMSchedule::VLMSchedule( QString name, QString input, QString output,
593 QDateTime _schetime, QDateTime _schedate,
594 int _scherepeatnumber, int _repeatDays,
595 bool enabled, VLMDialog *parent )
596 : VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule )
598 nameLabel->setText( "Schedule: " + name );
599 schetime = _schetime;
600 schedate = _schedate;
601 rNumber = _scherepeatnumber;
603 type = QVLM_Schedule;
607 void VLMSchedule::update()
609 VLMWrapper::EditSchedule( name, input, output, schetime, schedate,
610 rNumber, rDays, b_enabled);
616 VLMVod::VLMVod( QString name, QString input, QString output,
617 bool enabled, QString _mux, VLMDialog *parent)
618 : VLMAWidget( name, input, output, enabled, parent, QVLM_VOD )
620 nameLabel->setText( "VOD:" + name );
623 muxLabel = new QLabel;
624 objLayout->addWidget( muxLabel, 1, 0 );
629 void VLMVod::update()
631 muxLabel->setText( mux );
632 VLMWrapper::EditVod( name, input, output, b_enabled, mux );
639 vlm_t * VLMWrapper::p_vlm = NULL;
641 VLMWrapper::VLMWrapper( vlm_t *_p_vlm )
646 VLMWrapper::~VLMWrapper()
651 void VLMWrapper::AddBroadcast( const QString name, QString input,
653 bool b_enabled, bool b_loop )
655 vlm_message_t *message;
656 QString command = "new \"" + name + "\" broadcast";
657 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
658 vlm_MessageDelete( message );
659 EditBroadcast( name, input, output, b_enabled, b_loop );
662 void VLMWrapper::EditBroadcast( const QString name, const QString input,
663 const QString output,
664 bool b_enabled, bool b_loop )
666 vlm_message_t *message;
669 command = "setup \"" + name + "\" inputdel all";
670 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
671 vlm_MessageDelete( message );
672 command = "setup \"" + name + "\" input \"" + input + "\"";
673 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
674 vlm_MessageDelete( message );
675 if( !output.isEmpty() )
677 command = "setup \"" + name + "\" output \"" + output + "\"";
678 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
679 vlm_MessageDelete( message );
683 command = "setup \"" + name + "\" enabled";
684 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
685 vlm_MessageDelete( message );
689 command = "setup \"" + name + "\" loop";
690 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
691 vlm_MessageDelete( message );
695 void VLMWrapper::EnableItem( const QString name, bool b_enable )
697 vlm_message_t *message;
698 QString command = "setup \"" + name + ( b_enable ? " enable" : " disable" );
701 void VLMWrapper::ControlBroadcast( const QString name, int BroadcastStatus,
704 vlm_message_t *message;
706 QString command = "control \"" + name;
707 switch( BroadcastStatus )
709 case ControlBroadcastPlay:
712 case ControlBroadcastPause:
715 case ControlBroadcastStop:
718 case ControlBroadcastSeek:
719 command += " seek" + seek;
722 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
723 vlm_MessageDelete( message );
726 void VLMWrapper::AddVod( const QString name, const QString input,
727 const QString output,
728 bool b_enabled, const QString mux )
730 vlm_message_t *message;
731 QString command = "new \"" + name + "\" vod";
732 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
733 vlm_MessageDelete( message );
734 EditVod( name, input, output, b_enabled, mux );
737 void VLMWrapper::EditVod( const QString name, const QString input,
738 const QString output,
742 vlm_message_t *message;
743 QString command = "setup \"" + name + "\" input \"" + input + "\"";
744 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
745 vlm_MessageDelete( message );
747 if( !output.isEmpty() )
749 command = "setup \"" + name + "\" output \"" + output + "\"";
750 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
751 vlm_MessageDelete( message );
756 command = "setup \"" + name + "\" enabled";
757 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
758 vlm_MessageDelete( message );
762 command = "setup \"" + name + "\" mux \"" + mux + "\"";
763 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
764 vlm_MessageDelete( message );
768 void VLMWrapper::AddSchedule( const QString name, const QString input,
769 const QString output, QDateTime _schetime,
771 int _scherepeatnumber, int _repeatDays,
772 bool b_enabled, const QString mux )
774 vlm_message_t *message;
775 QString command = "new \"" + name + "\" schedule";
776 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
777 vlm_MessageDelete( message );
778 EditSchedule( name, input, output, _schetime, _schedate,
779 _scherepeatnumber, _repeatDays, b_enabled, mux );
782 void VLMWrapper::EditSchedule( const QString name, const QString input,
783 const QString output, QDateTime _schetime,
784 QDateTime _schedate, int _scherepeatnumber,
785 int _repeatDays, bool b_enabled,
788 vlm_message_t *message;
789 QString command = "setup \"" + name + "\" input \"" + input + "\"";
790 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
791 vlm_MessageDelete( message );
793 if( !output.isEmpty() )
795 command = "setup \"" + name + "\" output \"" + output + "\"";
796 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
797 vlm_MessageDelete( message );
802 command = "setup \"" + name + "\" enabled";
803 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
804 vlm_MessageDelete( message );
809 command = "setup \"" + name + "\" mux \"" + mux + "\"";
810 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
811 vlm_MessageDelete( message );
814 command = "setup \"" + name + "\" date \"" +
815 _schedate.toString( "yyyy/MM/dd" )+ "-" +
816 _schetime.toString( "hh:mm:ss" ) + "\"";
817 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
818 vlm_MessageDelete( message );
819 if( _scherepeatnumber > 0 )
821 command = "setup \"" + name + "\" repeat \"" + _scherepeatnumber + "\"";
822 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
823 vlm_MessageDelete( message );