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