]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/vlm.hpp
Qt4 - VLM. enable/disable from the list controls the VLM. small fixes and correction...
[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 };
103
104 class VLMWrapper
105 {
106 public:
107     VLMWrapper( vlm_t * );
108     virtual ~VLMWrapper();
109
110     static void AddBroadcast( const QString, const QString, const QString,
111                        bool b_enabled = true,
112                        bool b_loop = false );
113     static void EditBroadcast( const QString, const QString, const QString,
114                        bool b_enabled = true,
115                        bool b_loop = false );
116     static void AddVod( const QString, const QString, const QString,
117                        bool b_enabled = true, QString mux = "" );
118     static void EditVod( const QString, const QString, const QString,
119                        bool b_enabled = true, QString mux = "" );
120
121     static void ControlBroadcast( const QString, int, unsigned int seek = 0 );
122     static void EnableItem( const QString, bool );
123
124     /* We don't have yet the accessors in the core, so the following is commented */
125     //unsigned int NbMedia() { if( p_vlm ) return p_vlm->i_media; return 0; }
126    /* vlm_media_t *GetMedia( int i )
127     { if( p_vlm ) return p_vlm->media[i]; return NULL; }*/
128
129 private:
130     static vlm_t *p_vlm;
131 };
132
133 class VLMAWidget : public QGroupBox 
134 {
135     Q_OBJECT
136     friend class VLMDialog;
137 public:
138     VLMAWidget( QString name, QString input, QString output,
139             bool _enable, VLMDialog *parent, int _type = QVLM_Broadcast );
140     virtual void update() = 0;
141 protected:
142     QLabel *nameLabel;
143     QString name;
144     QString input;
145     QString output;
146     bool b_enabled;
147     int type;
148     VLMDialog *parent;
149     virtual void enterEvent( QEvent * );
150     QGridLayout *objLayout;
151 private slots:
152     virtual void modify();
153     virtual void del();
154     virtual void toggleEnabled( bool );
155 };
156
157 class VLMBroadcast : public VLMAWidget
158 {
159     Q_OBJECT
160     friend class VLMDialog;
161 public:
162     VLMBroadcast( QString name, QString input, QString output,
163             bool _enable, bool _loop, VLMDialog *parent );
164     void update();
165 private:
166     bool b_looped;
167     bool b_playing;
168     QToolButton *loopButton, *playButton;
169 private slots:
170     void stop();
171     void togglePlayPause();
172     void toggleLoop();
173 };
174
175 class VLMVod : public VLMAWidget
176 {
177     Q_OBJECT
178     friend class VLMDialog;
179 public:
180     VLMVod( QString name, QString input, QString output,
181             bool _enable, QString _mux, VLMDialog *parent );
182     void update();
183 private:
184     QString mux;
185     QLabel *muxLabel;
186 };
187
188 class VLMSchedule : public VLMAWidget
189 {
190     friend class VLMDialog;
191 public:
192     VLMSchedule( QString name, QString input, QString output, bool _enable, VLMDialog *parent );
193     void update();
194 private:
195     
196 };
197
198 #endif