#ifdef ENABLE_VLM
#include "dialogs/open.hpp"
#include "dialogs/sout.hpp"
+#include "util/qt_dirs.hpp"
#include <QString>
#include <QComboBox>
#include <QScrollArea>
#include <QFileDialog>
-static const char *psz_type[] = { "Broadcast", "Schedule", "VOD" };
-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 );
ui.saveButton->hide();
#define ADDMEDIATYPES( str, type ) ui.mediaType->addItem( qtr( str ), QVariant( type ) );
- ADDMEDIATYPES( "Broadcast", QVLM_Broadcast );
- ADDMEDIATYPES( "Schedule", QVLM_Schedule );
- ADDMEDIATYPES( "Video On Demand ( VOD )", QVLM_VOD );
+ ADDMEDIATYPES( N_("Broadcast"), QVLM_Broadcast );
+ ADDMEDIATYPES( N_("Schedule"), QVLM_Schedule );
+ ADDMEDIATYPES( N_("Video On Demand ( VOD )"), QVLM_VOD );
#undef ADDMEDIATYPES
/* Schedule Stuffs */
new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
vlmItemLayout->addItem( spacer );
- QPushButton *importButton = new QPushButton( qtr( "Import" ) );
+ QPushButton *importButton = new QPushButton( qtr( "I&mport" ) );
ui.buttonBox->addButton( importButton, QDialogButtonBox::ActionRole );
- QPushButton *exportButton = new QPushButton( qtr( "Export" ) );
+ QPushButton *exportButton = new QPushButton( qtr( "E&xport" ) );
ui.buttonBox->addButton( exportButton, QDialogButtonBox::ActionRole );
QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
BUTTONACT( ui.saveButton, saveModifications() );
BUTTONACT( ui.inputButton, selectInput() );
BUTTONACT( ui.outputButton, selectOutput() );
+ //readSettings( "VLM", QSize( 700, 500 ) );
}
VLMDialog::~VLMDialog()
{
delete vlmWrapper;
- /* FIXME :you have to destroy vlm here to close
+ //writeSettings( "VLM" );
+ /* TODO :you have to destroy vlm here to close
* but we shouldn't destroy vlm here in case somebody else wants it */
if( p_vlm )
{
ui.vlmItemScroll->ensureWidgetVisible( vlmItems.at( i ) );
}
-bool VLMDialog::isNameGenuine( QString name )
+bool VLMDialog::isNameGenuine( const QString& name )
{
for( int i = 0; i < vlmItems.size(); i++ )
{
int repeatnum = scherepeatnumber->value();
int repeatdays = repeatDays->value();
VLMAWidget * vlmAwidget;
+ outputText.remove( ":sout=" );
switch( type )
{
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:
clearWidgets();
}
-// FIXME : VOD are not exported to the file
+/* TODO : VOD are not exported to the file */
bool VLMDialog::exportVLMConf()
{
- QString saveVLMConfFileName = QFileDialog::getSaveFileName(
- this, qtr( "Choose a filename to save the VLM configuration..." ),
- qfu( config_GetHomeDir() ),
- qtr( "VLM conf (*.vlm) ;; All (*.*)" ) );
+ QString saveVLMConfFileName = QFileDialog::getSaveFileName( this,
+ qtr( "Save VLM configuration as..." ),
+ QVLCUserDir( VLC_DOCUMENTS_DIR ),
+ qtr( "VLM conf (*.vlm);;All (*)" ) );
if( !saveVLMConfFileName.isEmpty() )
{
vlm_MessageDelete( message );
return true;
}
+
return false;
}
{
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 = QFileDialog::getOpenFileName(
- this, qtr( "Choose a VLM configuration file to open..." ),
- qfu( config_GetHomeDir() ),
- qtr( "VLM conf (*.vlm) ;; All (*.*)" ) );
+ QString openVLMConfFileName = toNativeSeparators(
+ QFileDialog::getOpenFileName(
+ this, qtr( "Open VLM configuration..." ),
+ 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() );
void VLMDialog::selectInput()
{
- OpenDialog *o = OpenDialog::getInstance( this, p_intf, SELECT, true );
+ 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()
{
- SoutDialog *s = SoutDialog::getInstance( this, p_intf, false );
+ SoutDialog *s = new SoutDialog( this, p_intf );
if( s->exec() == QDialog::Accepted )
ui.outputLedit->setText( s->getMrl() );
}
if( vlmObj )
{
vlmObj->input = ui.inputLedit->text();
- vlmObj->output = ui.outputLedit->text();
+ vlmObj->output = ui.outputLedit->text().remove( ":sout=" );
vlmObj->setChecked( ui.enableCheck->isChecked() );
vlmObj->b_enabled = ui.enableCheck->isChecked();
switch( vlmObj->type )
break;
// vlmObj->
}
- vlmObj->update(); /* It should call the correct function is VLMAWidget
- is abstract, but I am far from sure... FIXME ? */
+ vlmObj->update();
}
clearWidgets();
}
* VLMAWidget - Abstract class
********************************/
-VLMAWidget::VLMAWidget( QString _name,
- QString _input,
- 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( ":/pixmaps/menus_settings_16px.png" ) ) );
+ modifyButton->setIcon( QIcon( ":/menu/settings" ) );
objLayout->addWidget( modifyButton, 0, 5 );
QToolButton *deleteButton = new QToolButton;
- deleteButton->setIcon( QIcon( QPixmap( ":/pixmaps/menus_quit_16px.png" ) ) );
+ deleteButton->setIcon( QIcon( ":/menu/quit" ) );
objLayout->addWidget( deleteButton, 0, 6 );
BUTTONACT( modifyButton, modify() );
parent->removeVLMItem( this );
}
-//FIXME, remove me before release
-void VLMAWidget::enterEvent( QEvent *event )
-{
- printf( "test" );
-}
-
void VLMAWidget::toggleEnabled( bool b_enable )
{
VLMWrapper::EnableItem( name, b_enable );
/****************
* VLMBroadcast
****************/
-VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output,
- bool _enabled, bool _looped, VLMDialog *_parent)
- : VLMAWidget( _name, _input, _output,
+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( "Broadcast: " + name );
+ nameLabel->setText( qtr("Broadcast: ") + name );
type = QVLM_Broadcast;
b_looped = _looped;
playButton = new QToolButton;
- playButton->setIcon( QIcon( QPixmap( ":/pixmaps/play_16px.png" ) ) );
+ playButton->setIcon( QIcon( ":/menu/play" ) );
objLayout->addWidget( playButton, 1, 0 );
b_playing = true;
QToolButton *stopButton = new QToolButton;
- stopButton->setIcon( QIcon( QPixmap( ":/pixmaps/stop_16px.png" ) ) );
+ 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( ":/pixmaps/playlist_repeat_all.png" ) ) );
+ loopButton->setIcon( QIcon( ":/buttons/playlist/repeat_all" ) );
else
- loopButton->setIcon( QIcon( QPixmap( ":/pixmaps/playlist_repeat_off.png" ) ) );
+ loopButton->setIcon( QIcon( ":/buttons/playlist/repeat_off" ) );
}
void VLMBroadcast::togglePlayPause()
{
- if( b_playing = true )
+ if( b_playing )
{
VLMWrapper::ControlBroadcast( name, ControlBroadcastPause );
- playButton->setIcon( QIcon( QPixmap( ":/pixmaps/pause_16px.png" ) ) );
+ playButton->setIcon( QIcon( ":/menu/pause" ) );
}
else
{
VLMWrapper::ControlBroadcast( name, ControlBroadcastPlay );
- playButton->setIcon( QIcon( QPixmap( ":/pixmaps/play_16px.png" ) ) );
+ playButton->setIcon( QIcon( ":/menu/play" ) );
}
b_playing = !b_playing;
}
void VLMBroadcast::stop()
{
VLMWrapper::ControlBroadcast( name, ControlBroadcastStop );
- playButton->setIcon( QIcon( QPixmap( ":/pixmaps/play_16px.png" ) ) );
+ playButton->setIcon( QIcon( ":/menu/play" ) );
}
/****************
* VLMSchedule
****************/
-VLMSchedule::VLMSchedule( QString name, QString input, QString output,
- QDateTime _schetime, QDateTime _schedate,
- int _scherepeatnumber, int _repeatDays,
- bool enabled, VLMDialog *parent )
- : VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule )
+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( "Schedule: " + name );
+ nameLabel->setText( qtr("Schedule: ") + name );
schetime = _schetime;
schedate = _schedate;
rNumber = _scherepeatnumber;
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( QString name, QString input, QString output,
- bool enabled, QString _mux, VLMDialog *parent)
- : VLMAWidget( name, input, output, enabled, parent, QVLM_VOD )
+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( "VOD:" + name );
+ nameLabel->setText( qtr("VOD: ") + name );
mux = _mux;
muxLabel = new QLabel;
void VLMVod::update()
{
muxLabel->setText( mux );
- VLMWrapper::EditVod( name, input, output, b_enabled, mux );
+ VLMWrapper::EditVod( name, input, inputOptions, output, b_enabled, mux );
}
p_vlm = NULL;
}
-void VLMWrapper::AddBroadcast( const QString name, QString input,
- QString output,
+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, 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,
+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;
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::EnableItem( const QString name, bool b_enable )
+void VLMWrapper::EnableItem( const QString& name, bool b_enable )
{
vlm_message_t *message;
QString command = "setup \"" + name + ( b_enable ? " enable" : " disable" );
+ vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+ vlm_MessageDelete( message );
}
-void VLMWrapper::ControlBroadcast( const QString name, int BroadcastStatus,
+void VLMWrapper::ControlBroadcast( const QString& name, int BroadcastStatus,
unsigned int seek )
{
vlm_message_t *message;
- QString command = "control \"" + name;
+ QString command = "control \"" + name + "\"";
switch( BroadcastStatus )
{
case ControlBroadcastPlay:
vlm_MessageDelete( message );
}
-void VLMWrapper::AddVod( const QString name, const QString input,
- const QString output,
- bool b_enabled, const QString mux )
+void VLMWrapper::AddVod( const QString& name, const QString& input,
+ 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,
+void VLMWrapper::EditVod( const QString& name, const QString& input,
+ const QString& inputOptions, const QString& output,
bool b_enabled,
- const QString mux )
+ 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,
+void VLMWrapper::AddSchedule( const QString& name, const QString& input,
+ const QString& inputOptions, const QString& output,
+ QDateTime _schetime, QDateTime _schedate,
int _scherepeatnumber, int _repeatDays,
- bool b_enabled, const QString mux )
+ bool b_enabled, const QString& mux )
{
vlm_message_t *message;
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 )
+void VLMWrapper::EditSchedule( const QString& name, const QString& input,
+ 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() )
{
_schetime.toString( "hh:mm:ss" ) + "\"";
vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
vlm_MessageDelete( message );
+
if( _scherepeatnumber > 0 )
{
command = "setup \"" + name + "\" repeat \"" + _scherepeatnumber + "\"";
vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
vlm_MessageDelete( message );
}
+
+ if( _repeatDays > 0 )
+ {
+ command = "setup \"" + name + "\" period \"" + _repeatDays + "\"";
+ vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
+ vlm_MessageDelete( message );
+ }
+}
+
+void VLMDialog::toggleVisible()
+{
+ QList<VLMAWidget *>::iterator it;
+ for( it = vlmItems.begin(); it != vlmItems.end(); it++ )
+ {
+ VLMAWidget *item = *it;
+ delete item;
+ item = NULL;
+ }
+ vlmItems.clear();
+ ui.vlmListItem->clear();
+ mediasPopulator();
+ QVLCDialog::toggleVisible();
}