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()
165 msg_Dbg( p_intf, "Destroying VLM Dialog" );
168 /* FIXME :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_Dbg( 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 // FIXME : VOD are not exported to the file
264 bool VLMDialog::exportVLMConf()
266 QString saveVLMConfFileName = QFileDialog::getSaveFileName(
267 this, qtr( "Choose a filename to save the VLM configuration..." ),
268 qfu( p_intf->p_libvlc->psz_homedir ),
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( "Choose a VLM configuration file to open..." ),
338 qfu( p_intf->p_libvlc->psz_homedir ),
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_Dbg( 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, 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 msg_Dbg( p_intf, "Type: %i", vlmObj->type );
409 ui.vlmListItem->setCurrentRow( currentIndex );
410 ui.nameLedit->setText( vlmObj->name );
411 ui.inputLedit->setText( vlmObj->input );
412 ui.outputLedit->setText( vlmObj->output );
413 ui.enableCheck->setChecked( vlmObj->b_enabled );
415 switch( vlmObj->type )
418 ui.loopBCast->setChecked( (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped );
421 ui.muxLedit->setText( (qobject_cast<VLMVod *>(vlmObj))->mux );
424 time->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schetime );
425 date->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schedate );
429 ui.nameLedit->setReadOnly( true );
430 ui.addButton->hide();
431 ui.saveButton->show();
434 void VLMDialog::saveModifications()
436 VLMAWidget *vlmObj = vlmItems.at( currentIndex );
439 vlmObj->input = ui.inputLedit->text();
440 vlmObj->output = ui.outputLedit->text();
441 vlmObj->setChecked( ui.enableCheck->isChecked() );
442 vlmObj->b_enabled = ui.enableCheck->isChecked();
443 switch( vlmObj->type )
446 (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped = ui.loopBCast->isChecked();
449 (qobject_cast<VLMVod *>(vlmObj))->mux = ui.muxLedit->text();
452 (qobject_cast<VLMSchedule *>(vlmObj))->schetime = time->dateTime();
453 (qobject_cast<VLMSchedule *>(vlmObj))->schedate = date->dateTime();
454 (qobject_cast<VLMSchedule *>(vlmObj))->rNumber = scherepeatnumber->value();
455 (qobject_cast<VLMSchedule *>(vlmObj))->rDays = repeatDays->value();
459 vlmObj->update(); /* It should call the correct function is VLMAWidget
460 is abstract, but I am far from sure... FIXME ? */
465 /*********************************
466 * VLMAWidget - Abstract class
467 ********************************/
469 VLMAWidget::VLMAWidget( QString _name,
475 : QGroupBox( _name, _parent )
481 b_enabled = _enabled;
484 setCheckable( true );
485 setChecked( b_enabled );
487 objLayout = new QGridLayout( this );
488 setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum );
490 nameLabel = new QLabel;
491 objLayout->addWidget( nameLabel, 0, 0, 1, 4 );
493 /*QLabel *time = new QLabel( "--:--/--:--" );
494 objLayout->addWidget( time, 1, 3, 1, 2 );*/
496 QToolButton *modifyButton = new QToolButton;
497 modifyButton->setIcon( QIcon( QPixmap( ":/pixmaps/menus_settings_16px.png" ) ) );
498 objLayout->addWidget( modifyButton, 0, 5 );
500 QToolButton *deleteButton = new QToolButton;
501 deleteButton->setIcon( QIcon( QPixmap( ":/pixmaps/menus_quit_16px.png" ) ) );
502 objLayout->addWidget( deleteButton, 0, 6 );
504 BUTTONACT( modifyButton, modify() );
505 BUTTONACT( deleteButton, del() );
506 CONNECT( this, clicked( bool ), this, toggleEnabled( bool ) );
509 void VLMAWidget::modify()
511 parent->startModifyVLMItem( this );
514 void VLMAWidget::del()
516 parent->removeVLMItem( this );
519 //FIXME, remove me before release
520 void VLMAWidget::enterEvent( QEvent *event )
525 void VLMAWidget::toggleEnabled( bool b_enable )
527 VLMWrapper::EnableItem( name, b_enable );
533 VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output,
534 bool _enabled, bool _looped, VLMDialog *_parent)
535 : VLMAWidget( _name, _input, _output,
536 _enabled, _parent, QVLM_Broadcast )
538 nameLabel->setText( "Broadcast: " + name );
539 type = QVLM_Broadcast;
542 playButton = new QToolButton;
543 playButton->setIcon( QIcon( QPixmap( ":/pixmaps/play_16px.png" ) ) );
544 objLayout->addWidget( playButton, 1, 0 );
547 QToolButton *stopButton = new QToolButton;
548 stopButton->setIcon( QIcon( QPixmap( ":/pixmaps/stop_16px.png" ) ) );
549 objLayout->addWidget( stopButton, 1, 1 );
551 loopButton = new QToolButton;
552 objLayout->addWidget( loopButton, 1, 2 );
554 BUTTONACT( playButton, togglePlayPause() );
555 BUTTONACT( stopButton, stop() );
556 BUTTONACT( loopButton, toggleLoop() );
561 void VLMBroadcast::update()
563 VLMWrapper::EditBroadcast( name, input, output, b_enabled, b_looped );
565 loopButton->setIcon( QIcon( QPixmap( ":/pixmaps/playlist_repeat_all.png" ) ) );
567 loopButton->setIcon( QIcon( QPixmap( ":/pixmaps/playlist_repeat_off.png" ) ) );
570 void VLMBroadcast::togglePlayPause()
572 if( b_playing = true )
574 VLMWrapper::ControlBroadcast( name, ControlBroadcastPause );
575 playButton->setIcon( QIcon( QPixmap( ":/pixmaps/pause_16px.png" ) ) );
579 VLMWrapper::ControlBroadcast( name, ControlBroadcastPlay );
580 playButton->setIcon( QIcon( QPixmap( ":/pixmaps/play_16px.png" ) ) );
582 b_playing = !b_playing;
585 void VLMBroadcast::toggleLoop()
587 b_enabled = !b_enabled;
591 void VLMBroadcast::stop()
593 VLMWrapper::ControlBroadcast( name, ControlBroadcastStop );
594 playButton->setIcon( QIcon( QPixmap( ":/pixmaps/play_16px.png" ) ) );
600 VLMSchedule::VLMSchedule( QString name, QString input, QString output,
601 QDateTime _schetime, QDateTime _schedate,
602 int _scherepeatnumber, int _repeatDays,
603 bool enabled, VLMDialog *parent )
604 : VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule )
606 nameLabel->setText( "Schedule: " + name );
607 schetime = _schetime;
608 schedate = _schedate;
609 rNumber = _scherepeatnumber;
611 type = QVLM_Schedule;
615 void VLMSchedule::update()
617 VLMWrapper::EditSchedule( name, input, output, schetime, schedate,
618 rNumber, rDays, b_enabled);
624 VLMVod::VLMVod( QString name, QString input, QString output,
625 bool enabled, QString _mux, VLMDialog *parent)
626 : VLMAWidget( name, input, output, enabled, parent, QVLM_VOD )
628 nameLabel->setText( "VOD:" + name );
631 muxLabel = new QLabel;
632 objLayout->addWidget( muxLabel, 1, 0 );
637 void VLMVod::update()
639 muxLabel->setText( mux );
640 VLMWrapper::EditVod( name, input, output, b_enabled, mux );
647 vlm_t * VLMWrapper::p_vlm = NULL;
649 VLMWrapper::VLMWrapper( vlm_t *_p_vlm )
654 VLMWrapper::~VLMWrapper()
659 void VLMWrapper::AddBroadcast( const QString name, QString input,
661 bool b_enabled, bool b_loop )
663 vlm_message_t *message;
664 QString command = "new \"" + name + "\" broadcast";
665 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
666 vlm_MessageDelete( message );
667 EditBroadcast( name, input, output, b_enabled, b_loop );
670 void VLMWrapper::EditBroadcast( const QString name, const QString input,
671 const QString output,
672 bool b_enabled, bool b_loop )
674 vlm_message_t *message;
677 command = "setup \"" + name + "\" inputdel all";
678 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
679 vlm_MessageDelete( message );
680 command = "setup \"" + name + "\" input \"" + input + "\"";
681 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
682 vlm_MessageDelete( message );
683 if( !output.isEmpty() )
685 command = "setup \"" + name + "\" output \"" + output + "\"";
686 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
687 vlm_MessageDelete( message );
691 command = "setup \"" + name + "\" enabled";
692 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
693 vlm_MessageDelete( message );
697 command = "setup \"" + name + "\" loop";
698 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
699 vlm_MessageDelete( message );
703 void VLMWrapper::EnableItem( const QString name, bool b_enable )
705 vlm_message_t *message;
706 QString command = "setup \"" + name + ( b_enable ? " enable" : " disable" );
709 void VLMWrapper::ControlBroadcast( const QString name, int BroadcastStatus,
712 vlm_message_t *message;
714 QString command = "control \"" + name;
715 switch( BroadcastStatus )
717 case ControlBroadcastPlay:
720 case ControlBroadcastPause:
723 case ControlBroadcastStop:
726 case ControlBroadcastSeek:
727 command += " seek" + seek;
730 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
731 vlm_MessageDelete( message );
734 void VLMWrapper::AddVod( const QString name, const QString input,
735 const QString output,
736 bool b_enabled, const QString mux )
738 vlm_message_t *message;
739 QString command = "new \"" + name + "\" vod";
740 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
741 vlm_MessageDelete( message );
742 EditVod( name, input, output, b_enabled, mux );
745 void VLMWrapper::EditVod( const QString name, const QString input,
746 const QString output,
750 vlm_message_t *message;
751 QString command = "setup \"" + name + "\" input \"" + input + "\"";
752 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
753 vlm_MessageDelete( message );
755 if( !output.isEmpty() )
757 command = "setup \"" + name + "\" output \"" + output + "\"";
758 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
759 vlm_MessageDelete( message );
764 command = "setup \"" + name + "\" enabled";
765 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
766 vlm_MessageDelete( message );
770 command = "setup \"" + name + "\" mux \"" + mux + "\"";
771 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
772 vlm_MessageDelete( message );
776 void VLMWrapper::AddSchedule( const QString name, const QString input,
777 const QString output, QDateTime _schetime,
779 int _scherepeatnumber, int _repeatDays,
780 bool b_enabled, const QString mux )
782 vlm_message_t *message;
783 QString command = "new \"" + name + "\" schedule";
784 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
785 vlm_MessageDelete( message );
786 EditSchedule( name, input, output, _schetime, _schedate,
787 _scherepeatnumber, _repeatDays, b_enabled, mux );
790 void VLMWrapper::EditSchedule( const QString name, const QString input,
791 const QString output, QDateTime _schetime,
792 QDateTime _schedate, int _scherepeatnumber,
793 int _repeatDays, bool b_enabled,
796 vlm_message_t *message;
797 QString command = "setup \"" + name + "\" input \"" + input + "\"";
798 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
799 vlm_MessageDelete( message );
801 if( !output.isEmpty() )
803 command = "setup \"" + name + "\" output \"" + output + "\"";
804 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
805 vlm_MessageDelete( message );
810 command = "setup \"" + name + "\" enabled";
811 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
812 vlm_MessageDelete( message );
817 command = "setup \"" + name + "\" mux \"" + mux + "\"";
818 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
819 vlm_MessageDelete( message );
822 command = "setup \"" + name + "\" date \"" +
823 _schedate.toString( "yyyy/MM/dd" )+ "-" +
824 _schetime.toString( "hh:mm:ss" ) + "\"";
825 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
826 vlm_MessageDelete( message );
827 if( _scherepeatnumber > 0 )
829 command = "setup \"" + name + "\" repeat \"" + _scherepeatnumber + "\"";
830 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
831 vlm_MessageDelete( message );