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 QFileDialog* qfd = new QFileDialog( this, qtr( "Save VLM configuration as..." ),
269 qfu( config_GetHomeDir() ),
270 qtr( "VLM conf (*.vlm);;All (*)" ) );
271 qfd->setFileMode( QFileDialog::AnyFile );
272 qfd->setAcceptMode( QFileDialog::AcceptSave );
273 qfd->setConfirmOverwrite( true );
275 bool exported = false;
276 if( qfd->exec() == QDialog::Accepted )
278 QString saveVLMConfFileName = qfd->selectedFiles().first();
279 QString filter = qfd->selectedFilter();
281 // If *.vlm is selected, add .vlm at the end if needed
282 if( filter.contains( "VLM" ) && !saveVLMConfFileName.contains( ".vlm" ) )
283 saveVLMConfFileName.append( ".vlm" );
285 if( !saveVLMConfFileName.isEmpty() )
287 vlm_message_t *message;
288 QString command = "save \"" + saveVLMConfFileName + "\"";
289 vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
290 vlm_MessageDelete( message );
299 void VLMDialog::mediasPopulator()
304 QString typeShortName;
306 vlm_media_t ***ppp_dsc = (vlm_media_t ***)malloc( sizeof( vlm_media_t ) );
308 /* Get medias informations and numbers */
309 vlm_Control( p_vlm, VLM_GET_MEDIAS, ppp_dsc, &i_nMedias );
311 /* Loop on all of them */
312 for( int i = 0; i < i_nMedias; i++ )
314 VLMAWidget * vlmAwidget;
315 vlmItemCount = vlmItems.size();
317 QString mediaName = qfu( (*ppp_dsc)[i]->psz_name );
318 /* It may have several inputs, we take the first one by default
319 - an evolution will be to manage these inputs in the gui */
320 QString inputText = qfu( (*ppp_dsc)[i]->ppsz_input[0] );
322 QString outputText = qfu( (*ppp_dsc)[i]->psz_output );
324 /* Schedule media is a quite especial, maybe there is another way to grab informations */
325 if( (*ppp_dsc)[i]->b_vod )
327 typeShortName = "VOD";
328 QString mux = qfu( (*ppp_dsc)[i]->vod.psz_mux );
329 vlmAwidget = new VLMVod( mediaName, inputText, outputText,
330 (*ppp_dsc)[i]->b_enabled, mux, this );
334 typeShortName = "Bcast";
335 vlmAwidget = new VLMBroadcast( mediaName, inputText, outputText,
336 (*ppp_dsc)[i]->b_enabled, (*ppp_dsc)[i]->broadcast.b_loop, this );
338 /* Add an Item of the Side List */
339 ui.vlmListItem->addItem( typeShortName + " : " + mediaName );
340 ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );
342 /* Add a new VLMAWidget on the main List */
343 vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
344 vlmItems.append( vlmAwidget );
351 bool VLMDialog::importVLMConf()
353 QString openVLMConfFileName = toNativeSeparators(
354 QFileDialog::getOpenFileName(
355 this, qtr( "Open VLM configuration..." ),
356 qfu( config_GetHomeDir() ),
357 qtr( "VLM conf (*.vlm);;All (*)" ) ) );
359 if( !openVLMConfFileName.isEmpty() )
361 vlm_message_t *message;
363 QString command = "load \"" + openVLMConfFileName + "\"";
364 status = vlm_ExecuteCommand( p_vlm, qtu( command ) , &message );
365 vlm_MessageDelete( message );
372 msg_Warn( p_intf, "Failed to import vlm configuration file : %s", qtu( command ) );
380 void VLMDialog::clearWidgets()
382 ui.nameLedit->clear();
383 ui.inputLedit->clear();
384 ui.outputLedit->clear();
385 time->setTime( QTime::currentTime() );
386 date->setDate( QDate::currentDate() );
387 ui.enableCheck->setChecked( true );
388 ui.nameLedit->setReadOnly( false );
389 ui.loopBCast->setChecked( false );
390 ui.muxLedit->clear();
391 ui.saveButton->hide();
392 ui.addButton->show();
395 void VLMDialog::selectInput()
397 OpenDialog *o = OpenDialog::getInstance( this, p_intf, false, SELECT, true );
399 ui.inputLedit->setText( o->getMRL() );
402 void VLMDialog::selectOutput()
404 SoutDialog *s = new SoutDialog( this, p_intf );
405 if( s->exec() == QDialog::Accepted )
406 ui.outputLedit->setText( s->getMrl() );
409 /* Object Modification */
410 void VLMDialog::removeVLMItem( VLMAWidget *vlmObj )
412 int index = vlmItems.indexOf( vlmObj );
413 if( index < 0 ) return;
414 delete ui.vlmListItem->takeItem( index );
415 vlmItems.removeAt( index );
418 /* HERE BE DRAGONS VLM REQUEST */
421 void VLMDialog::startModifyVLMItem( VLMAWidget *vlmObj )
423 currentIndex = vlmItems.indexOf( vlmObj );
424 if( currentIndex < 0 ) return;
426 ui.vlmListItem->setCurrentRow( currentIndex );
427 ui.nameLedit->setText( vlmObj->name );
428 ui.inputLedit->setText( vlmObj->input );
429 ui.outputLedit->setText( vlmObj->output );
430 ui.enableCheck->setChecked( vlmObj->b_enabled );
432 switch( vlmObj->type )
435 ui.loopBCast->setChecked( (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped );
438 ui.muxLedit->setText( (qobject_cast<VLMVod *>(vlmObj))->mux );
441 time->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schetime );
442 date->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schedate );
446 ui.nameLedit->setReadOnly( true );
447 ui.addButton->hide();
448 ui.saveButton->show();
451 void VLMDialog::saveModifications()
453 VLMAWidget *vlmObj = vlmItems.at( currentIndex );
456 vlmObj->input = ui.inputLedit->text();
457 vlmObj->output = ui.outputLedit->text().remove( ":sout=" );
458 vlmObj->setChecked( ui.enableCheck->isChecked() );
459 vlmObj->b_enabled = ui.enableCheck->isChecked();
460 switch( vlmObj->type )
463 (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped = ui.loopBCast->isChecked();
466 (qobject_cast<VLMVod *>(vlmObj))->mux = ui.muxLedit->text();
469 (qobject_cast<VLMSchedule *>(vlmObj))->schetime = time->dateTime();
470 (qobject_cast<VLMSchedule *>(vlmObj))->schedate = date->dateTime();
471 (qobject_cast<VLMSchedule *>(vlmObj))->rNumber = scherepeatnumber->value();
472 (qobject_cast<VLMSchedule *>(vlmObj))->rDays = repeatDays->value();
481 /*********************************
482 * VLMAWidget - Abstract class
483 ********************************/
485 VLMAWidget::VLMAWidget( const QString& _name,
486 const QString& _input,
487 const QString& _output,
491 : QGroupBox( _name, _parent )
497 b_enabled = _enabled;
500 setCheckable( true );
501 setChecked( b_enabled );
503 objLayout = new QGridLayout( this );
504 setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum );
506 nameLabel = new QLabel;
507 objLayout->addWidget( nameLabel, 0, 0, 1, 4 );
509 /*QLabel *time = new QLabel( "--:--/--:--" );
510 objLayout->addWidget( time, 1, 3, 1, 2 );*/
512 QToolButton *modifyButton = new QToolButton;
513 modifyButton->setIcon( QIcon( QPixmap( ":/menu/settings" ) ) );
514 objLayout->addWidget( modifyButton, 0, 5 );
516 QToolButton *deleteButton = new QToolButton;
517 deleteButton->setIcon( QIcon( QPixmap( ":/menu/quit" ) ) );
518 objLayout->addWidget( deleteButton, 0, 6 );
520 BUTTONACT( modifyButton, modify() );
521 BUTTONACT( deleteButton, del() );
522 CONNECT( this, clicked( bool ), this, toggleEnabled( bool ) );
525 void VLMAWidget::modify()
527 parent->startModifyVLMItem( this );
530 void VLMAWidget::del()
532 parent->removeVLMItem( this );
535 void VLMAWidget::toggleEnabled( bool b_enable )
537 VLMWrapper::EnableItem( name, b_enable );
543 VLMBroadcast::VLMBroadcast( const QString& _name, const QString& _input,
544 const QString& _output, bool _enabled,
545 bool _looped, VLMDialog *_parent )
546 : VLMAWidget( _name, _input, _output,
547 _enabled, _parent, QVLM_Broadcast )
549 nameLabel->setText( qtr("Broadcast: ") + name );
550 type = QVLM_Broadcast;
553 playButton = new QToolButton;
554 playButton->setIcon( QIcon( QPixmap( ":/menu/play" ) ) );
555 objLayout->addWidget( playButton, 1, 0 );
558 QToolButton *stopButton = new QToolButton;
559 stopButton->setIcon( QIcon( QPixmap( ":/toolbar/stop_b" ) ) );
560 objLayout->addWidget( stopButton, 1, 1 );
562 loopButton = new QToolButton;
563 objLayout->addWidget( loopButton, 1, 2 );
565 BUTTONACT( playButton, togglePlayPause() );
566 BUTTONACT( stopButton, stop() );
567 BUTTONACT( loopButton, toggleLoop() );
572 void VLMBroadcast::update()
574 VLMWrapper::EditBroadcast( name, input, output, b_enabled, b_looped );
576 loopButton->setIcon( QIcon( QPixmap( ":/buttons/playlist/repeat_all" ) ) );
578 loopButton->setIcon( QIcon( QPixmap( ":/buttons/playlist/repeat_off" ) ) );
581 void VLMBroadcast::togglePlayPause()
585 VLMWrapper::ControlBroadcast( name, ControlBroadcastPause );
586 playButton->setIcon( QIcon( QPixmap( ":/menu/pause" ) ) );
590 VLMWrapper::ControlBroadcast( name, ControlBroadcastPlay );
591 playButton->setIcon( QIcon( QPixmap( ":/menu/play" ) ) );
593 b_playing = !b_playing;
596 void VLMBroadcast::toggleLoop()
598 b_enabled = !b_enabled;
602 void VLMBroadcast::stop()
604 VLMWrapper::ControlBroadcast( name, ControlBroadcastStop );
605 playButton->setIcon( QIcon( QPixmap( ":/menu/play" ) ) );
611 VLMSchedule::VLMSchedule( const QString& name, const QString& input,
612 const QString& output, QDateTime _schetime,
613 QDateTime _schedate, int _scherepeatnumber,
614 int _repeatDays, bool enabled, VLMDialog *parent )
615 : VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule )
617 nameLabel->setText( qtr("Schedule: ") + name );
618 schetime = _schetime;
619 schedate = _schedate;
620 rNumber = _scherepeatnumber;
622 type = QVLM_Schedule;
626 void VLMSchedule::update()
628 VLMWrapper::EditSchedule( name, input, output, schetime, schedate,
629 rNumber, rDays, b_enabled);
635 VLMVod::VLMVod( const QString& name, const QString& input, const QString& output,
636 bool enabled, const QString& _mux, VLMDialog *parent)
637 : VLMAWidget( name, input, output, enabled, parent, QVLM_VOD )
639 nameLabel->setText( qtr("VOD: ") + name );
642 muxLabel = new QLabel;
643 objLayout->addWidget( muxLabel, 1, 0 );
648 void VLMVod::update()
650 muxLabel->setText( mux );
651 VLMWrapper::EditVod( name, input, output, b_enabled, mux );
658 vlm_t * VLMWrapper::p_vlm = NULL;
660 VLMWrapper::VLMWrapper( vlm_t *_p_vlm )
665 VLMWrapper::~VLMWrapper()
670 void VLMWrapper::AddBroadcast( const QString& name, const QString& input,
671 const QString& output,
672 bool b_enabled, bool b_loop )
674 vlm_message_t *message;
675 QString command = "new \"" + name + "\" broadcast";
676 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
677 vlm_MessageDelete( message );
678 EditBroadcast( name, input, output, b_enabled, b_loop );
681 void VLMWrapper::EditBroadcast( const QString& name, const QString& input,
682 const QString& output,
683 bool b_enabled, bool b_loop )
685 vlm_message_t *message;
688 command = "setup \"" + name + "\" inputdel all";
689 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
690 vlm_MessageDelete( message );
691 command = "setup \"" + name + "\" input \"" + input + "\"";
692 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
693 vlm_MessageDelete( message );
694 if( !output.isEmpty() )
696 command = "setup \"" + name + "\" output \"" + output + "\"";
697 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
698 vlm_MessageDelete( message );
702 command = "setup \"" + name + "\" enabled";
703 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
704 vlm_MessageDelete( message );
708 command = "setup \"" + name + "\" loop";
709 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
710 vlm_MessageDelete( message );
714 void VLMWrapper::EnableItem( const QString& name, bool b_enable )
716 vlm_message_t *message;
717 QString command = "setup \"" + name + ( b_enable ? " enable" : " disable" );
718 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
719 vlm_MessageDelete( message );
722 void VLMWrapper::ControlBroadcast( const QString& name, int BroadcastStatus,
725 vlm_message_t *message;
727 QString command = "control \"" + name + "\"";
728 switch( BroadcastStatus )
730 case ControlBroadcastPlay:
733 case ControlBroadcastPause:
736 case ControlBroadcastStop:
739 case ControlBroadcastSeek:
740 command += " seek" + seek;
743 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
744 vlm_MessageDelete( message );
747 void VLMWrapper::AddVod( const QString& name, const QString& input,
748 const QString& output,
749 bool b_enabled, const QString& mux )
751 vlm_message_t *message;
752 QString command = "new \"" + name + "\" vod";
753 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
754 vlm_MessageDelete( message );
755 EditVod( name, input, output, b_enabled, mux );
758 void VLMWrapper::EditVod( const QString& name, const QString& input,
759 const QString& output,
763 vlm_message_t *message;
764 QString command = "setup \"" + name + "\" input \"" + input + "\"";
765 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
766 vlm_MessageDelete( message );
768 if( !output.isEmpty() )
770 command = "setup \"" + name + "\" output \"" + output + "\"";
771 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
772 vlm_MessageDelete( message );
777 command = "setup \"" + name + "\" enabled";
778 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
779 vlm_MessageDelete( message );
783 command = "setup \"" + name + "\" mux \"" + mux + "\"";
784 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
785 vlm_MessageDelete( message );
789 void VLMWrapper::AddSchedule( const QString& name, const QString& input,
790 const QString& output, QDateTime _schetime,
792 int _scherepeatnumber, int _repeatDays,
793 bool b_enabled, const QString& mux )
795 vlm_message_t *message;
796 QString command = "new \"" + name + "\" schedule";
797 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
798 vlm_MessageDelete( message );
799 EditSchedule( name, input, output, _schetime, _schedate,
800 _scherepeatnumber, _repeatDays, b_enabled, mux );
803 void VLMWrapper::EditSchedule( const QString& name, const QString& input,
804 const QString& output, QDateTime _schetime,
805 QDateTime _schedate, int _scherepeatnumber,
806 int _repeatDays, bool b_enabled,
809 vlm_message_t *message;
810 QString command = "setup \"" + name + "\" input \"" + input + "\"";
811 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
812 vlm_MessageDelete( message );
814 if( !output.isEmpty() )
816 command = "setup \"" + name + "\" output \"" + output + "\"";
817 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
818 vlm_MessageDelete( message );
823 command = "setup \"" + name + "\" enabled";
824 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
825 vlm_MessageDelete( message );
830 command = "setup \"" + name + "\" mux \"" + mux + "\"";
831 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
832 vlm_MessageDelete( message );
835 command = "setup \"" + name + "\" date \"" +
836 _schedate.toString( "yyyy/MM/dd" )+ "-" +
837 _schetime.toString( "hh:mm:ss" ) + "\"";
838 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
839 vlm_MessageDelete( message );
841 if( _scherepeatnumber > 0 )
843 command = "setup \"" + name + "\" repeat \"" + _scherepeatnumber + "\"";
844 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
845 vlm_MessageDelete( message );
848 if( _repeatDays > 0 )
850 command = "setup \"" + name + "\" period \"" + _repeatDays + "\"";
851 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
852 vlm_MessageDelete( message );
856 void VLMDialog::toggleVisible()
858 QList<VLMAWidget *>::iterator it;
859 for( it = vlmItems.begin(); it != vlmItems.end(); it++ )
861 VLMAWidget *item = *it;
866 ui.vlmListItem->clear();
868 QVLCDialog::toggleVisible();