]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/vlm.hpp
Qt4 - VLM update. Add the actual vlm queries, the modifications and so on for VOD...
[vlc] / modules / gui / qt4 / dialogs / vlm.hpp
1 /*****************************************************************************
2  * vlm.hpp : VLM Management
3  ****************************************************************************
4  * Copyright ( C ) 2006 the VideoLAN team
5  * $Id: vlm.hpp 21875 2007-09-08 16:01:33Z jb $
6  *
7  * Authors: Jean-François Massol <jf.massol@gmail.com>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * ( at your option ) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef _VLM_DIALOG_H_
26 #define _VLM_DIALOG_H_
27
28 #include <vlc/vlc.h>
29 #include <vlc_vlm.h>
30
31 #include "ui/vlm.h"
32 #include "util/qvlcframe.hpp"
33
34 enum{
35     QVLM_Broadcast,
36     QVLM_Schedule,
37     QVLM_VOD
38 };
39
40 enum{
41     ControlBroadcastPlay,
42     ControlBroadcastPause,
43     ControlBroadcastStop,
44     ControlBroadcastSeek
45 };
46
47 class QComboBox;
48 class QVBoxLayout;
49 class QStackedWidget;
50 class QLabel;
51 class QGridLayout;
52 class QLineEdit;
53 class QCheckBox;
54 class QToolButton;
55 class QGroupBox;
56 class QPushButton;
57 class QHBoxLayout;
58 class QDateTimeEdit;
59 class QSpinBox;
60 class VLMAWidget;
61 class VLMWrapper;
62
63 #define THEVLM parent->vlmWrapper->GetVLM()
64
65 class VLMDialog : public QVLCFrame
66 {
67     Q_OBJECT;
68 public:
69     static VLMDialog * getInstance( intf_thread_t *p_intf )
70     {
71         if( !instance)
72              instance = new VLMDialog( p_intf );
73         return instance;
74     };
75     virtual ~VLMDialog();
76
77     VLMWrapper *vlmWrapper;
78
79 private:
80     VLMDialog( intf_thread_t * );
81     static VLMDialog *instance;
82     Ui::Vlm ui;
83
84     QList<VLMAWidget *> vlmItems;
85     int currentIndex;
86
87     QVBoxLayout *vlmItemLayout;
88     QWidget *vlmItemWidget;
89   
90     QComboBox *mediatype;
91     QDateTimeEdit *time, *date, *repeatTime;
92     QSpinBox *scherepeatnumber, *repeatDays;
93     bool isNameGenuine( QString );
94 public slots:
95     void removeVLMItem( VLMAWidget * );
96     void startModifyVLMItem( VLMAWidget * );
97 private slots:
98     void addVLMItem();
99     void clearWidgets();
100     void saveModifications();
101     void showScheduleWidget( int );
102     void selectVLMItem( int );
103 };
104
105 class VLMWrapper
106 {
107 public:
108     VLMWrapper( intf_thread_t * );
109     virtual ~VLMWrapper();
110
111     bool AttachVLM();
112
113     static void AddBroadcast( vlm_t *, const QString, const QString, const QString,
114                        bool b_enabled = true,
115                        bool b_loop = false );
116     static void EditBroadcast( vlm_t *, const QString, const QString, const QString,
117                        bool b_enabled = true,
118                        bool b_loop = false );
119     static void AddVod( vlm_t *, const QString, const QString, const QString,
120                        bool b_enabled = true, QString mux = "" );
121     static void EditVod( vlm_t *, const QString, const QString, const QString,
122                        bool b_enabled = true, QString mux = "" );
123
124     static void ControlBroadcast( vlm_t *, const QString, int, unsigned int seek = 0 );
125
126     vlm_t * GetVLM(){ return p_vlm;}
127     /* We don't have yet the accessors in the core, so the following is commented */
128     //unsigned int NbMedia() { if( p_vlm ) return p_vlm->i_media; return 0; }
129    /* vlm_media_t *GetMedia( int i )
130     { if( p_vlm ) return p_vlm->media[i]; return NULL; }*/
131
132 private:
133     vlm_t *p_vlm;
134     intf_thread_t *p_intf;
135 };
136
137 class VLMAWidget : public QGroupBox 
138 {
139     Q_OBJECT
140     friend class VLMDialog;
141 public:
142     VLMAWidget( QString name, QString input, QString output,
143             bool _enable, VLMDialog *parent, int _type = QVLM_Broadcast );
144     virtual void update() = 0;
145 protected:
146     QLabel *nameLabel;
147     QString name;
148     QString input;
149     QString output;
150     bool b_enabled;
151     int type;
152     VLMDialog *parent;
153     virtual void enterEvent( QEvent * );
154     QGridLayout *objLayout;
155 private slots:
156     virtual void modify();
157     virtual void del();
158 };
159
160 class VLMBroadcast : public VLMAWidget
161 {
162     Q_OBJECT
163     friend class VLMDialog;
164 public:
165     VLMBroadcast( QString name, QString input, QString output,
166             bool _enable, bool _loop, VLMDialog *parent );
167     void update();
168 private:
169     bool b_looped;
170     bool b_playing;
171     QToolButton *loopButton, *playButton;
172 private slots:
173     void stop();
174     void togglePlayPause();
175     void toggleLoop();
176 };
177
178 class VLMVod : public VLMAWidget
179 {
180     Q_OBJECT
181     friend class VLMDialog;
182 public:
183     VLMVod( QString name, QString input, QString output,
184             bool _enable, QString _mux, VLMDialog *parent );
185     void update();
186 private:
187     QString mux;
188     QLabel *muxLabel;
189 };
190
191 class VLMSchedule : public VLMAWidget
192 {
193     friend class VLMDialog;
194 public:
195     VLMSchedule( QString name, QString input, QString output, bool _enable, VLMDialog *parent );
196     void update();
197 private:
198     
199 };
200
201 #endif