interface_widgets.hpp 5.57 KB
Newer Older
1
/*****************************************************************************
2
 * interface_widgets.hpp : Custom widgets for the main interface
3
 ****************************************************************************
4
5
 * Copyright (C) 2006 the VideoLAN team
 * $Id$
6
7
 *
 * Authors: Clément Stenac <zorglub@videolan.org>
8
 *          Jean-Baptiste Kempf <jb@videolan.org>
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *
 * 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.
 *****************************************************************************/

25
26
#ifndef _INTFWIDGETS_H_
#define _INTFWIDGETS_H_
27
28

#include <vlc/vlc.h>
zorglub's avatar
zorglub committed
29
#include <vlc_interface.h>
zorglub's avatar
zorglub committed
30

31
#include <vlc_aout.h>
zorglub's avatar
zorglub committed
32
33
#include "qt4.hpp"

34
#include <QWidget>
zorglub's avatar
zorglub committed
35
#include <QFrame>
36

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
37
38
39
class ResizeEvent;
class QPalette;
class QPixmap;
zorglub's avatar
zorglub committed
40
class QLabel;
41
42
class QHBoxLayout;

43
/******************** Video Widget ****************/
zorglub's avatar
zorglub committed
44
class VideoWidget : public QFrame
45
{
zorglub's avatar
zorglub committed
46
    Q_OBJECT
47
public:
48
    VideoWidget( intf_thread_t * );
49
50
    virtual ~VideoWidget();

51
    void *request( vout_thread_t *, int *, int *,
52
                   unsigned int *, unsigned int * );
53
54
    void release( void * );
    int control( void *, int, va_list );
55

56
    int i_video_height, i_video_width;
zorglub's avatar
zorglub committed
57
    vout_thread_t *p_vout;
58
59
60

    QSize widgetSize;
    virtual QSize sizeHint() const;
61
62
63
64
private:
    QWidget *frame;
    intf_thread_t *p_intf;
    vlc_mutex_t lock;
65
66
67
68
signals:
    void askResize();
private slots:
    void SetMinSize();
69
70
};

71
/******************** Background Widget ****************/
72
73
74
75
76
77
class BackgroundWidget : public QFrame
{
    Q_OBJECT
public:
    BackgroundWidget( intf_thread_t * );
    virtual ~BackgroundWidget();
78
79
    QSize widgetSize;
    virtual QSize sizeHint() const;
80
81
82
83
84
85
86
87
private:
    QPalette plt;
    QLabel *label;
    QHBoxLayout *backgroundLayout;
    virtual void resizeEvent( QResizeEvent *e );
    int DrawBackground();
    int CleanBackground();
    intf_thread_t *p_intf;
88
89
private slots:
    void setArt( QString );
90
91
};

zorglub's avatar
zorglub committed
92
93
94
95
96
97
98
99
class VisualSelector : public QFrame
{
    Q_OBJECT
public:
    VisualSelector( intf_thread_t *);
    virtual ~VisualSelector();
private:
    intf_thread_t *p_intf;
zorglub's avatar
zorglub committed
100
101
102
103
    QLabel *current;
private slots:
    void prev();
    void next();
zorglub's avatar
zorglub committed
104
};
105

zorglub's avatar
zorglub committed
106
class QPushButton;
107
class AdvControlsWidget : public QFrame
zorglub's avatar
zorglub committed
108
109
110
{
    Q_OBJECT
public:
111
112
    AdvControlsWidget( intf_thread_t *);
    virtual ~AdvControlsWidget();
zorglub's avatar
zorglub committed
113
114
115
116
    void enableInput( bool );
    void enableVideo( bool );
private:
    intf_thread_t *p_intf;
117
118
    QPushButton *normalButton, *recordButton, *ABButton;
    QPushButton *snapshotButton, *frameButton;
zorglub's avatar
zorglub committed
119
120
121
private slots:
    void normal();
    void snapshot();
122
    void frame();
123
    void fromAtoB();
124
    void record();
zorglub's avatar
zorglub committed
125
126
};

127
128
129
130
131
132
133
134
class InputSlider;
class QSlider;
class QGridLayout;
class VolumeClickHandler;
class ControlsWidget : public QFrame
{
    Q_OBJECT
public:
135
    ControlsWidget( intf_thread_t *, bool );
136
137
138
139
140
    virtual ~ControlsWidget();

    QPushButton *playlistButton;
    QSlider *volumeSlider;
    void setStatus( int );
141
    void enableInput( bool );
142
    void enableVideo( bool );
143
144
145
146
147
148
149
public slots:
    void setNavigation( int );
    void updateOnTimer();
protected:
    friend class MainInterface;
    friend class VolumeClickHandler;
private:
150
151
152
    intf_thread_t       *p_intf;
    QFrame              *discFrame;
    QGridLayout         *controlLayout;
153
    InputSlider         *slider;
154
155
156
157
    QPushButton         *prevSectionButton, *nextSectionButton, *menuButton;
    QPushButton         *playButton, *fullscreenButton;
    QPushButton         *slowerButton, *fasterButton;
    AdvControlsWidget   *advControls;
158
    QLabel              *volMuteLabel;
159
160

    bool                 b_advancedVisible;
161
162
163
164
165
166
167
168
169
private slots:
    void play();
    void stop();
    void prev();
    void next();
    void updateVolume( int );
    void fullscreen();
    void extSettings();
    void prefs();
170
171
    void faster();
    void slower();
172
173
    void toggleAdvanced();
signals:
174
    void advancedControlsToggled( bool );
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
};

class VolumeClickHandler : public QObject
{
public:
    VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
    {m = _m; p_intf = _p_intf; }
    virtual ~VolumeClickHandler() {};
    bool eventFilter( QObject *obj, QEvent *e )
    {
        if (e->type() == QEvent::MouseButtonPress )
        {
            aout_VolumeMute( p_intf, NULL );
            return true;
        }
        return false;
    }
private:
    ControlsWidget *m;
    intf_thread_t *p_intf;
};

zorglub's avatar
zorglub committed
197

zorglub's avatar
zorglub committed
198
/******************** Playlist Widgets ****************/
199
#include <QModelIndex>
200
#include <QSplitter>
201
202
203
class QSignalMapper;
class PLSelector;
class PLPanel;
zorglub's avatar
zorglub committed
204
class QPushButton;
205

206
class PlaylistWidget : public QSplitter
207
208
209
{
    Q_OBJECT;
public:
210
    PlaylistWidget( intf_thread_t *_p_i ) ;
211
212
213
214
215
216
    virtual ~PlaylistWidget();
    QSize widgetSize;
    virtual QSize sizeHint() const;
private:
    PLSelector *selector;
    PLPanel *rightPanel;
zorglub's avatar
zorglub committed
217
    QPushButton *addButton;
218
    QLabel *art;
zorglub's avatar
zorglub committed
219
    QString prevArt;
220
221
protected:
     intf_thread_t *p_intf;
222
223
private slots:
    void setArt( QString );
zorglub's avatar
zorglub committed
224
225
signals:
    void rootChanged( int );
226
    void artSet( QString );
227
};
228

229
#endif