Commit 70d4af50 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - VLM: Schedule configuration. The VLM Dialog should work, still basic, but work.

parent 48c2120c
/***************************************************************************** /*****************************************************************************
* vlm.cpp : VLM Management * vlm.cpp : VLM Management
**************************************************************************** ****************************************************************************
* Copyright ( C ) 2006 the VideoLAN team * Copyright © 2008 the VideoLAN team
* $Id: sout.cpp 21875 2007-09-08 16:01:33Z jb $ * $Id: sout.cpp 21875 2007-09-08 16:01:33Z jb $
* *
* Authors: Jean-Baptiste Kempf <jb@videolan.org> * Authors: Jean-Baptiste Kempf <jb@videolan.org>
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
...@@ -46,6 +47,7 @@ ...@@ -46,6 +47,7 @@
#include <QPushButton> #include <QPushButton>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QDateTimeEdit> #include <QDateTimeEdit>
#include <QDateTime>
#include <QSpinBox> #include <QSpinBox>
#include <QHeaderView> #include <QHeaderView>
#include <QScrollArea> #include <QScrollArea>
...@@ -88,6 +90,7 @@ VLMDialog::VLMDialog( QWidget *parent, intf_thread_t *_p_intf ) : QVLCDialog( pa ...@@ -88,6 +90,7 @@ VLMDialog::VLMDialog( QWidget *parent, intf_thread_t *_p_intf ) : QVLCDialog( pa
time = new QDateTimeEdit( QTime::currentTime() ); time = new QDateTimeEdit( QTime::currentTime() );
time->setAlignment( Qt::AlignRight ); time->setAlignment( Qt::AlignRight );
time->setDisplayFormat( "hh:mm:ss" );
schetimelayout->addWidget( time, 0, 1, 1, 3 ); schetimelayout->addWidget( time, 0, 1, 1, 3 );
date = new QDateTimeEdit( QDate::currentDate() ); date = new QDateTimeEdit( QDate::currentDate() );
...@@ -197,7 +200,10 @@ void VLMDialog::addVLMItem() ...@@ -197,7 +200,10 @@ void VLMDialog::addVLMItem()
QString outputText = ui.outputLedit->text(); QString outputText = ui.outputLedit->text();
bool b_checked = ui.enableCheck->isChecked(); bool b_checked = ui.enableCheck->isChecked();
bool b_looped = ui.loopBCast->isChecked(); bool b_looped = ui.loopBCast->isChecked();
QDateTime schetime = time->dateTime();
QDateTime schedate = date->dateTime();
int repeatnum = scherepeatnumber->value();
int repeatdays = repeatDays->value();
VLMAWidget * vlmAwidget; VLMAWidget * vlmAwidget;
switch( type ) switch( type )
...@@ -205,8 +211,9 @@ void VLMDialog::addVLMItem() ...@@ -205,8 +211,9 @@ void VLMDialog::addVLMItem()
case QVLM_Broadcast: case QVLM_Broadcast:
typeShortName = "Bcast"; typeShortName = "Bcast";
vlmAwidget = new VLMBroadcast( name, inputText, outputText, vlmAwidget = new VLMBroadcast( name, inputText, outputText,
b_checked, b_looped, this ); b_checked, b_looped, this );
VLMWrapper::AddBroadcast( name, inputText, outputText, b_checked, b_looped ); VLMWrapper::AddBroadcast( name, inputText, outputText, b_checked,
b_looped );
break; break;
case QVLM_VOD: case QVLM_VOD:
typeShortName = "VOD"; typeShortName = "VOD";
...@@ -217,7 +224,10 @@ void VLMDialog::addVLMItem() ...@@ -217,7 +224,10 @@ void VLMDialog::addVLMItem()
case QVLM_Schedule: case QVLM_Schedule:
typeShortName = "Sched"; typeShortName = "Sched";
vlmAwidget = new VLMSchedule( name, inputText, outputText, vlmAwidget = new VLMSchedule( name, inputText, outputText,
b_checked, this ); schetime, schedate, repeatnum,
repeatdays, b_checked, this );
VLMWrapper::AddSchedule( name, inputText, outputText, schetime,
schedate, repeatnum, repeatdays, b_checked);
break; break;
default: default:
msg_Warn( p_intf, "Something bad happened" ); msg_Warn( p_intf, "Something bad happened" );
...@@ -269,7 +279,6 @@ void VLMDialog::removeVLMItem( VLMAWidget *vlmObj ) ...@@ -269,7 +279,6 @@ void VLMDialog::removeVLMItem( VLMAWidget *vlmObj )
{ {
int index = vlmItems.indexOf( vlmObj ); int index = vlmItems.indexOf( vlmObj );
if( index < 0 ) return; if( index < 0 ) return;
delete ui.vlmListItem->takeItem( index ); delete ui.vlmListItem->takeItem( index );
vlmItems.removeAt( index ); vlmItems.removeAt( index );
delete vlmObj; delete vlmObj;
...@@ -298,7 +307,8 @@ void VLMDialog::startModifyVLMItem( VLMAWidget *vlmObj ) ...@@ -298,7 +307,8 @@ void VLMDialog::startModifyVLMItem( VLMAWidget *vlmObj )
ui.muxLedit->setText( (qobject_cast<VLMVod *>(vlmObj))->mux ); ui.muxLedit->setText( (qobject_cast<VLMVod *>(vlmObj))->mux );
break; break;
case QVLM_Schedule: case QVLM_Schedule:
//(qobject_cast<VLMSchedule *>) time->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schetime );
date->setDateTime( ( qobject_cast<VLMSchedule *>(vlmObj))->schedate );
break; break;
} }
...@@ -325,6 +335,10 @@ void VLMDialog::saveModifications() ...@@ -325,6 +335,10 @@ void VLMDialog::saveModifications()
(qobject_cast<VLMVod *>(vlmObj))->mux = ui.muxLedit->text(); (qobject_cast<VLMVod *>(vlmObj))->mux = ui.muxLedit->text();
break; break;
case QVLM_Schedule: case QVLM_Schedule:
(qobject_cast<VLMSchedule *>(vlmObj))->schetime = time->dateTime();
(qobject_cast<VLMSchedule *>(vlmObj))->schedate = date->dateTime();
(qobject_cast<VLMSchedule *>(vlmObj))->rNumber = scherepeatnumber->value();
(qobject_cast<VLMSchedule *>(vlmObj))->rDays = repeatDays->value();
break; break;
// vlmObj-> // vlmObj->
} }
...@@ -470,14 +484,24 @@ void VLMBroadcast::stop() ...@@ -470,14 +484,24 @@ void VLMBroadcast::stop()
* VLMSchedule * VLMSchedule
****************/ ****************/
VLMSchedule::VLMSchedule( QString name, QString input, QString output, VLMSchedule::VLMSchedule( QString name, QString input, QString output,
bool enabled, VLMDialog *parent) QDateTime _schetime, QDateTime _schedate,
int _scherepeatnumber, int _repeatDays,
bool enabled, VLMDialog *parent )
: VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule ) : VLMAWidget( name, input, output, enabled, parent, QVLM_Schedule )
{ {
nameLabel->setText( "Schedule: " + name ); nameLabel->setText( "Schedule: " + name );
schetime = _schetime;
schedate = _schedate;
rNumber = _scherepeatnumber;
rDays = _repeatDays;
type = QVLM_Schedule;
update();
} }
void VLMSchedule::update() void VLMSchedule::update()
{ {
VLMWrapper::EditSchedule( name, input, output, schetime, schedate,
rNumber, rDays, b_enabled);
} }
/**************** /****************
...@@ -630,4 +654,65 @@ void VLMWrapper::EditVod( const QString name, const QString input, ...@@ -630,4 +654,65 @@ void VLMWrapper::EditVod( const QString name, const QString input,
vlm_MessageDelete( message ); vlm_MessageDelete( message );
} }
} }
void VLMWrapper::AddSchedule( const QString name, const QString input,
const QString output, QDateTime _schetime,
QDateTime _schedate,
int _scherepeatnumber, int _repeatDays,
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,
_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 )
{
vlm_message_t *message;
QString command = "setup \"" + name + "\" input \"" + input + "\"";
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( !mux.isEmpty() )
{
command = "setup \"" + name + "\" mux \"" + mux + "\"";
vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
vlm_MessageDelete( message );
}
command = "setup \"" + name + "\" date \"" +
_schedate.toString( "yyyy/MM/dd" )+ "-" +
_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 );
}
}
#endif #endif
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "ui/vlm.h" #include "ui/vlm.h"
#include "util/qvlcframe.hpp" #include "util/qvlcframe.hpp"
#include <QDateTime>
enum{ enum{
QVLM_Broadcast, QVLM_Broadcast,
...@@ -122,10 +123,18 @@ public: ...@@ -122,10 +123,18 @@ public:
static void EditBroadcast( const QString, const QString, const QString, static void EditBroadcast( const QString, const QString, const QString,
bool b_enabled = true, bool b_enabled = true,
bool b_loop = false ); bool b_loop = false );
static void EditSchedule( const QString, const QString, const QString,
QDateTime _schetime, QDateTime _schedate,
int _scherepeatnumber, int _repeatDays,
bool b_enabled = true, QString mux = "" );
static void AddVod( const QString, const QString, const QString, static void AddVod( const QString, const QString, const QString,
bool b_enabled = true, QString mux = "" ); bool b_enabled = true, QString mux = "" );
static void EditVod( const QString, const QString, const QString, static void EditVod( const QString, const QString, const QString,
bool b_enabled = true, QString mux = "" ); bool b_enabled = true, QString mux = "" );
static void AddSchedule( const QString, const QString, const QString,
QDateTime _schetime, QDateTime _schedate,
int _scherepeatnumber, int _repeatDays,
bool b_enabled = true, QString mux = "" );
static void ControlBroadcast( const QString, int, unsigned int seek = 0 ); static void ControlBroadcast( const QString, int, unsigned int seek = 0 );
static void EnableItem( const QString, bool ); static void EnableItem( const QString, bool );
...@@ -196,12 +205,18 @@ private: ...@@ -196,12 +205,18 @@ private:
class VLMSchedule : public VLMAWidget class VLMSchedule : public VLMAWidget
{ {
Q_OBJECT
friend class VLMDialog; friend class VLMDialog;
public: public:
VLMSchedule( QString name, QString input, QString output, bool _enable, VLMDialog *parent ); VLMSchedule( QString name, QString input, QString output,
QDateTime schetime, QDateTime schedate, int repeatnumber,
int repeatdays, bool enabled, VLMDialog *parent );
void update(); void update();
private: private:
QDateTime schetime;
QDateTime schedate;
int rNumber;
int rDays;
}; };
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment