+void VLMAWidget::toggleEnabled( bool b_enable )
+{
+ VLMWrapper::EnableItem( name, b_enable );
+}
+
+/****************
+ * VLMBroadcast
+ ****************/
+VLMBroadcast::VLMBroadcast( const QString& _name, const QString& _input,
+ const QString& _inputOptions,
+ const QString& _output, bool _enabled,
+ bool _looped, VLMDialog *_parent )
+ : VLMAWidget( _name, _input, _inputOptions, _output,
+ _enabled, _parent, QVLM_Broadcast )
+{
+ nameLabel->setText( qtr("Broadcast: ") + name );
+ type = QVLM_Broadcast;
+ b_looped = _looped;
+
+ playButton = new QToolButton;
+ playButton->setIcon( QIcon( ":/menu/play" ) );
+ objLayout->addWidget( playButton, 1, 0 );
+ b_playing = true;
+
+ QToolButton *stopButton = new QToolButton;
+ stopButton->setIcon( QIcon( ":/toolbar/stop_b" ) );
+ objLayout->addWidget( stopButton, 1, 1 );
+
+ loopButton = new QToolButton;
+ objLayout->addWidget( loopButton, 1, 2 );
+
+ BUTTONACT( playButton, togglePlayPause() );
+ BUTTONACT( stopButton, stop() );
+ BUTTONACT( loopButton, toggleLoop() );
+
+ update();
+}
+
+void VLMBroadcast::update()
+{
+ VLMWrapper::EditBroadcast( name, input, inputOptions, output, b_enabled, b_looped );
+ if( b_looped )
+ loopButton->setIcon( QIcon( ":/buttons/playlist/repeat_all" ) );
+ else
+ loopButton->setIcon( QIcon( ":/buttons/playlist/repeat_off" ) );
+}
+
+void VLMBroadcast::togglePlayPause()
+{
+ if( b_playing )
+ {
+ VLMWrapper::ControlBroadcast( name, ControlBroadcastPause );
+ playButton->setIcon( QIcon( ":/menu/pause" ) );
+ }
+ else
+ {
+ VLMWrapper::ControlBroadcast( name, ControlBroadcastPlay );
+ playButton->setIcon( QIcon( ":/menu/play" ) );
+ }
+ b_playing = !b_playing;
+}
+
+void VLMBroadcast::toggleLoop()
+{
+ b_enabled = !b_enabled;
+ update();
+}
+
+void VLMBroadcast::stop()
+{
+ VLMWrapper::ControlBroadcast( name, ControlBroadcastStop );
+ playButton->setIcon( QIcon( ":/menu/play" ) );
+}
+
+/****************
+ * VLMSchedule
+ ****************/
+VLMSchedule::VLMSchedule( const QString& name, const QString& input,
+ const QString& inputOptions,
+ const QString& output, QDateTime _schetime,
+ QDateTime _schedate, int _scherepeatnumber,
+ int _repeatDays, bool enabled, VLMDialog *parent )
+ : VLMAWidget( name, input, inputOptions, output, enabled, parent,
+ QVLM_Schedule )
+{
+ nameLabel->setText( qtr("Schedule: ") + name );
+ schetime = _schetime;
+ schedate = _schedate;
+ rNumber = _scherepeatnumber;
+ rDays = _repeatDays;
+ type = QVLM_Schedule;
+ update();
+}
+
+void VLMSchedule::update()
+{
+ VLMWrapper::EditSchedule( name, input, inputOptions, output, schetime, schedate,
+ rNumber, rDays, b_enabled);
+}
+
+/****************
+ * VLMVOD
+ ****************/
+VLMVod::VLMVod( const QString& name, const QString& input,
+ const QString& inputOptions, const QString& output,
+ bool enabled, const QString& _mux, VLMDialog *parent)
+ : VLMAWidget( name, input, inputOptions, output, enabled, parent,
+ QVLM_VOD )
+{
+ nameLabel->setText( qtr("VOD: ") + name );
+
+ mux = _mux;
+ muxLabel = new QLabel;
+ objLayout->addWidget( muxLabel, 1, 0 );
+
+ update();
+}
+
+void VLMVod::update()
+{
+ muxLabel->setText( mux );
+ VLMWrapper::EditVod( name, input, inputOptions, output, b_enabled, mux );
+}
+
+
+/*******************
+ * VLMWrapper
+ *******************/
+vlm_t * VLMWrapper::p_vlm = NULL;
+
+VLMWrapper::VLMWrapper( vlm_t *_p_vlm )
+{
+ p_vlm = _p_vlm;
+}
+
+VLMWrapper::~VLMWrapper()
+{
+ p_vlm = NULL;
+}
+
+void VLMWrapper::AddBroadcast( const QString& name, const QString& input,
+ const QString& inputOptions, const QString& output,
+ bool b_enabled, bool b_loop )
+{
+ vlm_message_t *message;
+ QString command = "new \"" + name + "\" broadcast";
+ vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+ vlm_MessageDelete( message );
+ EditBroadcast( name, input, inputOptions, output, b_enabled, b_loop );
+}
+
+void VLMWrapper::EditBroadcast( const QString& name, const QString& input,
+ const QString& inputOptions, const QString& output,
+ bool b_enabled, bool b_loop )
+{
+ vlm_message_t *message;
+ QString command;
+
+ command = "setup \"" + name + "\" inputdel all";
+ vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+ vlm_MessageDelete( message );
+
+ if( !input.isEmpty() )
+ {
+ command = "setup \"" + name + "\" input \"" + input + "\"";
+ vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+ vlm_MessageDelete( message );
+
+ QStringList options = inputOptions.split( " :", QString::SkipEmptyParts );
+ for( int i = 0; i < options.size(); i++ )
+ {
+ command = "setup \"" + name + "\" option \"" + options[i].trimmed() + "\"";
+ vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+ vlm_MessageDelete( message );
+ }
+ }
+
+ if( !output.isEmpty() )
+ {
+ command = "setup \"" + name + "\" output \"" + output + "\"";
+ vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+ vlm_MessageDelete( message );
+ }
+ if( b_enabled )
+ {
+ command = "setup \"" + name + "\" enabled";
+ vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+ vlm_MessageDelete( message );
+ }
+ if( b_loop )
+ {
+ command = "setup \"" + name + "\" loop";
+ vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+ vlm_MessageDelete( message );
+ }
+}
+
+void VLMWrapper::EnableItem( const QString& name, bool b_enable )