]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/vlm.hpp
92f02bd21209e9ee7d88d0c32f010cb51e049938
[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 "config.h"
29
30 #include <vlc/vlc.h>
31
32 #include <vlc_vlm.h>
33
34 #ifdef ENABLE_VLM
35
36 #include "ui/vlm.h"
37 #include "util/qvlcframe.hpp"
38
39 enum{
40     QVLM_Broadcast,
41     QVLM_Schedule,
42     QVLM_VOD
43 };
44
45 enum{
46     ControlBroadcastPlay,
47     ControlBroadcastPause,
48     ControlBroadcastStop,
49     ControlBroadcastSeek
50 };
51
52 class QComboBox;
53 class QVBoxLayout;
54 class QStackedWidget;
55 class QLabel;
56 class QGridLayout;
57 class QLineEdit;
58 class QCheckBox;
59 class QToolButton;
60 class QGroupBox;
61 class QPushButton;
62 class QHBoxLayout;
63 class QDateTimeEdit;
64 class QSpinBox;
65 class VLMAWidget;
66 class VLMWrapper;
67
68
69 class VLMDialog : public QVLCDialog
70 {
71     Q_OBJECT;
72 public:
73     static VLMDialog * getInstance( intf_thread_t *p_intf )
74     {
75         if( !instance)
76              instance = new VLMDialog( (QWidget *)p_intf->p_sys->p_mi, p_intf );
77         return instance;
78     };
79     virtual ~VLMDialog();
80
81     VLMWrapper *vlmWrapper;
82     vlm_t *p_vlm;
83 private:
84     VLMDialog( QWidget *, intf_thread_t * );
85     static VLMDialog *instance;
86     Ui::Vlm ui;
87
88     QList<VLMAWidget *> vlmItems;
89     int currentIndex;
90
91     QVBoxLayout *vlmItemLayout;
92     QWidget *vlmItemWidget;
93
94     QComboBox *mediatype;
95     QDateTimeEdit *time, *date, *repeatTime;
96     QSpinBox *scherepeatnumber, *repeatDays;
97     bool isNameGenuine( QString );
98 public slots:
99     void removeVLMItem( VLMAWidget * );
100     void startModifyVLMItem( VLMAWidget * );
101 private slots:
102     void addVLMItem();
103     void clearWidgets();
104     void saveModifications();
105     void showScheduleWidget( int );
106     void selectVLMItem( int );
107     void selectInput();
108     void selectOutput();
109 };
110
111 class VLMWrapper
112 {
113 public:
114     VLMWrapper( vlm_t * );
115     virtual ~VLMWrapper();
116
117     static void AddBroadcast( const QString, const QString, const QString,
118                        bool b_enabled = true,
119                        bool b_loop = false );
120     static void EditBroadcast( const QString, const QString, const QString,
121                        bool b_enabled = true,
122                        bool b_loop = false );
123     static void AddVod( const QString, const QString, const QString,
124                        bool b_enabled = true, QString mux = "" );
125     static void EditVod( const QString, const QString, const QString,
126                        bool b_enabled = true, QString mux = "" );
127
128     static void ControlBroadcast( const QString, int, unsigned int seek = 0 );
129     static void EnableItem( const QString, bool );
130
131     /* We don't have yet the accessors in the core, so the following is commented */
132     //unsigned int NbMedia() { if( p_vlm ) return p_vlm->i_media; return 0; }
133    /* vlm_media_t *GetMedia( int i )
134     { if( p_vlm ) return p_vlm->media[i]; return NULL; }*/
135
136 private:
137     static vlm_t *p_vlm;
138 };
139
140 class VLMAWidget : public QGroupBox
141 {
142     Q_OBJECT
143     friend class VLMDialog;
144 public:
145     VLMAWidget( QString name, QString input, QString output,
146             bool _enable, VLMDialog *parent, int _type = QVLM_Broadcast );
147     virtual void update() = 0;
148 protected:
149     QLabel *nameLabel;
150     QString name;
151     QString input;
152     QString output;
153     bool b_enabled;
154     int type;
155     VLMDialog *parent;
156     virtual void enterEvent( QEvent * );
157     QGridLayout *objLayout;
158 private slots:
159     virtual void modify();
160     virtual void del();
161     virtual void toggleEnabled( bool );
162 };
163
164 class VLMBroadcast : public VLMAWidget
165 {
166     Q_OBJECT
167     friend class VLMDialog;
168 public:
169     VLMBroadcast( QString name, QString input, QString output,
170             bool _enable, bool _loop, VLMDialog *parent );
171     void update();
172 private:
173     bool b_looped;
174     bool b_playing;
175     QToolButton *loopButton, *playButton;
176 private slots:
177     void stop();
178     void togglePlayPause();
179     void toggleLoop();
180 };
181
182 class VLMVod : public VLMAWidget
183 {
184     Q_OBJECT
185     friend class VLMDialog;
186 public:
187     VLMVod( QString name, QString input, QString output,
188             bool _enable, QString _mux, VLMDialog *parent );
189     void update();
190 private:
191     QString mux;
192     QLabel *muxLabel;
193 };
194
195 class VLMSchedule : public VLMAWidget
196 {
197     friend class VLMDialog;
198 public:
199     VLMSchedule( QString name, QString input, QString output, bool _enable, VLMDialog *parent );
200     void update();
201 private:
202
203 };
204
205 #endif
206
207 #endif
208