File: vlm.hpp

package info (click to toggle)
vlc 2.2.7-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 191,124 kB
  • sloc: ansic: 356,116; cpp: 94,295; objc: 34,063; sh: 6,765; makefile: 4,272; xml: 1,538; asm: 1,251; python: 240; perl: 77; sed: 16
file content (237 lines) | stat: -rw-r--r-- 6,823 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/*****************************************************************************
 * vlm.hpp : VLM Management
 ****************************************************************************
 * Copyright ( C ) 2006 the VideoLAN team
 * $Id: dcf7110fe163dc8d0980c899b73dc8c2c8d45d4d $
 *
 * Authors: Jean-François Massol <jf.massol@gmail.com>
 *          Jean-Baptiste Kempf <jb@videolan.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * ( at your option ) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#ifndef QVLC_VLM_DIALOG_H_
#define QVLC_VLM_DIALOG_H_ 1

#include "qt4.hpp"

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#ifdef ENABLE_VLM

#include <vlc_vlm.h>

#include "ui/vlm.h"
#include "util/qvlcframe.hpp"
#include "util/singleton.hpp"
#include <QDateTime>

enum{
    QVLM_Broadcast,
    QVLM_Schedule,
    QVLM_VOD
};

enum{
    ControlBroadcastPlay,
    ControlBroadcastPause,
    ControlBroadcastStop,
    ControlBroadcastSeek
};

class QComboBox;
class QVBoxLayout;
class QStackedWidget;
class QLabel;
class QGridLayout;
class QLineEdit;
class QCheckBox;
class QToolButton;
class QGroupBox;
class QPushButton;
class QHBoxLayout;
class QDateTimeEdit;
class QSpinBox;
class VLMAWidget;
class VLMWrapper;


class VLMDialog : public QVLCFrame, public Singleton<VLMDialog>
{
    Q_OBJECT

public:
    void toggleVisible();

    VLMWrapper *vlmWrapper;
    vlm_t *p_vlm;
private:
    VLMDialog( intf_thread_t * );
    virtual ~VLMDialog();

    Ui::Vlm ui;

    QString inputOptions;

    QList<VLMAWidget *> vlmItems;
    int currentIndex;

    QVBoxLayout *vlmItemLayout;
    QWidget *vlmItemWidget;

    QComboBox *mediatype;
    QDateTimeEdit *time, *date, *repeatTime;
    QSpinBox *scherepeatnumber, *repeatDays;
    bool isNameGenuine( const QString& );
    void mediasPopulator();
public slots:
    void removeVLMItem( VLMAWidget * );
    void startModifyVLMItem( VLMAWidget * );
private slots:
    void addVLMItem();
    void clearWidgets();
    void saveModifications();
    void showScheduleWidget( int );
    void selectVLMItem( int );
    void selectInput();
    void selectOutput();
    bool exportVLMConf();
    bool importVLMConf();

    friend class    Singleton<VLMDialog>;
};

class VLMWrapper
{
public:
    VLMWrapper( vlm_t * );
    virtual ~VLMWrapper();

    static void AddBroadcast( const QString&, const QString&,
                              const QString&, const QString&,
                              bool b_enabled = true, bool b_loop = false );
    static void EditBroadcast( const QString&, const QString&,
                               const QString&, const QString&,
                               bool b_enabled = true, bool b_loop = false );
    static void EditSchedule( const QString&, const QString&,
                              const QString&, const QString&,
                              QDateTime _schetime, QDateTime _schedate,
                              int _scherepeatnumber, int _repeatDays,
                              bool b_enabled = true, const QString& mux = "" );
    static void AddVod( const QString&, const QString&,
                        const QString&, const QString&,
                        bool b_enabled = true, const QString& mux = "" );
    static void EditVod( const QString&, const QString&,
                         const QString&, const QString&,
                         bool b_enabled = true, const QString& mux = "" );
    static void AddSchedule( const QString&, const QString&,
                             const QString&, const QString&,
                             QDateTime _schetime, QDateTime _schedate,
                             int _scherepeatnumber, int _repeatDays,
                             bool b_enabled = true, const QString& mux = "" );

    static void ControlBroadcast( const QString&, int, unsigned int seek = 0 );
    static void EnableItem( const QString&, bool );

    /* We don't have yet the accessors in the core, so the following is commented */
    //unsigned int NbMedia() { if( p_vlm ) return p_vlm->i_media; return 0; }
   /* vlm_media_t *GetMedia( int i )
    { if( p_vlm ) return p_vlm->media[i]; return NULL; }*/

private:
    static vlm_t *p_vlm;
};

class VLMAWidget : public QGroupBox
{
    Q_OBJECT
    friend class VLMDialog;
public:
    VLMAWidget( const QString& name, const QString& input,
                const QString& inputOptions, const QString& output,
                bool _enable, VLMDialog *parent, int _type = QVLM_Broadcast );
    virtual void update() = 0;
protected:
    QLabel *nameLabel;
    QString name;
    QString input;
    QString inputOptions;
    QString output;
    bool b_enabled;
    int type;
    VLMDialog *parent;
    QGridLayout *objLayout;
private slots:
    virtual void modify();
    virtual void del();
    virtual void toggleEnabled( bool );
};

class VLMBroadcast : public VLMAWidget
{
    Q_OBJECT
    friend class VLMDialog;
public:
    VLMBroadcast( const QString& name, const QString& input,
                  const QString& inputOptions, const QString& output,
                  bool _enable, bool _loop, VLMDialog *parent );
    void update();
private:
    bool b_looped;
    bool b_playing;
    QToolButton *loopButton, *playButton;
private slots:
    void stop();
    void togglePlayPause();
    void toggleLoop();
};

class VLMVod : public VLMAWidget
{
    Q_OBJECT
    friend class VLMDialog;
public:
    VLMVod( const QString& name, const QString& input,
            const QString& inputOptions, const QString& output,
            bool _enable, const QString& _mux, VLMDialog *parent );
    void update();
private:
    QString mux;
    QLabel *muxLabel;
};

class VLMSchedule : public VLMAWidget
{
    Q_OBJECT
    friend class VLMDialog;
public:
    VLMSchedule( const QString& name, const QString& input,
                 const QString& inputOptions, const QString& output,
                 QDateTime schetime, QDateTime schedate, int repeatnumber,
                 int repeatdays, bool enabled, VLMDialog *parent );
    void update();
private:
    QDateTime schetime;
    QDateTime schedate;
    int rNumber;
    int rDays;
};

#endif

#endif