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"
35 #include "util/qt_dirs.hpp"
39 #include <QVBoxLayout>
40 #include <QStackedWidget>
43 #include <QGridLayout>
46 #include <QToolButton>
48 #include <QPushButton>
49 #include <QHBoxLayout>
50 #include <QDateTimeEdit>
53 #include <QHeaderView>
54 #include <QScrollArea>
55 #include <QFileDialog>
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( N_("Broadcast"), QVLM_Broadcast );
77 ADDMEDIATYPES( N_("Schedule"), QVLM_Schedule );
78 ADDMEDIATYPES( N_("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( "I&mport" ) );
134 ui.buttonBox->addButton( importButton, QDialogButtonBox::ActionRole );
136 QPushButton *exportButton = new QPushButton( qtr( "E&xport" ) );
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() );
161 //readSettings( "VLM", QSize( 700, 500 ) );
164 VLMDialog::~VLMDialog()
168 //writeSettings( "VLM" );
169 /* TODO :you have to destroy vlm here to close
170 * but we shouldn't destroy vlm here in case somebody else wants it */
177 void VLMDialog::showScheduleWidget( int i )
179 ui.schedBox->setVisible( ( i == QVLM_Schedule ) );
180 ui.loopBCast->setVisible( ( i == QVLM_Broadcast ) );
181 ui.vodBox->setVisible( ( i == QVLM_VOD ) );
184 void VLMDialog::selectVLMItem( int i )
187 ui.vlmItemScroll->ensureWidgetVisible( vlmItems.at( i ) );
190 bool VLMDialog::isNameGenuine( const QString& name )
192 for( int i = 0; i < vlmItems.size(); i++ )
194 if( vlmItems.at( i )->name == name )
200 void VLMDialog::addVLMItem()
202 int vlmItemCount = vlmItems.size();
204 /* Take the name and Check it */
205 QString name = ui.nameLedit->text();
206 if( name.isEmpty() || !isNameGenuine( name ) )
208 msg_Err( p_intf, "VLM Name is empty or already exists, I can't do it" );
212 int type = ui.mediaType->itemData( ui.mediaType->currentIndex() ).toInt();
214 QString typeShortName;
215 QString inputText = ui.inputLedit->text();
216 QString outputText = ui.outputLedit->text();
217 bool b_checked = ui.enableCheck->isChecked();
218 bool b_looped = ui.loopBCast->isChecked();
219 QDateTime schetime = time->dateTime();
220 QDateTime schedate = date->dateTime();
221 int repeatnum = scherepeatnumber->value();
222 int repeatdays = repeatDays->value();
223 VLMAWidget * vlmAwidget;
224 outputText.remove( ":sout=" );
229 typeShortName = "Bcast";
230 vlmAwidget = new VLMBroadcast( name, inputText, outputText,
231 b_checked, b_looped, this );
232 VLMWrapper::AddBroadcast( name, inputText, outputText, b_checked,
236 typeShortName = "VOD";
237 vlmAwidget = new VLMVod( name, inputText, outputText,
238 b_checked, ui.muxLedit->text(), this );
239 VLMWrapper::AddVod( name, inputText, outputText, b_checked );
242 typeShortName = "Sched";
243 vlmAwidget = new VLMSchedule( name, inputText, outputText,
244 schetime, schedate, repeatnum,
245 repeatdays, b_checked, this );
246 VLMWrapper::AddSchedule( name, inputText, outputText, schetime,
247 schedate, repeatnum, repeatdays, b_checked);
250 msg_Warn( p_intf, "Something bad happened" );
254 /* Add an Item of the Side List */
255 ui.vlmListItem->addItem( typeShortName + " : " + name );
256 ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );
258 /* Add a new VLMAWidget on the main List */
260 vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
261 vlmItems.append( vlmAwidget );
265 /* TODO : VOD are not exported to the file */
266 bool VLMDialog::exportVLMConf()
268 QString saveVLMConfFileName = QFileDialog::getSaveFileName( this,
269 qtr( "Save VLM configuration as..." ),
270 QVLCUserDir( VLC_DOCUMENTS_DIR ),
271 qtr( "VLM conf (*.vlm);;All (*)" ) );
273 if( !saveVLMConfFileName.isEmpty() )
275 vlm_message_t *message;
276 QString command = "save \"" + saveVLMConfFileName + "\"";
277 vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
278 vlm_MessageDelete( message );
285 void VLMDialog::mediasPopulator()
290 QString typeShortName;
292 vlm_media_t ***ppp_dsc = (vlm_media_t ***)malloc( sizeof( vlm_media_t ) );
294 /* Get medias informations and numbers */
295 vlm_Control( p_vlm, VLM_GET_MEDIAS, ppp_dsc, &i_nMedias );
297 /* Loop on all of them */
298 for( int i = 0; i < i_nMedias; i++ )
300 VLMAWidget * vlmAwidget;
301 vlmItemCount = vlmItems.size();
303 QString mediaName = qfu( (*ppp_dsc)[i]->psz_name );
304 /* It may have several inputs, we take the first one by default
305 - an evolution will be to manage these inputs in the gui */
306 QString inputText = qfu( (*ppp_dsc)[i]->ppsz_input[0] );
308 QString outputText = qfu( (*ppp_dsc)[i]->psz_output );
310 /* Schedule media is a quite especial, maybe there is another way to grab informations */
311 if( (*ppp_dsc)[i]->b_vod )
313 typeShortName = "VOD";
314 QString mux = qfu( (*ppp_dsc)[i]->vod.psz_mux );
315 vlmAwidget = new VLMVod( mediaName, inputText, outputText,
316 (*ppp_dsc)[i]->b_enabled, mux, this );
320 typeShortName = "Bcast";
321 vlmAwidget = new VLMBroadcast( mediaName, inputText, outputText,
322 (*ppp_dsc)[i]->b_enabled, (*ppp_dsc)[i]->broadcast.b_loop, this );
324 /* Add an Item of the Side List */
325 ui.vlmListItem->addItem( typeShortName + " : " + mediaName );
326 ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );
328 /* Add a new VLMAWidget on the main List */
329 vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
330 vlmItems.append( vlmAwidget );
337 bool VLMDialog::importVLMConf()
339 QString openVLMConfFileName = toNativeSeparators(
340 QFileDialog::getOpenFileName(
341 this, qtr( "Open VLM configuration..." ),
342 QVLCUserDir( VLC_DOCUMENTS_DIR ),
343 qtr( "VLM conf (*.vlm);;All (*)" ) ) );
345 if( !openVLMConfFileName.isEmpty() )
347 vlm_message_t *message;
349 QString command = "load \"" + openVLMConfFileName + "\"";
350 status = vlm_ExecuteCommand( p_vlm, qtu( command ) , &message );
351 vlm_MessageDelete( message );
358 msg_Warn( p_intf, "Failed to import vlm configuration file : %s", qtu( command ) );
366 void VLMDialog::clearWidgets()
368 ui.nameLedit->clear();
369 ui.inputLedit->clear();
370 ui.outputLedit->clear();
371 time->setTime( QTime::currentTime() );
372 date->setDate( QDate::currentDate() );
373 ui.enableCheck->setChecked( true );
374 ui.nameLedit->setReadOnly( false );
375 ui.loopBCast->setChecked( false );
376 ui.muxLedit->clear();
377 ui.saveButton->hide();
378 ui.addButton->show();
381 void VLMDialog::selectInput()
383 OpenDialog *o = OpenDialog::getInstance( this, p_intf, false, SELECT, true );
385 ui.inputLedit->setText( o->getMRL() );
388 void VLMDialog::selectOutput()
390 SoutDialog *s = new SoutDialog( this, p_intf );
391 if( s->exec() == QDialog::Accepted )
392 ui.outputLedit->setText( s->getMrl() );
395 /* Object Modification */
396 void VLMDialog::removeVLMItem( VLMAWidget *vlmObj )
398 int index = vlmItems.indexOf( vlmObj );
399 if( index < 0 ) return;
400 delete ui.vlmListItem->takeItem( index );
401 vlmItems.removeAt( index );
404 /* HERE BE DRAGONS VLM REQUEST */
407 void VLMDialog::startModifyVLMItem( VLMAWidget *vlmObj )
409 currentIndex = vlmItems.indexOf( vlmObj );
410 if( currentIndex < 0 ) return;
412 ui.vlmListItem->setCurrentRow( currentIndex );
413 ui.nameLedit->setText( vlmObj->name );
414 ui.inputLedit->setText( vlmObj->input );
415 ui.outputLedit->setText( vlmObj->output );
416 ui.enableCheck->setChecked( vlmObj->b_enabled );
418 switch( vlmObj->type )
421 ui.loopBCast->setChecked( (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped );
424 ui.muxLedit->setText( (qobject_cast<VLMVod *>(vlmObj))->mux );
427 time->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schetime );
428 date->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schedate );
432 ui.nameLedit->setReadOnly( true );
433 ui.addButton->hide();
434 ui.saveButton->show();
437 void VLMDialog::saveModifications()
439 VLMAWidget *vlmObj = vlmItems.at( currentIndex );
442 vlmObj->input = ui.inputLedit->text();
443 vlmObj->output = ui.outputLedit->text().remove( ":sout=" );
444 vlmObj->setChecked( ui.enableCheck->isChecked() );
445 vlmObj->b_enabled = ui.enableCheck->isChecked();
446 switch( vlmObj->type )
449 (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped = ui.loopBCast->isChecked();
452 (qobject_cast<VLMVod *>(vlmObj))->mux = ui.muxLedit->text();
455 (qobject_cast<VLMSchedule *>(vlmObj))->schetime = time->dateTime();
456 (qobject_cast<VLMSchedule *>(vlmObj))->schedate = date->dateTime();
457 (qobject_cast<VLMSchedule *>(vlmObj))->rNumber = scherepeatnumber->value();
458 (qobject_cast<VLMSchedule *>(vlmObj))->rDays = repeatDays->value();
467 /*********************************
468 * VLMAWidget - Abstract class
469 ********************************/
471 VLMAWidget::VLMAWidget( const QString& _name,
472 const QString& _input,
473 const QString& _output,
477 : QGroupBox( _name, _parent )
483 b_enabled = _enabled;
486 setCheckable( true );
487 setChecked( b_enabled );
489 objLayout = new QGridLayout( this );
490 setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum );
492 nameLabel = new QLabel;
493 objLayout->addWidget( nameLabel, 0, 0, 1, 4 );
495 /*QLabel *time = new QLabel( "--:--/--:--" );
496 objLayout->addWidget( time, 1, 3, 1, 2 );*/
498 QToolButton *modifyButton = new QToolButton;
499 modifyButton->setIcon( QIcon( ":/menu/settings" ) );
500 objLayout->addWidget( modifyButton, 0, 5 );
502 QToolButton *deleteButton = new QToolButton;
503 deleteButton->setIcon( QIcon( ":/menu/quit" ) );
504 objLayout->addWidget( deleteButton, 0, 6 );
506 BUTTONACT( modifyButton, modify() );
507 BUTTONACT( deleteButton, del() );
508 CONNECT( this, clicked( bool ), this, toggleEnabled( bool ) );
511 void VLMAWidget::modify()
513 parent->startModifyVLMItem( this );
516 void VLMAWidget::del()
518 parent->removeVLMItem( this );
521 void VLMAWidget::toggleEnabled( bool b_enable )
523 VLMWrapper::EnableItem( name, b_enable );
529 VLMBroadcast::VLMBroadcast( const QString& _name, const QString& _input,
530 const QString& _output, bool _enabled,
531 bool _looped, VLMDialog *_parent )
532 : VLMAWidget( _name, _input, _output,
533 _enabled, _parent, QVLM_Broadcast )
535 nameLabel->setText( qtr("Broadcast: ") + name );
536 type = QVLM_Broadcast;
539 playButton = new QToolButton;
540 playButton->setIcon( QIcon( ":/menu/play" ) );
541 objLayout->addWidget( playButton, 1, 0 );
544 QToolButton *stopButton = new QToolButton;
545 stopButton->setIcon( QIcon( ":/toolbar/stop_b" ) );
546 objLayout->addWidget( stopButton, 1, 1 );
548 loopButton = new QToolButton;
549 objLayout->addWidget( loopButton, 1, 2 );
551 BUTTONACT( playButton, togglePlayPause() );
552 BUTTONACT( stopButton, stop() );
553 BUTTONACT( loopButton, toggleLoop() );
558 void VLMBroadcast::update()
560 VLMWrapper::EditBroadcast( name, input, output, b_enabled, b_looped );
562 loopButton->setIcon( QIcon( ":/buttons/playlist/repeat_all" ) );
564 loopButton->setIcon( QIcon( ":/buttons/playlist/repeat_off" ) );
567 void VLMBroadcast::togglePlayPause()
571 VLMWrapper::ControlBroadcast( name, ControlBroadcastPause );
572 playButton->setIcon( QIcon( ":/menu/pause" ) );
576 VLMWrapper::ControlBroadcast( name, ControlBroadcastPlay );
577 playButton->setIcon( QIcon( ":/menu/play" ) );
579 b_playing = !b_playing;
582 void VLMBroadcast::toggleLoop()
584 b_enabled = !b_enabled;
588 void VLMBroadcast::stop()
590 VLMWrapper::ControlBroadcast( name, ControlBroadcastStop );
591 playButton->setIcon( QIcon( ":/menu/play" ) );
597 VLMSchedule::VLMSchedule( const QString& name, const QString& input,
598 const QString& output, QDateTime _schetime,
599 QDateTime _schedate, int _scherepeatnumber,
600 int _repeatDays, bool enabled, VLMDialog *parent )
601 : VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule )
603 nameLabel->setText( qtr("Schedule: ") + name );
604 schetime = _schetime;
605 schedate = _schedate;
606 rNumber = _scherepeatnumber;
608 type = QVLM_Schedule;
612 void VLMSchedule::update()
614 VLMWrapper::EditSchedule( name, input, output, schetime, schedate,
615 rNumber, rDays, b_enabled);
621 VLMVod::VLMVod( const QString& name, const QString& input, const QString& output,
622 bool enabled, const QString& _mux, VLMDialog *parent)
623 : VLMAWidget( name, input, output, enabled, parent, QVLM_VOD )
625 nameLabel->setText( qtr("VOD: ") + name );
628 muxLabel = new QLabel;
629 objLayout->addWidget( muxLabel, 1, 0 );
634 void VLMVod::update()
636 muxLabel->setText( mux );
637 VLMWrapper::EditVod( name, input, output, b_enabled, mux );
644 vlm_t * VLMWrapper::p_vlm = NULL;
646 VLMWrapper::VLMWrapper( vlm_t *_p_vlm )
651 VLMWrapper::~VLMWrapper()
656 void VLMWrapper::AddBroadcast( const QString& name, const QString& input,
657 const QString& output,
658 bool b_enabled, bool b_loop )
660 vlm_message_t *message;
661 QString command = "new \"" + name + "\" broadcast";
662 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
663 vlm_MessageDelete( message );
664 EditBroadcast( name, input, output, b_enabled, b_loop );
667 void VLMWrapper::EditBroadcast( const QString& name, const QString& input,
668 const QString& output,
669 bool b_enabled, bool b_loop )
671 vlm_message_t *message;
674 command = "setup \"" + name + "\" inputdel all";
675 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
676 vlm_MessageDelete( message );
677 command = "setup \"" + name + "\" input \"" + input + "\"";
678 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
679 vlm_MessageDelete( message );
680 if( !output.isEmpty() )
682 command = "setup \"" + name + "\" output \"" + output + "\"";
683 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
684 vlm_MessageDelete( message );
688 command = "setup \"" + name + "\" enabled";
689 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
690 vlm_MessageDelete( message );
694 command = "setup \"" + name + "\" loop";
695 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
696 vlm_MessageDelete( message );
700 void VLMWrapper::EnableItem( const QString& name, bool b_enable )
702 vlm_message_t *message;
703 QString command = "setup \"" + name + ( b_enable ? " enable" : " disable" );
704 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
705 vlm_MessageDelete( message );
708 void VLMWrapper::ControlBroadcast( const QString& name, int BroadcastStatus,
711 vlm_message_t *message;
713 QString command = "control \"" + name + "\"";
714 switch( BroadcastStatus )
716 case ControlBroadcastPlay:
719 case ControlBroadcastPause:
722 case ControlBroadcastStop:
725 case ControlBroadcastSeek:
726 command += " seek" + seek;
729 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
730 vlm_MessageDelete( message );
733 void VLMWrapper::AddVod( const QString& name, const QString& input,
734 const QString& output,
735 bool b_enabled, const QString& mux )
737 vlm_message_t *message;
738 QString command = "new \"" + name + "\" vod";
739 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
740 vlm_MessageDelete( message );
741 EditVod( name, input, output, b_enabled, mux );
744 void VLMWrapper::EditVod( const QString& name, const QString& input,
745 const QString& output,
749 vlm_message_t *message;
750 QString command = "setup \"" + name + "\" input \"" + input + "\"";
751 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
752 vlm_MessageDelete( message );
754 if( !output.isEmpty() )
756 command = "setup \"" + name + "\" output \"" + output + "\"";
757 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
758 vlm_MessageDelete( message );
763 command = "setup \"" + name + "\" enabled";
764 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
765 vlm_MessageDelete( message );
769 command = "setup \"" + name + "\" mux \"" + mux + "\"";
770 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
771 vlm_MessageDelete( message );
775 void VLMWrapper::AddSchedule( const QString& name, const QString& input,
776 const QString& output, QDateTime _schetime,
778 int _scherepeatnumber, int _repeatDays,
779 bool b_enabled, const QString& mux )
781 vlm_message_t *message;
782 QString command = "new \"" + name + "\" schedule";
783 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
784 vlm_MessageDelete( message );
785 EditSchedule( name, input, output, _schetime, _schedate,
786 _scherepeatnumber, _repeatDays, b_enabled, mux );
789 void VLMWrapper::EditSchedule( const QString& name, const QString& input,
790 const QString& output, QDateTime _schetime,
791 QDateTime _schedate, int _scherepeatnumber,
792 int _repeatDays, bool b_enabled,
795 vlm_message_t *message;
796 QString command = "setup \"" + name + "\" input \"" + input + "\"";
797 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
798 vlm_MessageDelete( message );
800 if( !output.isEmpty() )
802 command = "setup \"" + name + "\" output \"" + output + "\"";
803 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
804 vlm_MessageDelete( message );
809 command = "setup \"" + name + "\" enabled";
810 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
811 vlm_MessageDelete( message );
816 command = "setup \"" + name + "\" mux \"" + mux + "\"";
817 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
818 vlm_MessageDelete( message );
821 command = "setup \"" + name + "\" date \"" +
822 _schedate.toString( "yyyy/MM/dd" )+ "-" +
823 _schetime.toString( "hh:mm:ss" ) + "\"";
824 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
825 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 );
834 if( _repeatDays > 0 )
836 command = "setup \"" + name + "\" period \"" + _repeatDays + "\"";
837 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
838 vlm_MessageDelete( message );
842 void VLMDialog::toggleVisible()
844 QList<VLMAWidget *>::iterator it;
845 for( it = vlmItems.begin(); it != vlmItems.end(); it++ )
847 VLMAWidget *item = *it;
852 ui.vlmListItem->clear();
854 QVLCDialog::toggleVisible();