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