Newer
Older
/*****************************************************************************

Jean-Baptiste Kempf
committed
* vlm.hpp : VLM Management
****************************************************************************
* Copyright ( C ) 2006 the VideoLAN team
*
* Authors: Jean-François Massol <jf.massol@gmail.com>
* Jean-Baptiste Kempf <jb@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* ( at your option ) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef QVLC_VLM_DIALOG_H_
#define QVLC_VLM_DIALOG_H_ 1
#ifdef HAVE_CONFIG_H
#include <vlc_vlm.h>
#include "widgets/native/qvlcframe.hpp"
#include "util/singleton.hpp"

Jean-Baptiste Kempf
committed
#include <QDateTime>

Jean-Baptiste Kempf
committed
QVLM_Schedule,

Jean-Baptiste Kempf
committed
enum{
ControlBroadcastPlay,
ControlBroadcastPause,
ControlBroadcastStop,
ControlBroadcastSeek
};
class QComboBox;
class QVBoxLayout;
class QLabel;
class QGridLayout;
class QToolButton;
class QGroupBox;

Jean-Baptiste Kempf
committed
class QDateTimeEdit;
class QSpinBox;

Jean-Baptiste Kempf
committed
class VLMAWidget;

Jean-Baptiste Kempf
committed
class VLMWrapper;
class VLMDialog : public QVLCFrame, public Singleton<VLMDialog>
void toggleVisible();
VLMDialog( intf_thread_t * );
virtual ~VLMDialog();
Ui::Vlm ui;

Jean-Baptiste Kempf
committed
QList<VLMAWidget *> vlmItems;

Jean-Baptiste Kempf
committed
int currentIndex;
QVBoxLayout *vlmItemLayout;
QWidget *vlmItemWidget;

Jean-Baptiste Kempf
committed

Jean-Baptiste Kempf
committed
QDateTimeEdit *time, *date, *repeatTime;
QSpinBox *scherepeatnumber, *repeatDays;

Jean-Baptiste Kempf
committed
void mediasPopulator();

Jean-Baptiste Kempf
committed
public slots:

Jean-Baptiste Kempf
committed
void removeVLMItem( VLMAWidget * );
void startModifyVLMItem( VLMAWidget * );

Jean-Baptiste Kempf
committed
void clearWidgets();
void saveModifications();
void showScheduleWidget( int );
void selectVLMItem( int );

Jean-Baptiste Kempf
committed
void selectInput();

Jean-Baptiste Kempf
committed
void selectOutput();

Jean-Baptiste Kempf
committed
bool exportVLMConf();
bool importVLMConf();
friend class Singleton<VLMDialog>;

Jean-Baptiste Kempf
committed
};

Jean-Baptiste Kempf
committed
class VLMWrapper
{
public:

Jean-Baptiste Kempf
committed
virtual ~VLMWrapper();
int GetMedias( vlm_media_t **& );
void AddBroadcast( const QString&, const QString&,
const QString&, const QString&,
bool b_enabled = true, bool b_loop = false );
void EditBroadcast( const QString&, const QString&,
bool b_enabled = true, bool b_loop = false );
void EditSchedule( const QString&, const QString&,
const QString&, const QString&,
QDateTime _schetime, QDateTime _schedate,
int _scherepeatnumber, int _repeatDays,
bool b_enabled = true, const QString& mux = "" );
void AddSchedule( const QString&, const QString&,
const QString&, const QString&,
QDateTime _schetime, QDateTime _schedate,
int _scherepeatnumber, int _repeatDays,
bool b_enabled = true, const QString& mux = "" );
void ControlBroadcast( const QString&, int, unsigned int seek = 0 );
void EnableItem( const QString&, bool );
void SaveConfig( const QString& );
bool LoadConfig( const QString& );

Jean-Baptiste Kempf
committed
private:

Jean-Baptiste Kempf
committed
};

Jean-Baptiste Kempf
committed
class VLMAWidget : public QGroupBox

Jean-Baptiste Kempf
committed
{
Q_OBJECT
friend class VLMDialog;
public:
VLMAWidget( VLMWrapper *, const QString& name, const QString& input,
const QString& inputOptions, const QString& output,
bool _enable, VLMDialog *parent, int _type = QVLM_Broadcast );

Jean-Baptiste Kempf
committed
virtual void update() = 0;

Jean-Baptiste Kempf
committed
protected:
QLabel *nameLabel;

Jean-Baptiste Kempf
committed
QString name;
QString input;

Jean-Baptiste Kempf
committed
QString output;
bool b_enabled;

Jean-Baptiste Kempf
committed
int type;

Jean-Baptiste Kempf
committed
VLMDialog *parent;

Jean-Baptiste Kempf
committed
QGridLayout *objLayout;
private slots:
virtual void modify();
virtual void del();

Jean-Baptiste Kempf
committed
virtual void toggleEnabled( bool );

Jean-Baptiste Kempf
committed
};
class VLMBroadcast : public VLMAWidget
{
Q_OBJECT

Jean-Baptiste Kempf
committed
friend class VLMDialog;

Jean-Baptiste Kempf
committed
public:
VLMBroadcast( VLMWrapper *, const QString& name, const QString& input,
const QString& inputOptions, const QString& output,
bool _enable, bool _loop, VLMDialog *parent );
void update() Q_DECL_OVERRIDE;

Jean-Baptiste Kempf
committed
private:
bool b_looped;

Jean-Baptiste Kempf
committed
bool b_playing;
QToolButton *loopButton, *playButton;

Jean-Baptiste Kempf
committed
private slots:
void stop();
void togglePlayPause();
void toggleLoop();

Jean-Baptiste Kempf
committed
class VLMSchedule : public VLMAWidget
{

Jean-Baptiste Kempf
committed
Q_OBJECT

Jean-Baptiste Kempf
committed
friend class VLMDialog;

Jean-Baptiste Kempf
committed
public:
VLMSchedule( VLMWrapper *, const QString& name, const QString& input,
const QString& inputOptions, const QString& output,
QDateTime schetime, QDateTime schedate, int repeatnumber,
int repeatdays, bool enabled, VLMDialog *parent );

Jean-Baptiste Kempf
committed
void update();

Jean-Baptiste Kempf
committed
private:

Jean-Baptiste Kempf
committed
QDateTime schetime;
QDateTime schedate;
int rNumber;
int rDays;

Jean-Baptiste Kempf
committed
};