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>
57 VLMDialog *VLMDialog::instance = NULL;
59 VLMDialog::VLMDialog( QWidget *parent, intf_thread_t *_p_intf ) : QVLCDialog( parent, _p_intf )
61 p_vlm = vlm_New( p_intf );
65 msg_Warn( p_intf, "Couldn't build VLM object ");
68 vlmWrapper = new VLMWrapper( p_vlm );
72 ui.saveButton->hide();
74 #define ADDMEDIATYPES( str, type ) ui.mediaType->addItem( qtr( str ), QVariant( type ) );
75 ADDMEDIATYPES( N_("Broadcast"), QVLM_Broadcast );
76 ADDMEDIATYPES( N_("Schedule"), QVLM_Schedule );
77 ADDMEDIATYPES( N_("Video On Demand ( VOD )"), QVLM_VOD );
81 QGridLayout *schetimelayout = new QGridLayout( ui.schedBox );
82 QLabel *schetimelabel = new QLabel( qtr( "Hours / Minutes / Seconds:" ) );
83 schetimelayout->addWidget( schetimelabel, 0, 0 );
84 QLabel *schedatelabel = new QLabel( qtr( "Day / Month / Year:" ) );
85 schetimelayout->addWidget( schedatelabel, 1, 0 );
86 QLabel *scherepeatLabel = new QLabel( qtr( "Repeat:" ) );
87 schetimelayout->addWidget( scherepeatLabel, 2, 0 );
88 QLabel *scherepeatTimeLabel = new QLabel( qtr( "Repeat delay:" ) );
89 schetimelayout->addWidget( scherepeatTimeLabel, 3, 0 );
91 time = new QDateTimeEdit( QTime::currentTime() );
92 time->setAlignment( Qt::AlignRight );
93 time->setDisplayFormat( "hh:mm:ss" );
94 schetimelayout->addWidget( time, 0, 1, 1, 3 );
96 date = new QDateTimeEdit( QDate::currentDate() );
97 date->setAlignment( Qt::AlignRight );
98 date->setCalendarPopup( true );
100 date->setDisplayFormat( "dd MM yyyy" );
102 date->setDisplayFormat( "dd MMMM yyyy" );
104 schetimelayout->addWidget( date, 1, 1, 1, 3 );
106 scherepeatnumber = new QSpinBox;
107 scherepeatnumber->setAlignment( Qt::AlignRight );
108 schetimelayout->addWidget( scherepeatnumber, 2, 1, 1, 3 );
110 repeatDays = new QSpinBox;
111 repeatDays->setAlignment( Qt::AlignRight );
112 schetimelayout->addWidget( repeatDays, 3, 1, 1, 1 );
113 repeatDays->setSuffix( qtr(" days") );
115 repeatTime = new QDateTimeEdit;
116 repeatTime->setAlignment( Qt::AlignRight );
117 schetimelayout->addWidget( repeatTime, 3, 2, 1, 2 );
118 repeatTime->setDisplayFormat( "hh:mm:ss" );
121 ui.vlmItemScroll->setFrameStyle( QFrame::NoFrame );
122 ui.vlmItemScroll->setWidgetResizable( true );
123 vlmItemWidget = new QWidget;
124 vlmItemLayout = new QVBoxLayout( vlmItemWidget );
125 vlmItemWidget->setLayout( vlmItemLayout );
126 ui.vlmItemScroll->setWidget( vlmItemWidget );
128 QSpacerItem *spacer =
129 new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
130 vlmItemLayout->addItem( spacer );
132 QPushButton *importButton = new QPushButton( qtr( "I&mport" ) );
133 ui.buttonBox->addButton( importButton, QDialogButtonBox::ActionRole );
135 QPushButton *exportButton = new QPushButton( qtr( "E&xport" ) );
136 ui.buttonBox->addButton( exportButton, QDialogButtonBox::ActionRole );
138 QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
139 ui.buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
142 showScheduleWidget( QVLM_Broadcast );
144 /* Connect the comboBox to show the right Widgets */
145 CONNECT( ui.mediaType, currentIndexChanged( int ),
146 this, showScheduleWidget( int ) );
148 /* Connect the leftList to show the good VLMItem */
149 CONNECT( ui.vlmListItem, currentRowChanged( int ),
150 this, selectVLMItem( int ) );
152 BUTTONACT( closeButton, close() );
153 BUTTONACT( exportButton, exportVLMConf() );
154 BUTTONACT( importButton, importVLMConf() );
155 BUTTONACT( ui.addButton, addVLMItem() );
156 BUTTONACT( ui.clearButton, clearWidgets() );
157 BUTTONACT( ui.saveButton, saveModifications() );
158 BUTTONACT( ui.inputButton, selectInput() );
159 BUTTONACT( ui.outputButton, selectOutput() );
160 //readSettings( "VLM", QSize( 700, 500 ) );
163 VLMDialog::~VLMDialog()
167 //writeSettings( "VLM" );
168 /* TODO :you have to destroy vlm here to close
169 * but we shouldn't destroy vlm here in case somebody else wants it */
176 void VLMDialog::showScheduleWidget( int i )
178 ui.schedBox->setVisible( ( i == QVLM_Schedule ) );
179 ui.loopBCast->setVisible( ( i == QVLM_Broadcast ) );
180 ui.vodBox->setVisible( ( i == QVLM_VOD ) );
183 void VLMDialog::selectVLMItem( int i )
186 ui.vlmItemScroll->ensureWidgetVisible( vlmItems.at( i ) );
189 bool VLMDialog::isNameGenuine( QString name )
191 for( int i = 0; i < vlmItems.size(); i++ )
193 if( vlmItems.at( i )->name == name )
199 void VLMDialog::addVLMItem()
201 int vlmItemCount = vlmItems.size();
203 /* Take the name and Check it */
204 QString name = ui.nameLedit->text();
205 if( name.isEmpty() || !isNameGenuine( name ) )
207 msg_Err( p_intf, "VLM Name is empty or already exists, I can't do it" );
211 int type = ui.mediaType->itemData( ui.mediaType->currentIndex() ).toInt();
213 QString typeShortName;
214 QString inputText = ui.inputLedit->text();
215 QString outputText = ui.outputLedit->text();
216 bool b_checked = ui.enableCheck->isChecked();
217 bool b_looped = ui.loopBCast->isChecked();
218 QDateTime schetime = time->dateTime();
219 QDateTime schedate = date->dateTime();
220 int repeatnum = scherepeatnumber->value();
221 int repeatdays = repeatDays->value();
222 VLMAWidget * vlmAwidget;
227 typeShortName = "Bcast";
228 vlmAwidget = new VLMBroadcast( name, inputText, outputText,
229 b_checked, b_looped, this );
230 VLMWrapper::AddBroadcast( name, inputText, outputText, b_checked,
234 typeShortName = "VOD";
235 vlmAwidget = new VLMVod( name, inputText, outputText,
236 b_checked, ui.muxLedit->text(), this );
237 VLMWrapper::AddVod( name, inputText, outputText, b_checked );
240 typeShortName = "Sched";
241 vlmAwidget = new VLMSchedule( name, inputText, outputText,
242 schetime, schedate, repeatnum,
243 repeatdays, b_checked, this );
244 VLMWrapper::AddSchedule( name, inputText, outputText, schetime,
245 schedate, repeatnum, repeatdays, b_checked);
248 msg_Warn( p_intf, "Something bad happened" );
252 /* Add an Item of the Side List */
253 ui.vlmListItem->addItem( typeShortName + " : " + name );
254 ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );
256 /* Add a new VLMAWidget on the main List */
258 vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
259 vlmItems.append( vlmAwidget );
263 /* TODO : VOD are not exported to the file */
264 bool VLMDialog::exportVLMConf()
266 QString saveVLMConfFileName = QFileDialog::getSaveFileName(
267 this, qtr( "Save VLM configuration as..." ),
268 qfu( config_GetHomeDir() ),
269 qtr( "VLM conf (*.vlm);;All (*)" ) );
271 if( !saveVLMConfFileName.isEmpty() )
273 vlm_message_t *message;
274 QString command = "save \"" + saveVLMConfFileName + "\"";
275 vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
276 vlm_MessageDelete( message );
282 void VLMDialog::mediasPopulator()
287 QString typeShortName;
289 vlm_media_t ***ppp_dsc = (vlm_media_t ***)malloc( sizeof( vlm_media_t ) );
291 /* Get medias informations and numbers */
292 vlm_Control( p_vlm, VLM_GET_MEDIAS, ppp_dsc, &i_nMedias );
294 /* Loop on all of them */
295 for( int i = 0; i < i_nMedias; i++ )
297 VLMAWidget * vlmAwidget;
298 vlmItemCount = vlmItems.size();
300 QString mediaName = qfu( (*ppp_dsc)[i]->psz_name );
301 /* It may have several inputs, we take the first one by default
302 - an evolution will be to manage these inputs in the gui */
303 QString inputText = qfu( (*ppp_dsc)[i]->ppsz_input[0] );
305 QString outputText = qfu( (*ppp_dsc)[i]->psz_output );
307 /* Schedule media is a quite especial, maybe there is another way to grab informations */
308 if( (*ppp_dsc)[i]->b_vod )
310 typeShortName = "VOD";
311 QString mux = qfu( (*ppp_dsc)[i]->vod.psz_mux );
312 vlmAwidget = new VLMVod( mediaName, inputText, outputText,
313 (*ppp_dsc)[i]->b_enabled, mux, this );
317 typeShortName = "Bcast";
318 vlmAwidget = new VLMBroadcast( mediaName, inputText, outputText,
319 (*ppp_dsc)[i]->b_enabled, (*ppp_dsc)[i]->broadcast.b_loop, this );
321 /* Add an Item of the Side List */
322 ui.vlmListItem->addItem( typeShortName + " : " + mediaName );
323 ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );
325 /* Add a new VLMAWidget on the main List */
326 vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
327 vlmItems.append( vlmAwidget );
334 bool VLMDialog::importVLMConf()
336 QString openVLMConfFileName = QFileDialog::getOpenFileName(
337 this, qtr( "Open VLM configuration..." ),
338 qfu( config_GetHomeDir() ),
339 qtr( "VLM conf (*.vlm);;All (*)" ) );
341 if( !openVLMConfFileName.isEmpty() )
343 vlm_message_t *message;
345 QString command = "load \"" + openVLMConfFileName + "\"";
346 status = vlm_ExecuteCommand( p_vlm, qtu( command ) , &message );
347 vlm_MessageDelete( message );
354 msg_Warn( p_intf, "Failed to import vlm configuration file : %s", qtu( command ) );
362 void VLMDialog::clearWidgets()
364 ui.nameLedit->clear();
365 ui.inputLedit->clear();
366 ui.outputLedit->clear();
367 time->setTime( QTime::currentTime() );
368 date->setDate( QDate::currentDate() );
369 ui.enableCheck->setChecked( true );
370 ui.nameLedit->setReadOnly( false );
371 ui.loopBCast->setChecked( false );
372 ui.muxLedit->clear();
373 ui.saveButton->hide();
374 ui.addButton->show();
377 void VLMDialog::selectInput()
379 OpenDialog *o = OpenDialog::getInstance( this, p_intf, false, SELECT, true );
381 ui.inputLedit->setText( o->getMRL() );
384 void VLMDialog::selectOutput()
386 SoutDialog *s = SoutDialog::getInstance( this, p_intf, false );
387 if( s->exec() == QDialog::Accepted )
388 ui.outputLedit->setText( s->getMrl() );
391 /* Object Modification */
392 void VLMDialog::removeVLMItem( VLMAWidget *vlmObj )
394 int index = vlmItems.indexOf( vlmObj );
395 if( index < 0 ) return;
396 delete ui.vlmListItem->takeItem( index );
397 vlmItems.removeAt( index );
400 /* HERE BE DRAGONS VLM REQUEST */
403 void VLMDialog::startModifyVLMItem( VLMAWidget *vlmObj )
405 currentIndex = vlmItems.indexOf( vlmObj );
406 if( currentIndex < 0 ) return;
408 ui.vlmListItem->setCurrentRow( currentIndex );
409 ui.nameLedit->setText( vlmObj->name );
410 ui.inputLedit->setText( vlmObj->input );
411 ui.outputLedit->setText( vlmObj->output );
412 ui.enableCheck->setChecked( vlmObj->b_enabled );
414 switch( vlmObj->type )
417 ui.loopBCast->setChecked( (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped );
420 ui.muxLedit->setText( (qobject_cast<VLMVod *>(vlmObj))->mux );
423 time->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schetime );
424 date->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schedate );
428 ui.nameLedit->setReadOnly( true );
429 ui.addButton->hide();
430 ui.saveButton->show();
433 void VLMDialog::saveModifications()
435 VLMAWidget *vlmObj = vlmItems.at( currentIndex );
438 vlmObj->input = ui.inputLedit->text();
439 vlmObj->output = ui.outputLedit->text();
440 vlmObj->setChecked( ui.enableCheck->isChecked() );
441 vlmObj->b_enabled = ui.enableCheck->isChecked();
442 switch( vlmObj->type )
445 (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped = ui.loopBCast->isChecked();
448 (qobject_cast<VLMVod *>(vlmObj))->mux = ui.muxLedit->text();
451 (qobject_cast<VLMSchedule *>(vlmObj))->schetime = time->dateTime();
452 (qobject_cast<VLMSchedule *>(vlmObj))->schedate = date->dateTime();
453 (qobject_cast<VLMSchedule *>(vlmObj))->rNumber = scherepeatnumber->value();
454 (qobject_cast<VLMSchedule *>(vlmObj))->rDays = repeatDays->value();
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( qtr("Broadcast: ") + name );
531 type = QVLM_Broadcast;
534 playButton = new QToolButton;
535 playButton->setIcon( QIcon( QPixmap( ":/play" ) ) );
536 objLayout->addWidget( playButton, 1, 0 );
539 QToolButton *stopButton = new QToolButton;
540 stopButton->setIcon( QIcon( QPixmap( ":/stop_b" ) ) );
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()
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( qtr("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( qtr("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" );
699 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
700 vlm_MessageDelete( message );
703 void VLMWrapper::ControlBroadcast( const QString name, int BroadcastStatus,
706 vlm_message_t *message;
708 QString command = "control \"" + name;
709 switch( BroadcastStatus )
711 case ControlBroadcastPlay:
714 case ControlBroadcastPause:
717 case ControlBroadcastStop:
720 case ControlBroadcastSeek:
721 command += " seek" + seek;
724 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
725 vlm_MessageDelete( message );
728 void VLMWrapper::AddVod( const QString name, const QString input,
729 const QString output,
730 bool b_enabled, const QString mux )
732 vlm_message_t *message;
733 QString command = "new \"" + name + "\" vod";
734 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
735 vlm_MessageDelete( message );
736 EditVod( name, input, output, b_enabled, mux );
739 void VLMWrapper::EditVod( const QString name, const QString input,
740 const QString output,
744 vlm_message_t *message;
745 QString command = "setup \"" + name + "\" input \"" + input + "\"";
746 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
747 vlm_MessageDelete( message );
749 if( !output.isEmpty() )
751 command = "setup \"" + name + "\" output \"" + output + "\"";
752 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
753 vlm_MessageDelete( message );
758 command = "setup \"" + name + "\" enabled";
759 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
760 vlm_MessageDelete( message );
764 command = "setup \"" + name + "\" mux \"" + mux + "\"";
765 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
766 vlm_MessageDelete( message );
770 void VLMWrapper::AddSchedule( const QString name, const QString input,
771 const QString output, QDateTime _schetime,
773 int _scherepeatnumber, int _repeatDays,
774 bool b_enabled, const QString mux )
776 vlm_message_t *message;
777 QString command = "new \"" + name + "\" schedule";
778 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
779 vlm_MessageDelete( message );
780 EditSchedule( name, input, output, _schetime, _schedate,
781 _scherepeatnumber, _repeatDays, b_enabled, mux );
784 void VLMWrapper::EditSchedule( const QString name, const QString input,
785 const QString output, QDateTime _schetime,
786 QDateTime _schedate, int _scherepeatnumber,
787 int _repeatDays, bool b_enabled,
790 vlm_message_t *message;
791 QString command = "setup \"" + name + "\" input \"" + input + "\"";
792 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
793 vlm_MessageDelete( message );
795 if( !output.isEmpty() )
797 command = "setup \"" + name + "\" output \"" + output + "\"";
798 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
799 vlm_MessageDelete( message );
804 command = "setup \"" + name + "\" enabled";
805 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
806 vlm_MessageDelete( message );
811 command = "setup \"" + name + "\" mux \"" + mux + "\"";
812 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
813 vlm_MessageDelete( message );
816 command = "setup \"" + name + "\" date \"" +
817 _schedate.toString( "yyyy/MM/dd" )+ "-" +
818 _schetime.toString( "hh:mm:ss" ) + "\"";
819 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
820 vlm_MessageDelete( message );
822 if( _scherepeatnumber > 0 )
824 command = "setup \"" + name + "\" repeat \"" + _scherepeatnumber + "\"";
825 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
826 vlm_MessageDelete( message );
829 if( _repeatDays > 0 )
831 command = "setup \"" + name + "\" period \"" + _repeatDays + "\"";
832 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
833 vlm_MessageDelete( message );