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 = toNativeSeparator(
353 QFileDialog::getOpenFileName(
354 this, qtr( "Open VLM configuration..." ),
355 qfu( config_GetHomeDir() ),
356 qtr( "VLM conf (*.vlm);;All (*)" ) ) );
358 if( !openVLMConfFileName.isEmpty() )
360 vlm_message_t *message;
362 QString command = "load \"" + openVLMConfFileName + "\"";
363 status = vlm_ExecuteCommand( p_vlm, qtu( command ) , &message );
364 vlm_MessageDelete( message );
371 msg_Warn( p_intf, "Failed to import vlm configuration file : %s", qtu( command ) );
379 void VLMDialog::clearWidgets()
381 ui.nameLedit->clear();
382 ui.inputLedit->clear();
383 ui.outputLedit->clear();
384 time->setTime( QTime::currentTime() );
385 date->setDate( QDate::currentDate() );
386 ui.enableCheck->setChecked( true );
387 ui.nameLedit->setReadOnly( false );
388 ui.loopBCast->setChecked( false );
389 ui.muxLedit->clear();
390 ui.saveButton->hide();
391 ui.addButton->show();
394 void VLMDialog::selectInput()
396 OpenDialog *o = OpenDialog::getInstance( this, p_intf, false, SELECT, true );
398 ui.inputLedit->setText( o->getMRL() );
401 void VLMDialog::selectOutput()
403 SoutDialog *s = new SoutDialog( this, p_intf );
404 if( s->exec() == QDialog::Accepted )
405 ui.outputLedit->setText( s->getMrl() );
408 /* Object Modification */
409 void VLMDialog::removeVLMItem( VLMAWidget *vlmObj )
411 int index = vlmItems.indexOf( vlmObj );
412 if( index < 0 ) return;
413 delete ui.vlmListItem->takeItem( index );
414 vlmItems.removeAt( index );
417 /* HERE BE DRAGONS VLM REQUEST */
420 void VLMDialog::startModifyVLMItem( VLMAWidget *vlmObj )
422 currentIndex = vlmItems.indexOf( vlmObj );
423 if( currentIndex < 0 ) return;
425 ui.vlmListItem->setCurrentRow( currentIndex );
426 ui.nameLedit->setText( vlmObj->name );
427 ui.inputLedit->setText( vlmObj->input );
428 ui.outputLedit->setText( vlmObj->output );
429 ui.enableCheck->setChecked( vlmObj->b_enabled );
431 switch( vlmObj->type )
434 ui.loopBCast->setChecked( (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped );
437 ui.muxLedit->setText( (qobject_cast<VLMVod *>(vlmObj))->mux );
440 time->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schetime );
441 date->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schedate );
445 ui.nameLedit->setReadOnly( true );
446 ui.addButton->hide();
447 ui.saveButton->show();
450 void VLMDialog::saveModifications()
452 VLMAWidget *vlmObj = vlmItems.at( currentIndex );
455 vlmObj->input = ui.inputLedit->text();
456 vlmObj->output = ui.outputLedit->text().remove( ":sout=" );
457 vlmObj->setChecked( ui.enableCheck->isChecked() );
458 vlmObj->b_enabled = ui.enableCheck->isChecked();
459 switch( vlmObj->type )
462 (qobject_cast<VLMBroadcast *>(vlmObj))->b_looped = ui.loopBCast->isChecked();
465 (qobject_cast<VLMVod *>(vlmObj))->mux = ui.muxLedit->text();
468 (qobject_cast<VLMSchedule *>(vlmObj))->schetime = time->dateTime();
469 (qobject_cast<VLMSchedule *>(vlmObj))->schedate = date->dateTime();
470 (qobject_cast<VLMSchedule *>(vlmObj))->rNumber = scherepeatnumber->value();
471 (qobject_cast<VLMSchedule *>(vlmObj))->rDays = repeatDays->value();
480 /*********************************
481 * VLMAWidget - Abstract class
482 ********************************/
484 VLMAWidget::VLMAWidget( const QString& _name,
485 const QString& _input,
486 const QString& _output,
490 : QGroupBox( _name, _parent )
496 b_enabled = _enabled;
499 setCheckable( true );
500 setChecked( b_enabled );
502 objLayout = new QGridLayout( this );
503 setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum );
505 nameLabel = new QLabel;
506 objLayout->addWidget( nameLabel, 0, 0, 1, 4 );
508 /*QLabel *time = new QLabel( "--:--/--:--" );
509 objLayout->addWidget( time, 1, 3, 1, 2 );*/
511 QToolButton *modifyButton = new QToolButton;
512 modifyButton->setIcon( QIcon( QPixmap( ":/settings" ) ) );
513 objLayout->addWidget( modifyButton, 0, 5 );
515 QToolButton *deleteButton = new QToolButton;
516 deleteButton->setIcon( QIcon( QPixmap( ":/quit" ) ) );
517 objLayout->addWidget( deleteButton, 0, 6 );
519 BUTTONACT( modifyButton, modify() );
520 BUTTONACT( deleteButton, del() );
521 CONNECT( this, clicked( bool ), this, toggleEnabled( bool ) );
524 void VLMAWidget::modify()
526 parent->startModifyVLMItem( this );
529 void VLMAWidget::del()
531 parent->removeVLMItem( this );
534 void VLMAWidget::toggleEnabled( bool b_enable )
536 VLMWrapper::EnableItem( name, b_enable );
542 VLMBroadcast::VLMBroadcast( const QString& _name, const QString& _input,
543 const QString& _output, bool _enabled,
544 bool _looped, VLMDialog *_parent )
545 : VLMAWidget( _name, _input, _output,
546 _enabled, _parent, QVLM_Broadcast )
548 nameLabel->setText( qtr("Broadcast: ") + name );
549 type = QVLM_Broadcast;
552 playButton = new QToolButton;
553 playButton->setIcon( QIcon( QPixmap( ":/play" ) ) );
554 objLayout->addWidget( playButton, 1, 0 );
557 QToolButton *stopButton = new QToolButton;
558 stopButton->setIcon( QIcon( QPixmap( ":/stop_b" ) ) );
559 objLayout->addWidget( stopButton, 1, 1 );
561 loopButton = new QToolButton;
562 objLayout->addWidget( loopButton, 1, 2 );
564 BUTTONACT( playButton, togglePlayPause() );
565 BUTTONACT( stopButton, stop() );
566 BUTTONACT( loopButton, toggleLoop() );
571 void VLMBroadcast::update()
573 VLMWrapper::EditBroadcast( name, input, output, b_enabled, b_looped );
575 loopButton->setIcon( QIcon( QPixmap( ":/repeat_all" ) ) );
577 loopButton->setIcon( QIcon( QPixmap( ":/repeat_off" ) ) );
580 void VLMBroadcast::togglePlayPause()
584 VLMWrapper::ControlBroadcast( name, ControlBroadcastPause );
585 playButton->setIcon( QIcon( QPixmap( ":/pause_16px" ) ) );
589 VLMWrapper::ControlBroadcast( name, ControlBroadcastPlay );
590 playButton->setIcon( QIcon( QPixmap( ":/play_16px" ) ) );
592 b_playing = !b_playing;
595 void VLMBroadcast::toggleLoop()
597 b_enabled = !b_enabled;
601 void VLMBroadcast::stop()
603 VLMWrapper::ControlBroadcast( name, ControlBroadcastStop );
604 playButton->setIcon( QIcon( QPixmap( ":/play_16px" ) ) );
610 VLMSchedule::VLMSchedule( const QString& name, const QString& input,
611 const QString& output, QDateTime _schetime,
612 QDateTime _schedate, int _scherepeatnumber,
613 int _repeatDays, bool enabled, VLMDialog *parent )
614 : VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule )
616 nameLabel->setText( qtr("Schedule: ") + name );
617 schetime = _schetime;
618 schedate = _schedate;
619 rNumber = _scherepeatnumber;
621 type = QVLM_Schedule;
625 void VLMSchedule::update()
627 VLMWrapper::EditSchedule( name, input, output, schetime, schedate,
628 rNumber, rDays, b_enabled);
634 VLMVod::VLMVod( const QString& name, const QString& input, const QString& output,
635 bool enabled, const QString& _mux, VLMDialog *parent)
636 : VLMAWidget( name, input, output, enabled, parent, QVLM_VOD )
638 nameLabel->setText( qtr("VOD: ") + name );
641 muxLabel = new QLabel;
642 objLayout->addWidget( muxLabel, 1, 0 );
647 void VLMVod::update()
649 muxLabel->setText( mux );
650 VLMWrapper::EditVod( name, input, output, b_enabled, mux );
657 vlm_t * VLMWrapper::p_vlm = NULL;
659 VLMWrapper::VLMWrapper( vlm_t *_p_vlm )
664 VLMWrapper::~VLMWrapper()
669 void VLMWrapper::AddBroadcast( const QString& name, const QString& input,
670 const QString& output,
671 bool b_enabled, bool b_loop )
673 vlm_message_t *message;
674 QString command = "new \"" + name + "\" broadcast";
675 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
676 vlm_MessageDelete( message );
677 EditBroadcast( name, input, output, b_enabled, b_loop );
680 void VLMWrapper::EditBroadcast( const QString& name, const QString& input,
681 const QString& output,
682 bool b_enabled, bool b_loop )
684 vlm_message_t *message;
687 command = "setup \"" + name + "\" inputdel all";
688 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
689 vlm_MessageDelete( message );
690 command = "setup \"" + name + "\" input \"" + input + "\"";
691 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
692 vlm_MessageDelete( message );
693 if( !output.isEmpty() )
695 command = "setup \"" + name + "\" output \"" + output + "\"";
696 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
697 vlm_MessageDelete( message );
701 command = "setup \"" + name + "\" enabled";
702 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
703 vlm_MessageDelete( message );
707 command = "setup \"" + name + "\" loop";
708 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
709 vlm_MessageDelete( message );
713 void VLMWrapper::EnableItem( const QString& name, bool b_enable )
715 vlm_message_t *message;
716 QString command = "setup \"" + name + ( b_enable ? " enable" : " disable" );
717 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
718 vlm_MessageDelete( message );
721 void VLMWrapper::ControlBroadcast( const QString& name, int BroadcastStatus,
724 vlm_message_t *message;
726 QString command = "control \"" + name + "\"";
727 switch( BroadcastStatus )
729 case ControlBroadcastPlay:
732 case ControlBroadcastPause:
735 case ControlBroadcastStop:
738 case ControlBroadcastSeek:
739 command += " seek" + seek;
742 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
743 vlm_MessageDelete( message );
746 void VLMWrapper::AddVod( const QString& name, const QString& input,
747 const QString& output,
748 bool b_enabled, const QString& mux )
750 vlm_message_t *message;
751 QString command = "new \"" + name + "\" vod";
752 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
753 vlm_MessageDelete( message );
754 EditVod( name, input, output, b_enabled, mux );
757 void VLMWrapper::EditVod( const QString& name, const QString& input,
758 const QString& output,
762 vlm_message_t *message;
763 QString command = "setup \"" + name + "\" input \"" + input + "\"";
764 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
765 vlm_MessageDelete( message );
767 if( !output.isEmpty() )
769 command = "setup \"" + name + "\" output \"" + output + "\"";
770 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
771 vlm_MessageDelete( message );
776 command = "setup \"" + name + "\" enabled";
777 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
778 vlm_MessageDelete( message );
782 command = "setup \"" + name + "\" mux \"" + mux + "\"";
783 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
784 vlm_MessageDelete( message );
788 void VLMWrapper::AddSchedule( const QString& name, const QString& input,
789 const QString& output, QDateTime _schetime,
791 int _scherepeatnumber, int _repeatDays,
792 bool b_enabled, const QString& mux )
794 vlm_message_t *message;
795 QString command = "new \"" + name + "\" schedule";
796 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
797 vlm_MessageDelete( message );
798 EditSchedule( name, input, output, _schetime, _schedate,
799 _scherepeatnumber, _repeatDays, b_enabled, mux );
802 void VLMWrapper::EditSchedule( const QString& name, const QString& input,
803 const QString& output, QDateTime _schetime,
804 QDateTime _schedate, int _scherepeatnumber,
805 int _repeatDays, bool b_enabled,
808 vlm_message_t *message;
809 QString command = "setup \"" + name + "\" input \"" + input + "\"";
810 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
811 vlm_MessageDelete( message );
813 if( !output.isEmpty() )
815 command = "setup \"" + name + "\" output \"" + output + "\"";
816 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
817 vlm_MessageDelete( message );
822 command = "setup \"" + name + "\" enabled";
823 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
824 vlm_MessageDelete( message );
829 command = "setup \"" + name + "\" mux \"" + mux + "\"";
830 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
831 vlm_MessageDelete( message );
834 command = "setup \"" + name + "\" date \"" +
835 _schedate.toString( "yyyy/MM/dd" )+ "-" +
836 _schetime.toString( "hh:mm:ss" ) + "\"";
837 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
838 vlm_MessageDelete( message );
840 if( _scherepeatnumber > 0 )
842 command = "setup \"" + name + "\" repeat \"" + _scherepeatnumber + "\"";
843 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
844 vlm_MessageDelete( message );
847 if( _repeatDays > 0 )
849 command = "setup \"" + name + "\" period \"" + _repeatDays + "\"";
850 vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
851 vlm_MessageDelete( message );
855 void VLMDialog::toggleVisible()
857 QList<VLMAWidget *>::iterator it;
858 for( it = vlmItems.begin(); it != vlmItems.end(); it++ )
860 VLMAWidget *item = *it;
865 ui.vlmListItem->clear();
867 QVLCDialog::toggleVisible();