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