vlm.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * vlm.hpp : VLM Management
00003  ****************************************************************************
00004  * Copyright ( C ) 2006 the VideoLAN team
00005  * $Id$
00006  *
00007  * Authors: Jean-François Massol <jf.massol@gmail.com>
00008  *          Jean-Baptiste Kempf <jb@videolan.org>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * ( at your option ) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef _VLM_DIALOG_H_
00026 #define _VLM_DIALOG_H_
00027 
00028 #ifdef HAVE_CONFIG_H
00029 # include "config.h"
00030 #endif
00031 
00032 #include <vlc_common.h>
00033 
00034 #ifdef ENABLE_VLM
00035 
00036 #include <vlc_vlm.h>
00037 
00038 #include "ui/vlm.h"
00039 #include "util/qvlcframe.hpp"
00040 #include <QDateTime>
00041 
00042 enum{
00043     QVLM_Broadcast,
00044     QVLM_Schedule,
00045     QVLM_VOD
00046 };
00047 
00048 enum{
00049     ControlBroadcastPlay,
00050     ControlBroadcastPause,
00051     ControlBroadcastStop,
00052     ControlBroadcastSeek
00053 };
00054 
00055 class QComboBox;
00056 class QVBoxLayout;
00057 class QStackedWidget;
00058 class QLabel;
00059 class QGridLayout;
00060 class QLineEdit;
00061 class QCheckBox;
00062 class QToolButton;
00063 class QGroupBox;
00064 class QPushButton;
00065 class QHBoxLayout;
00066 class QDateTimeEdit;
00067 class QSpinBox;
00068 class VLMAWidget;
00069 class VLMWrapper;
00070 
00071 
00072 class VLMDialog : public QVLCDialog
00073 {
00074     Q_OBJECT;
00075 public:
00076     static VLMDialog * getInstance( intf_thread_t *p_intf )
00077     {
00078         if( !instance)
00079              instance = new VLMDialog( (QWidget *)p_intf->p_sys->p_mi, p_intf );
00080         return instance;
00081     };
00082     virtual ~VLMDialog();
00083 
00084     VLMWrapper *vlmWrapper;
00085     vlm_t *p_vlm;
00086 private:
00087     VLMDialog( QWidget *, intf_thread_t * );
00088     static VLMDialog *instance;
00089     Ui::Vlm ui;
00090 
00091     QList<VLMAWidget *> vlmItems;
00092     int currentIndex;
00093 
00094     QVBoxLayout *vlmItemLayout;
00095     QWidget *vlmItemWidget;
00096 
00097     QComboBox *mediatype;
00098     QDateTimeEdit *time, *date, *repeatTime;
00099     QSpinBox *scherepeatnumber, *repeatDays;
00100     bool isNameGenuine( QString );
00101     void mediasPopulator();
00102 public slots:
00103     void removeVLMItem( VLMAWidget * );
00104     void startModifyVLMItem( VLMAWidget * );
00105 private slots:
00106     void addVLMItem();
00107     void clearWidgets();
00108     void saveModifications();
00109     void showScheduleWidget( int );
00110     void selectVLMItem( int );
00111     void selectInput();
00112     void selectOutput();
00113     bool exportVLMConf();
00114     bool importVLMConf();
00115 };
00116 
00117 class VLMWrapper
00118 {
00119 public:
00120     VLMWrapper( vlm_t * );
00121     virtual ~VLMWrapper();
00122 
00123     static void AddBroadcast( const QString, const QString, const QString,
00124                        bool b_enabled = true,
00125                        bool b_loop = false );
00126     static void EditBroadcast( const QString, const QString, const QString,
00127                        bool b_enabled = true,
00128                        bool b_loop = false );
00129     static void EditSchedule( const QString, const QString, const QString,
00130                        QDateTime _schetime, QDateTime _schedate,
00131                        int _scherepeatnumber, int _repeatDays,
00132                        bool b_enabled = true, QString mux = "" );
00133     static void AddVod( const QString, const QString, const QString,
00134                        bool b_enabled = true, QString mux = "" );
00135     static void EditVod( const QString, const QString, const QString,
00136                        bool b_enabled = true, QString mux = "" );
00137     static void AddSchedule( const QString, const QString, const QString,
00138                        QDateTime _schetime, QDateTime _schedate,
00139                        int _scherepeatnumber, int _repeatDays,
00140                        bool b_enabled = true, QString mux = "" );
00141 
00142     static void ControlBroadcast( const QString, int, unsigned int seek = 0 );
00143     static void EnableItem( const QString, bool );
00144 
00145     /* We don't have yet the accessors in the core, so the following is commented */
00146     //unsigned int NbMedia() { if( p_vlm ) return p_vlm->i_media; return 0; }
00147    /* vlm_media_t *GetMedia( int i )
00148     { if( p_vlm ) return p_vlm->media[i]; return NULL; }*/
00149 
00150 private:
00151     static vlm_t *p_vlm;
00152 };
00153 
00154 class VLMAWidget : public QGroupBox
00155 {
00156     Q_OBJECT
00157     friend class VLMDialog;
00158 public:
00159     VLMAWidget( QString name, QString input, QString output,
00160             bool _enable, VLMDialog *parent, int _type = QVLM_Broadcast );
00161     virtual void update() = 0;
00162 protected:
00163     QLabel *nameLabel;
00164     QString name;
00165     QString input;
00166     QString output;
00167     bool b_enabled;
00168     int type;
00169     VLMDialog *parent;
00170     QGridLayout *objLayout;
00171 private slots:
00172     virtual void modify();
00173     virtual void del();
00174     virtual void toggleEnabled( bool );
00175 };
00176 
00177 class VLMBroadcast : public VLMAWidget
00178 {
00179     Q_OBJECT
00180     friend class VLMDialog;
00181 public:
00182     VLMBroadcast( QString name, QString input, QString output,
00183             bool _enable, bool _loop, VLMDialog *parent );
00184     void update();
00185 private:
00186     bool b_looped;
00187     bool b_playing;
00188     QToolButton *loopButton, *playButton;
00189 private slots:
00190     void stop();
00191     void togglePlayPause();
00192     void toggleLoop();
00193 };
00194 
00195 class VLMVod : public VLMAWidget
00196 {
00197     Q_OBJECT
00198     friend class VLMDialog;
00199 public:
00200     VLMVod( QString name, QString input, QString output,
00201             bool _enable, QString _mux, VLMDialog *parent );
00202     void update();
00203 private:
00204     QString mux;
00205     QLabel *muxLabel;
00206 };
00207 
00208 class VLMSchedule : public VLMAWidget
00209 {
00210     Q_OBJECT
00211     friend class VLMDialog;
00212 public:
00213     VLMSchedule( QString name, QString input, QString output,
00214             QDateTime schetime, QDateTime schedate, int repeatnumber,
00215             int repeatdays, bool enabled, VLMDialog *parent );
00216     void update();
00217 private:
00218     QDateTime schetime;
00219     QDateTime schedate;
00220     int rNumber;
00221     int rDays;
00222 };
00223 
00224 #endif
00225 
00226 #endif
00227 

Generated on Wed Aug 13 08:02:38 2008 for VLC by  doxygen 1.5.1