#ifdef ENABLE_VLM
#include "dialogs/open.hpp"
#include "dialogs/sout.hpp"
+#include "util/qt_dirs.hpp"
#include <QString>
#include <QComboBox>
#include <QFileDialog>
-VLMDialog *VLMDialog::instance = NULL;
-
-VLMDialog::VLMDialog( QWidget *parent, intf_thread_t *_p_intf ) : QVLCDialog( parent, _p_intf )
+VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf )
{
p_vlm = vlm_New( p_intf );
{
case QVLM_Broadcast:
typeShortName = "Bcast";
- vlmAwidget = new VLMBroadcast( name, inputText, outputText,
+ vlmAwidget = new VLMBroadcast( name, inputText, inputOptions, outputText,
b_checked, b_looped, this );
- VLMWrapper::AddBroadcast( name, inputText, outputText, b_checked,
+ VLMWrapper::AddBroadcast( name, inputText, inputOptions, outputText, b_checked,
b_looped );
break;
case QVLM_VOD:
typeShortName = "VOD";
- vlmAwidget = new VLMVod( name, inputText, outputText,
+ vlmAwidget = new VLMVod( name, inputText, inputOptions, outputText,
b_checked, ui.muxLedit->text(), this );
- VLMWrapper::AddVod( name, inputText, outputText, b_checked );
+ VLMWrapper::AddVod( name, inputText, inputOptions, outputText, b_checked );
break;
case QVLM_Schedule:
typeShortName = "Sched";
- vlmAwidget = new VLMSchedule( name, inputText, outputText,
+ vlmAwidget = new VLMSchedule( name, inputText, inputOptions, outputText,
schetime, schedate, repeatnum,
repeatdays, b_checked, this );
- VLMWrapper::AddSchedule( name, inputText, outputText, schetime,
+ VLMWrapper::AddSchedule( name, inputText, inputOptions, outputText, schetime,
schedate, repeatnum, repeatdays, b_checked);
break;
default:
/* TODO : VOD are not exported to the file */
bool VLMDialog::exportVLMConf()
{
- QFileDialog* qfd = new QFileDialog( this, qtr( "Save VLM configuration as..." ),
- qfu( config_GetHomeDir() ),
+ QString saveVLMConfFileName = QFileDialog::getSaveFileName( this,
+ qtr( "Save VLM configuration as..." ),
+ QVLCUserDir( VLC_DOCUMENTS_DIR ),
qtr( "VLM conf (*.vlm);;All (*)" ) );
- qfd->setFileMode( QFileDialog::AnyFile );
- qfd->setAcceptMode( QFileDialog::AcceptSave );
- qfd->setConfirmOverwrite( true );
- bool exported = false;
- if( qfd->exec() == QDialog::Accepted )
+ if( !saveVLMConfFileName.isEmpty() )
{
- QString saveVLMConfFileName = qfd->selectedFiles().first();
- QString filter = qfd->selectedFilter();
-
- // If *.vlm is selected, add .vlm at the end if needed
- if( filter.contains( "VLM" ) && !saveVLMConfFileName.contains( ".vlm" ) )
- saveVLMConfFileName.append( ".vlm" );
-
- if( !saveVLMConfFileName.isEmpty() )
- {
- vlm_message_t *message;
- QString command = "save \"" + saveVLMConfFileName + "\"";
- vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
- vlm_MessageDelete( message );
- exported = true;
- }
+ vlm_message_t *message;
+ QString command = "save \"" + saveVLMConfFileName + "\"";
+ vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
+ vlm_MessageDelete( message );
+ return true;
}
- delete qfd;
- return exported;
+ return false;
}
void VLMDialog::mediasPopulator()
{
typeShortName = "VOD";
QString mux = qfu( (*ppp_dsc)[i]->vod.psz_mux );
- vlmAwidget = new VLMVod( mediaName, inputText, outputText,
- (*ppp_dsc)[i]->b_enabled, mux, this );
+ vlmAwidget = new VLMVod( mediaName, inputText, inputOptions,
+ outputText, (*ppp_dsc)[i]->b_enabled,
+ mux, this );
}
else
{
typeShortName = "Bcast";
- vlmAwidget = new VLMBroadcast( mediaName, inputText, outputText,
- (*ppp_dsc)[i]->b_enabled, (*ppp_dsc)[i]->broadcast.b_loop, this );
+ vlmAwidget = new VLMBroadcast( mediaName, inputText, inputOptions,
+ outputText, (*ppp_dsc)[i]->b_enabled,
+ (*ppp_dsc)[i]->broadcast.b_loop, this );
}
/* Add an Item of the Side List */
ui.vlmListItem->addItem( typeShortName + " : " + mediaName );
bool VLMDialog::importVLMConf()
{
- QString openVLMConfFileName = toNativeSeparator(
+ QString openVLMConfFileName = toNativeSeparators(
QFileDialog::getOpenFileName(
this, qtr( "Open VLM configuration..." ),
- qfu( config_GetHomeDir() ),
+ QVLCUserDir( VLC_DOCUMENTS_DIR ),
qtr( "VLM conf (*.vlm);;All (*)" ) ) );
if( !openVLMConfFileName.isEmpty() )
{
ui.nameLedit->clear();
ui.inputLedit->clear();
+ inputOptions.clear();
ui.outputLedit->clear();
time->setTime( QTime::currentTime() );
date->setDate( QDate::currentDate() );
{
OpenDialog *o = OpenDialog::getInstance( this, p_intf, false, SELECT, true );
o->exec();
- ui.inputLedit->setText( o->getMRL() );
+ ui.inputLedit->setText( o->getMRL( false ) );
+ inputOptions = o->getOptions();
}
void VLMDialog::selectOutput()
* VLMAWidget - Abstract class
********************************/
-VLMAWidget::VLMAWidget( const QString& _name,
- const QString& _input,
- const QString& _output,
- bool _enabled,
- VLMDialog *_parent,
- int _type )
+VLMAWidget::VLMAWidget( const QString& _name, const QString& _input,
+ const QString& _inputOptions, const QString& _output,
+ bool _enabled, VLMDialog *_parent, int _type )
: QGroupBox( _name, _parent )
{
parent = _parent;
name = _name;
input = _input;
+ inputOptions = _inputOptions;
output = _output;
b_enabled = _enabled;
type = _type;
objLayout->addWidget( time, 1, 3, 1, 2 );*/
QToolButton *modifyButton = new QToolButton;
- modifyButton->setIcon( QIcon( QPixmap( ":/settings" ) ) );
+ modifyButton->setIcon( QIcon( ":/menu/settings" ) );
objLayout->addWidget( modifyButton, 0, 5 );
QToolButton *deleteButton = new QToolButton;
- deleteButton->setIcon( QIcon( QPixmap( ":/quit" ) ) );
+ deleteButton->setIcon( QIcon( ":/menu/quit" ) );
objLayout->addWidget( deleteButton, 0, 6 );
BUTTONACT( modifyButton, modify() );
* VLMBroadcast
****************/
VLMBroadcast::VLMBroadcast( const QString& _name, const QString& _input,
+ const QString& _inputOptions,
const QString& _output, bool _enabled,
bool _looped, VLMDialog *_parent )
- : VLMAWidget( _name, _input, _output,
+ : VLMAWidget( _name, _input, _inputOptions, _output,
_enabled, _parent, QVLM_Broadcast )
{
nameLabel->setText( qtr("Broadcast: ") + name );
b_looped = _looped;
playButton = new QToolButton;
- playButton->setIcon( QIcon( QPixmap( ":/play" ) ) );
+ playButton->setIcon( QIcon( ":/menu/play" ) );
objLayout->addWidget( playButton, 1, 0 );
b_playing = true;
QToolButton *stopButton = new QToolButton;
- stopButton->setIcon( QIcon( QPixmap( ":/stop_b" ) ) );
+ stopButton->setIcon( QIcon( ":/toolbar/stop_b" ) );
objLayout->addWidget( stopButton, 1, 1 );
loopButton = new QToolButton;
void VLMBroadcast::update()
{
- VLMWrapper::EditBroadcast( name, input, output, b_enabled, b_looped );
+ VLMWrapper::EditBroadcast( name, input, inputOptions, output, b_enabled, b_looped );
if( b_looped )
- loopButton->setIcon( QIcon( QPixmap( ":/repeat_all" ) ) );
+ loopButton->setIcon( QIcon( ":/buttons/playlist/repeat_all" ) );
else
- loopButton->setIcon( QIcon( QPixmap( ":/repeat_off" ) ) );
+ loopButton->setIcon( QIcon( ":/buttons/playlist/repeat_off" ) );
}
void VLMBroadcast::togglePlayPause()
if( b_playing )
{
VLMWrapper::ControlBroadcast( name, ControlBroadcastPause );
- playButton->setIcon( QIcon( QPixmap( ":/pause_16px" ) ) );
+ playButton->setIcon( QIcon( ":/menu/pause" ) );
}
else
{
VLMWrapper::ControlBroadcast( name, ControlBroadcastPlay );
- playButton->setIcon( QIcon( QPixmap( ":/play_16px" ) ) );
+ playButton->setIcon( QIcon( ":/menu/play" ) );
}
b_playing = !b_playing;
}
void VLMBroadcast::stop()
{
VLMWrapper::ControlBroadcast( name, ControlBroadcastStop );
- playButton->setIcon( QIcon( QPixmap( ":/play_16px" ) ) );
+ 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, output, enabled, parent, QVLM_Schedule )
+ : VLMAWidget( name, input, inputOptions, output, enabled, parent,
+ QVLM_Schedule )
{
nameLabel->setText( qtr("Schedule: ") + name );
schetime = _schetime;
void VLMSchedule::update()
{
- VLMWrapper::EditSchedule( name, input, output, schetime, schedate,
+ VLMWrapper::EditSchedule( name, input, inputOptions, output, schetime, schedate,
rNumber, rDays, b_enabled);
}
/****************
* VLMVOD
****************/
-VLMVod::VLMVod( const QString& name, const QString& input, const QString& output,
+VLMVod::VLMVod( const QString& name, const QString& input,
+ const QString& inputOptions, const QString& output,
bool enabled, const QString& _mux, VLMDialog *parent)
- : VLMAWidget( name, input, output, enabled, parent, QVLM_VOD )
+ : VLMAWidget( name, input, inputOptions, output, enabled, parent,
+ QVLM_VOD )
{
nameLabel->setText( qtr("VOD: ") + name );
void VLMVod::update()
{
muxLabel->setText( mux );
- VLMWrapper::EditVod( name, input, output, b_enabled, mux );
+ VLMWrapper::EditVod( name, input, inputOptions, output, b_enabled, mux );
}
}
void VLMWrapper::AddBroadcast( const QString& name, const QString& input,
- const QString& output,
+ 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, output, b_enabled, b_loop );
+ EditBroadcast( name, input, inputOptions, output, b_enabled, b_loop );
}
void VLMWrapper::EditBroadcast( const QString& name, const QString& input,
- const QString& output,
+ const QString& inputOptions, const QString& output,
bool b_enabled, bool b_loop )
{
vlm_message_t *message;
command = "setup \"" + name + "\" inputdel all";
vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
vlm_MessageDelete( message );
- command = "setup \"" + name + "\" input \"" + input + "\"";
- 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 + "\"";
}
void VLMWrapper::AddVod( const QString& name, const QString& input,
- const QString& output,
+ const QString& inputOptions, const QString& output,
bool b_enabled, const QString& mux )
{
vlm_message_t *message;
QString command = "new \"" + name + "\" vod";
vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
vlm_MessageDelete( message );
- EditVod( name, input, output, b_enabled, mux );
+ EditVod( name, input, inputOptions, output, b_enabled, mux );
}
void VLMWrapper::EditVod( const QString& name, const QString& input,
- const QString& output,
+ const QString& inputOptions, const QString& output,
bool b_enabled,
const QString& mux )
{
vlm_message_t *message;
- QString command = "setup \"" + name + "\" input \"" + input + "\"";
- vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
- vlm_MessageDelete( message );
+ QString command;
+
+ 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() )
{
}
void VLMWrapper::AddSchedule( const QString& name, const QString& input,
- const QString& output, QDateTime _schetime,
- QDateTime _schedate,
+ const QString& inputOptions, const QString& output,
+ QDateTime _schetime, QDateTime _schedate,
int _scherepeatnumber, int _repeatDays,
bool b_enabled, const QString& mux )
{
QString command = "new \"" + name + "\" schedule";
vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
vlm_MessageDelete( message );
- EditSchedule( name, input, output, _schetime, _schedate,
+ EditSchedule( name, input, inputOptions, output, _schetime, _schedate,
_scherepeatnumber, _repeatDays, b_enabled, mux );
}
void VLMWrapper::EditSchedule( const QString& name, const QString& input,
- const QString& output, QDateTime _schetime,
- QDateTime _schedate, int _scherepeatnumber,
- int _repeatDays, bool b_enabled,
- const QString& mux )
+ const QString& inputOptions, const QString& output,
+ QDateTime _schetime, QDateTime _schedate,
+ int _scherepeatnumber, int _repeatDays,
+ bool b_enabled, const QString& mux )
{
vlm_message_t *message;
- QString command = "setup \"" + name + "\" input \"" + input + "\"";
- vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
- vlm_MessageDelete( message );
+ QString command;
+
+ 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() )
{