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: bcb89dc53ea857d8aebe51f782ec6e8c24373e9a $
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 QVLC_VLM_DIALOG_H_
00026 #define QVLC_VLM_DIALOG_H_ 1
00027 
00028 #ifdef HAVE_CONFIG_H
00029 # include "config.h"
00030 #endif
00031 
00032 #ifdef ENABLE_VLM
00033 
00034 #include <vlc_vlm.h>
00035 
00036 #include "ui/vlm.h"
00037 #include "util/qvlcframe.hpp"
00038 #include "util/singleton.hpp"
00039 #include <QDateTime>
00040 
00041 enum{
00042     QVLM_Broadcast,
00043     QVLM_Schedule,
00044     QVLM_VOD
00045 };
00046 
00047 enum{
00048     ControlBroadcastPlay,
00049     ControlBroadcastPause,
00050     ControlBroadcastStop,
00051     ControlBroadcastSeek
00052 };
00053 
00054 class QComboBox;
00055 class QVBoxLayout;
00056 class QStackedWidget;
00057 class QLabel;
00058 class QGridLayout;
00059 class QLineEdit;
00060 class QCheckBox;
00061 class QToolButton;
00062 class QGroupBox;
00063 class QPushButton;
00064 class QHBoxLayout;
00065 class QDateTimeEdit;
00066 class QSpinBox;
00067 class VLMAWidget;
00068 class VLMWrapper;
00069 
00070 
00071 class VLMDialog : public QVLCDialog, public Singleton<VLMDialog>
00072 {
00073     Q_OBJECT
00074 
00075 public:
00076     void toggleVisible();
00077 
00078     VLMWrapper *vlmWrapper;
00079     vlm_t *p_vlm;
00080 private:
00081     VLMDialog( intf_thread_t * );
00082     virtual ~VLMDialog();
00083 
00084     Ui::Vlm ui;
00085 
00086     QList<VLMAWidget *> vlmItems;
00087     int currentIndex;
00088 
00089     QVBoxLayout *vlmItemLayout;
00090     QWidget *vlmItemWidget;
00091 
00092     QComboBox *mediatype;
00093     QDateTimeEdit *time, *date, *repeatTime;
00094     QSpinBox *scherepeatnumber, *repeatDays;
00095     bool isNameGenuine( const QString& );
00096     void mediasPopulator();
00097 public slots:
00098     void removeVLMItem( VLMAWidget * );
00099     void startModifyVLMItem( VLMAWidget * );
00100 private slots:
00101     void addVLMItem();
00102     void clearWidgets();
00103     void saveModifications();
00104     void showScheduleWidget( int );
00105     void selectVLMItem( int );
00106     void selectInput();
00107     void selectOutput();
00108     bool exportVLMConf();
00109     bool importVLMConf();
00110 
00111     friend class    Singleton<VLMDialog>;
00112 };
00113 
00114 class VLMWrapper
00115 {
00116 public:
00117     VLMWrapper( vlm_t * );
00118     virtual ~VLMWrapper();
00119 
00120     static void AddBroadcast( const QString&, const QString&, const QString&,
00121                        bool b_enabled = true,
00122                        bool b_loop = false );
00123     static void EditBroadcast( const QString&, const QString&, const QString&,
00124                        bool b_enabled = true,
00125                        bool b_loop = false );
00126     static void EditSchedule( const QString&, const QString&, const QString&,
00127                        QDateTime _schetime, QDateTime _schedate,
00128                        int _scherepeatnumber, int _repeatDays,
00129                        bool b_enabled = true, const QString& mux = "" );
00130     static void AddVod( const QString&, const QString&, const QString&,
00131                        bool b_enabled = true, const QString& mux = "" );
00132     static void EditVod( const QString&, const QString&, const QString&,
00133                        bool b_enabled = true, const QString& mux = "" );
00134     static void AddSchedule( const QString&, const QString&, const QString&,
00135                        QDateTime _schetime, QDateTime _schedate,
00136                        int _scherepeatnumber, int _repeatDays,
00137                        bool b_enabled = true, const QString& mux = "" );
00138 
00139     static void ControlBroadcast( const QString&, int, unsigned int seek = 0 );
00140     static void EnableItem( const QString&, bool );
00141 
00142     /* We don't have yet the accessors in the core, so the following is commented */
00143     //unsigned int NbMedia() { if( p_vlm ) return p_vlm->i_media; return 0; }
00144    /* vlm_media_t *GetMedia( int i )
00145     { if( p_vlm ) return p_vlm->media[i]; return NULL; }*/
00146 
00147 private:
00148     static vlm_t *p_vlm;
00149 };
00150 
00151 class VLMAWidget : public QGroupBox
00152 {
00153     Q_OBJECT
00154     friend class VLMDialog;
00155 public:
00156     VLMAWidget( const QString& name, const QString& input, const QString& output,
00157             bool _enable, VLMDialog *parent, int _type = QVLM_Broadcast );
00158     virtual void update() = 0;
00159 protected:
00160     QLabel *nameLabel;
00161     QString name;
00162     QString input;
00163     QString output;
00164     bool b_enabled;
00165     int type;
00166     VLMDialog *parent;
00167     QGridLayout *objLayout;
00168 private slots:
00169     virtual void modify();
00170     virtual void del();
00171     virtual void toggleEnabled( bool );
00172 };
00173 
00174 class VLMBroadcast : public VLMAWidget
00175 {
00176     Q_OBJECT
00177     friend class VLMDialog;
00178 public:
00179     VLMBroadcast( const QString& name, const QString& input, const QString& output,
00180             bool _enable, bool _loop, VLMDialog *parent );
00181     void update();
00182 private:
00183     bool b_looped;
00184     bool b_playing;
00185     QToolButton *loopButton, *playButton;
00186 private slots:
00187     void stop();
00188     void togglePlayPause();
00189     void toggleLoop();
00190 };
00191 
00192 class VLMVod : public VLMAWidget
00193 {
00194     Q_OBJECT
00195     friend class VLMDialog;
00196 public:
00197     VLMVod( const QString& name, const QString& input, const QString& output,
00198             bool _enable, const QString& _mux, VLMDialog *parent );
00199     void update();
00200 private:
00201     QString mux;
00202     QLabel *muxLabel;
00203 };
00204 
00205 class VLMSchedule : public VLMAWidget
00206 {
00207     Q_OBJECT
00208     friend class VLMDialog;
00209 public:
00210     VLMSchedule( const QString& name, const QString& input, const QString& output,
00211             QDateTime schetime, QDateTime schedate, int repeatnumber,
00212             int repeatdays, bool enabled, VLMDialog *parent );
00213     void update();
00214 private:
00215     QDateTime schetime;
00216     QDateTime schedate;
00217     int rNumber;
00218     int rDays;
00219 };
00220 
00221 #endif
00222 
00223 #endif
00224 

Generated on Tue May 25 08:04:57 2010 for VLC by  doxygen 1.5.6