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( const 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;
223 outputText.remove( ":sout=" );
228 typeShortName = "Bcast";
229 vlmAwidget = new VLMBroadcast( name, inputText, outputText,
230 b_checked, b_looped, this );
231 VLMWrapper::AddBroadcast( name, inputText, outputText, b_checked,
235 typeShortName = "VOD";
236 vlmAwidget = new VLMVod( name, inputText, outputText,
237 b_checked, ui.muxLedit->text(), this );
238 VLMWrapper::AddVod( name, inputText, outputText, b_checked );
241 typeShortName = "Sched";
242 vlmAwidget = new VLMSchedule( name, inputText, outputText,
243 schetime, schedate, repeatnum,
244 repeatdays, b_checked, this );
245 VLMWrapper::AddSchedule( name, inputText, outputText, schetime,
246 schedate, repeatnum, repeatdays, b_checked);
249 msg_Warn( p_intf, "Something bad happened" );
253 /* Add an Item of the Side List */
254 ui.vlmListItem->addItem( typeShortName + " : " + name );
255 ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );
257 /* Add a new VLMAWidget on the main List */
259 vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
260 vlmItems.append( vlmAwidget );
264 /* TODO : VOD are not exported to the file */
265 bool VLMDialog::exportVLMConf()
267 QFileDialog* qfd = new QFileDialog( this, qtr( "Save VLM configuration as..." ),
268 qfu( config_GetHomeDir() ),
269 qtr( "VLM conf (*.vlm);;All (*)" ) );
270 qfd->setFileMode( QFileDialog::AnyFile );
271 qfd->setAcceptMode( QFileDialog::AcceptSave );
272 qfd->setConfirmOverwrite( true );
274 bool exported = false;
275 if( qfd->exec() == QDialog::Accepted )
277 QString saveVLMConfFileName = qfd->selectedFiles().first();
278 QString filter = qfd->selectedFilter();
280 // If *.vlm is selected, add .vlm at the end if needed
281 if( filter.contains( "VLM" ) && !saveVLMConfFileName.contains( ".vlm" ) )
282 saveVLMConfFileName.append( ".vlm" );
284 if( !saveVLMConfFileName.isEmpty() )
286 vlm_message_t *message;
287 QString command = "save \"" + saveVLMConfFileName + "\"";
288 vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
289 vlm_MessageDelete( message );
298 void VLMDialog::mediasPopulator()
303 QString typeShortName;
305 vlm_media_t ***ppp_dsc = (vlm_media_t ***)malloc( sizeof( vlm_media_t ) );
307 /* Get medias informations and numbers */
308 vlm_Control( p_vlm, VLM_GET_MEDIAS, ppp_dsc, &i_nMedias );
310 /* Loop on all of them */
311 for( int i = 0; i < i_nMedias; i++ )
313 VLMAWidget * vlmAwidget;
314 vlmItemCount = vlmItems.size();
316 QString mediaName = qfu( (*ppp_dsc)[i]->psz_name );
317 /* It may have several inputs, we take the first one by default
318 - an evolution will be to manage these inputs in the gui */
319 QString inputText = qfu( (*ppp_dsc)[i]->ppsz_input[0] );
321 QString outputText = qfu( (*ppp_dsc)[i]->psz_output );
323 /* Schedule media is a quite especial, maybe there is another way to grab informations */
324 if( (*ppp_dsc)[i]->b_vod )
326 typeShortName = "VOD";
327 QString mux = qfu( (*ppp_dsc)[i]->vod.psz_mux );
328 vlmAwidget = new VLMVod( mediaName, inputText, outputText,
329 (*ppp_dsc)[i]->b_enabled, mux, this );
333 typeShortName = "Bcast";
334 vlmAwidget = new VLMBroadcast( mediaName, inputText, outputText,
335 (*ppp_dsc)[i]->b_enabled, (*ppp_dsc)[i]->broadcast.b_loop, this );
337 /* Add an Item of the Side List */
338 ui.vlmListItem->addItem( typeShortName + " : " + mediaName );
339 ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );
341 /* Add a new VLMAWidget on the main List */
342 vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
343 vlmItems.append( vlmAwidget );
350 bool VLMDialog::importVLMConf()
352 QString openVLMConfFileName = QFileDialog::getOpenFileName(
353 this, qtr( "Open VLM configuration..." ),
354 qfu( config_GetHomeDir() ),
355 qtr( "VLM conf (*.vlm);;All (*)" ) );
357 if( !openVLMConfFileName.isEmpty() )
359 vlm_message_t *message;
361 QString command = "load \"" + openVLMConfFileName + "\"";
362 status = vlm_ExecuteCommand( p_vlm, qtu( command ) , &message );
363 vlm_MessageDelete( message );
370 msg_Warn( p_intf, "Failed to import vlm configuration file : %s", qtu( command ) );
378 void VLMDialog::clearWidgets()
380 ui.nameLedit->clear();
381 ui.inputLedit->clear();
382 ui.outputLedit->clear();
383 time->setTime( QTime::currentTime() );
384 date->setDate( QDate::currentDate() );
385 ui.enableCheck->setChecked( true );
386 ui.nameLedit->setReadOnly( false );
387 ui.loopBCast->setChecked( false );
388 ui.muxLedit->clear();
389 ui.saveButton->hide();
390 ui.addButton->show();
393 void VLMDialog::selectInput()
395 OpenDialog *o = OpenDialog::getInstance( this, p_intf, false, SELECT, true );
397 ui.inputLedit->setText( o->getMRL() );
400 void VLMDialog::selectOutput()
402 SoutDialog *s = new SoutDialog( this, p_intf );
403 if( s->exec() == QDialog::Accepted )
404 ui.outputLedit->setText( s->getMrl() );
407 /* Object Modification */
408 void VLMDialog::removeVLMItem( VLMAWidget *vlmObj )
410 int index = vlmItems.indexOf( vlmObj );
411 if( index < 0 ) return;
412 delete ui.vlmListItem->takeItem( index );
413 vlmItems.removeAt( index );
416 /* HERE BE DRAGONS VLM REQUEST */
419 void VLMDialog::startModifyVLMItem( VLMAWidget *vlmObj )
421 currentIndex = vlmItems.indexOf( vlmObj );
422 if( currentIndex < 0 ) return;
424 ui.vlmListItem->setCurrentRow( currentIndex );
425 ui.nameLedit->setText( vlmObj->name );
426 ui.inputLedit->setText( vlmObj->input );
427 ui.outputLedit->setText( vlmObj->output );
428 ui.enableCheck->setChecked( vlmObj->b_enabled );
430 switch( vlmObj->type )
433 ui.loopBCast->setChecked( (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped );
436 ui.muxLedit->setText( (qobject_cast<VLMVod *>(vlmObj))->mux );
439 time->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schetime );
440 date->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schedate );
444 ui.nameLedit->setReadOnly( true );
445 ui.addButton->hide();
446 ui.saveButton->show();
449 void VLMDialog::saveModifications()
451 VLMAWidget *vlmObj = vlmItems.at( currentIndex );
454 vlmObj->input = ui.inputLedit->text();
455 vlmObj->output = ui.outputLedit->text().remove( ":sout=" );
456 vlmObj->setChecked( ui.enableCheck->isChecked() );
457 vlmObj->b_enabled = ui.enableCheck->isChecked();
458 switch( vlmObj->type )
461 (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped = ui.loopBCast->isChecked();
464 (qobject_cast<VLMVod *>(vlmObj))->mux = ui.muxLedit->text();
467 (qobject_cast<VLMSchedule *>(vlmObj))->schetime = time->dateTime();
468 (qobject_cast<VLMSchedule *>(vlmObj))->schedate = date->dateTime();
469 (qobject_cast<VLMSchedule *>(vlmObj))->rNumber = scherepeatnumber->value();
470 (qobject_cast<VLMSchedule *>(vlmObj))->rDays = repeatDays->value();
479 /*********************************
480 * VLMAWidget - Abstract class
481 ********************************/
483 VLMAWidget::VLMAWidget( const QString& _name,
484 const QString& _input,
485 const QString& _output,
489 : QGroupBox( _name, _parent )
495 b_enabled = _enabled;
498 setCheckable( true );
499 setChecked( b_enabled );
501 objLayout = new QGridLayout( this );
502 setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum );
504 nameLabel = new QLabel;
505 objLayout->addWidget( nameLabel, 0, 0, 1, 4 );
507 /*QLabel *time = new QLabel( "--:--/--:--" );
508 objLayout->addWidget( time, 1, 3, 1, 2 );*/
510 QToolButton *modifyButton = new QToolButton;
511 modifyButton->setIcon( QIcon( QPixmap( ":/settings" ) ) );
512 objLayout->addWidget( modifyButton, 0, 5 );
514 QToolButton *deleteButton = new QToolButton;
515 deleteButton->setIcon( QIcon( QPixmap( ":/quit" ) ) );
516 objLayout->addWidget( deleteButton, 0, 6 );
518 BUTTONACT( modifyButton, modify() );
519 BUTTONACT( deleteButton, del() );
520 CONNECT( this, clicked( bool ), this, toggleEnabled( bool ) );
523 void VLMAWidget::modify()
525 parent->startModifyVLMItem( this );
528 void VLMAWidget::del()
530 parent->removeVLMItem( this );
533 void VLMAWidget::toggleEnabled( bool b_enable )
535 VLMWrapper::EnableItem( name, b_enable );
541 VLMBroadcast::VLMBroadcast( const QString& _name, const QString& _input,
542 const QString& _output, bool _enabled,
543 bool _looped, VLMDialog *_parent )
544 : VLMAWidget( _name, _input, _output,
545 _enabled, _parent, QVLM_Broadcast )
547 nameLabel->setText( qtr("Broadcast: ") + name );
548 type = QVLM_Broadcast;
551 playButton = new QToolButton;
552 playButton->setIcon( QIcon( QPixmap( ":/play" ) ) );
553 objLayout->addWidget( playButton, 1, 0 );
556 QToolButton *stopButton = new QToolButton;
557 stopButton->setIcon( QIcon( QPixmap( ":/stop_b" ) ) );
558 objLayout->addWidget( stopButton, 1, 1 );
560 loopButton = new QToolButton;
561 objLayout->addWidget( loopButton, 1, 2 );
563 BUTTONACT( playButton, togglePlayPause() );
564 BUTTONACT( stopButton, stop() );
565 BUTTONACT( loopButton, toggleLoop() );
570 void VLMBroadcast::update()
572 VLMWrapper::EditBroadcast( name, input, output, b_enabled, b_looped );
574 loopButton->setIcon( QIcon( QPixmap( ":/repeat_all" ) ) );
576 loopButton->setIcon( QIcon( QPixmap( ":/repeat_off" ) ) );
579 void VLMBroadcast::togglePlayPause()
583 VLMWrapper::ControlBroadcast( name, ControlBroadcastPause );
584 playButton->setIcon( QIcon( QPixmap( ":/pause_16px" ) ) );
588 VLMWrapper::ControlBroadcast( name, ControlBroadcastPlay );
589 playButton->setIcon( QIcon( QPixmap( ":/play_16px" ) ) );
591 b_playing = !b_playing;
594 void VLMBroadcast::toggleLoop()
596 b_enabled = !b_enabled;
600 void VLMBroadcast::stop()
602 VLMWrapper::ControlBroadcast( name, ControlBroadcastStop );
603 playButton->setIcon( QIcon( QPixmap( ":/play_16px" ) ) );
609 VLMSchedule::VLMSchedule( const QString& name, const QString& input,
610 const QString& output, QDateTime _schetime,
611 QDateTime _schedate, int _scherepeatnumber,
612 int _repeatDays, bool enabled, VLMDialog *parent )
613 : VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule )
615 nameLabel->setText( qtr("Schedule: ") + name );
616 schetime = _schetime;
617 schedate = _schedate;
618 rNumber = _scherepeatnumber;
620 type = QVLM_Schedule;
624 void VLMSchedule::update()
626 VLMWrapper::EditSchedule( name, input, output, schetime, schedate,
627 rNumber, rDays, b_enabled);
633 VLMVod::VLMVod( const QString& name, const QString& input, const QString& output,
634 bool enabled, const QString& _mux, VLMDialog *parent)
635 : VLMAWidget( name, input, output, enabled, parent, QVLM_VOD )
637 nameLabel->setText( qtr("VOD: ") + name );
640 muxLabel = new QLabel;
641 objLayout->addWidget( muxLabel, 1, 0 );
646 void VLMVod::update()
648 muxLabel->setText( mux );
649 VLMWrapper::EditVod( name, input, output, b_enabled, mux );
656 vlm_t * VLMWrapper::p_vlm = NULL;
658 VLMWrapper::VLMWrapper( vlm_t *_p_vlm )
663 VLMWrapper::~VLMWrapper()
668 void VLMWrapper::AddBroadcast( const QString& name, const QString& input,
669 const QString& output,
670 bool b_enabled, bool b_loop )
672 vlm_message_t *message;
673 QString command = "new \"" + name + "\" broadcast";
674 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
675 vlm_MessageDelete( message );
676 EditBroadcast( name, input, output, b_enabled, b_loop );
679 void VLMWrapper::EditBroadcast( const QString& name, const QString& input,
680 const QString& output,
681 bool b_enabled, bool b_loop )
683 vlm_message_t *message;
686 command = "setup \"" + name + "\" inputdel all";
687 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
688 vlm_MessageDelete( message );
689 command = "setup \"" + name + "\" input \"" + input + "\"";
690 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
691 vlm_MessageDelete( message );
692 if( !output.isEmpty() )
694 command = "setup \"" + name + "\" output \"" + output + "\"";
695 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
696 vlm_MessageDelete( message );
700 command = "setup \"" + name + "\" enabled";
701 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
702 vlm_MessageDelete( message );
706 command = "setup \"" + name + "\" loop";
707 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
708 vlm_MessageDelete( message );
712 void VLMWrapper::EnableItem( const QString& name, bool b_enable )
714 vlm_message_t *message;
715 QString command = "setup \"" + name + ( b_enable ? " enable" : " disable" );
716 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
717 vlm_MessageDelete( message );
720 void VLMWrapper::ControlBroadcast( const QString& name, int BroadcastStatus,
723 vlm_message_t *message;
725 QString command = "control \"" + name + "\"";
726 switch( BroadcastStatus )
728 case ControlBroadcastPlay:
731 case ControlBroadcastPause:
734 case ControlBroadcastStop:
737 case ControlBroadcastSeek:
738 command += " seek" + seek;
741 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
742 vlm_MessageDelete( message );
745 void VLMWrapper::AddVod( const QString& name, const QString& input,
746 const QString& output,
747 bool b_enabled, const QString& mux )
749 vlm_message_t *message;
750 QString command = "new \"" + name + "\" vod";
751 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
752 vlm_MessageDelete( message );
753 EditVod( name, input, output, b_enabled, mux );
756 void VLMWrapper::EditVod( const QString& name, const QString& input,
757 const QString& output,
761 vlm_message_t *message;
762 QString command = "setup \"" + name + "\" input \"" + input + "\"";
763 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
764 vlm_MessageDelete( message );
766 if( !output.isEmpty() )
768 command = "setup \"" + name + "\" output \"" + output + "\"";
769 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
770 vlm_MessageDelete( message );
775 command = "setup \"" + name + "\" enabled";
776 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
777 vlm_MessageDelete( message );
781 command = "setup \"" + name + "\" mux \"" + mux + "\"";
782 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
783 vlm_MessageDelete( message );
787 void VLMWrapper::AddSchedule( const QString& name, const QString& input,
788 const QString& output, QDateTime _schetime,
790 int _scherepeatnumber, int _repeatDays,
791 bool b_enabled, const QString& mux )
793 vlm_message_t *message;
794 QString command = "new \"" + name + "\" schedule";
795 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
796 vlm_MessageDelete( message );
797 EditSchedule( name, input, output, _schetime, _schedate,
798 _scherepeatnumber, _repeatDays, b_enabled, mux );
801 void VLMWrapper::EditSchedule( const QString& name, const QString& input,
802 const QString& output, QDateTime _schetime,
803 QDateTime _schedate, int _scherepeatnumber,
804 int _repeatDays, bool b_enabled,
807 vlm_message_t *message;
808 QString command = "setup \"" + name + "\" input \"" + input + "\"";
809 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
810 vlm_MessageDelete( message );
812 if( !output.isEmpty() )
814 command = "setup \"" + name + "\" output \"" + output + "\"";
815 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
816 vlm_MessageDelete( message );
821 command = "setup \"" + name + "\" enabled";
822 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
823 vlm_MessageDelete( message );
828 command = "setup \"" + name + "\" mux \"" + mux + "\"";
829 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
830 vlm_MessageDelete( message );
833 command = "setup \"" + name + "\" date \"" +
834 _schedate.toString( "yyyy/MM/dd" )+ "-" +
835 _schetime.toString( "hh:mm:ss" ) + "\"";
836 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
837 vlm_MessageDelete( message );
839 if( _scherepeatnumber > 0 )
841 command = "setup \"" + name + "\" repeat \"" + _scherepeatnumber + "\"";
842 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
843 vlm_MessageDelete( message );
846 if( _repeatDays > 0 )
848 command = "setup \"" + name + "\" period \"" + _repeatDays + "\"";
849 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
850 vlm_MessageDelete( message );
854 void VLMDialog::toggleVisible()
856 QList<VLMAWidget *>::iterator it;
857 for( it = vlmItems.begin(); it != vlmItems.end(); it++ )
859 VLMAWidget *item = *it;
864 ui.vlmListItem->clear();
866 QVLCDialog::toggleVisible();