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