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

26
27
#ifndef _INTFWIDGETS_H_
#define _INTFWIDGETS_H_
28

Christophe Mutricy's avatar
Christophe Mutricy committed
29
30
31
32
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

33
34
#include "main_interface.hpp" /* Interface integration */
#include "input_manager.hpp"  /* Speed control */
35

36
#include "components/controller.hpp"
37
#include "components/controller_widget.hpp"
zorglub's avatar
zorglub committed
38

39
40
//#include <vlc_aout.h> Visualizer

41
#include <QWidget>
zorglub's avatar
zorglub committed
42
#include <QFrame>
43
44
#include <QLabel>
#include <QMouseEvent>
45

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
46
47
48
class ResizeEvent;
class QPalette;
class QPixmap;
49
class QHBoxLayout;
50
class QMenu;
51

52
/******************** Video Widget ****************/
zorglub's avatar
zorglub committed
53
class VideoWidget : public QFrame
54
{
zorglub's avatar
zorglub committed
55
    Q_OBJECT
56
57
friend class MainInterface;

58
public:
59
    VideoWidget( intf_thread_t * );
60
61
    virtual ~VideoWidget();

62
    void *request( vout_thread_t *, int *, int *,
63
                   unsigned int *, unsigned int * );
64
    void  release( void );
65
    int   control( void *, int, va_list );
66

67
    virtual QSize sizeHint() const;
68
69
70
71
72
73
74
75
76

protected:
    virtual QPaintEngine *paintEngine() const
    {
        return NULL;
    }

    virtual void paintEvent(QPaintEvent *);

77
78
private:
    intf_thread_t *p_intf;
79
    vout_thread_t *p_vout;
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
80

81
    QSize videoSize;
82

83
signals:
84
    void askVideoWidgetToShow( unsigned int, unsigned int );
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
85

86
87
public slots:
    void SetSizing( unsigned int, unsigned int );
88

89
90
};

91
/******************** Background Widget ****************/
92
class BackgroundWidget : public QWidget
93
94
95
96
97
{
    Q_OBJECT
public:
    BackgroundWidget( intf_thread_t * );
    virtual ~BackgroundWidget();
98

99
100
101
private:
    QPalette plt;
    QLabel *label;
102
    virtual void contextMenuEvent( QContextMenuEvent *event );
103
    intf_thread_t *p_intf;
104
    virtual void resizeEvent( QResizeEvent * event );
105

106
public slots:
107
    void toggle(){ TOGGLEV( this ); }
108
    void updateArt( QString );
109
110
};

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
111
#if 0
zorglub's avatar
zorglub committed
112
113
114
115
116
117
118
119
class VisualSelector : public QFrame
{
    Q_OBJECT
public:
    VisualSelector( intf_thread_t *);
    virtual ~VisualSelector();
private:
    intf_thread_t *p_intf;
zorglub's avatar
zorglub committed
120
121
122
123
    QLabel *current;
private slots:
    void prev();
    void next();
zorglub's avatar
zorglub committed
124
};
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
125
#endif
126

127
128
129
class TimeLabel : public QLabel
{
    Q_OBJECT
130
131
132
133
public:
    TimeLabel( intf_thread_t *_p_intf );
protected:
    virtual void mousePressEvent( QMouseEvent *event )
134
    {
135
        toggleTimeDisplay();
136
    }
137
    virtual void mouseDoubleClickEvent( QMouseEvent *event )
138
    {
139
        toggleTimeDisplay();
140
141
        emit timeLabelDoubleClicked();
    }
142
143
144
145
private:
    intf_thread_t *p_intf;
    bool b_remainingTime;
    void toggleTimeDisplay();
146
signals:
147
    void timeLabelDoubleClicked();
148
149
private slots:
    void setDisplayPosition( float pos, int time, int length );
150
    void setCaching( float );
151
};
zorglub's avatar
zorglub committed
152

153
154
155
156
class SpeedLabel : public QLabel
{
    Q_OBJECT
public:
157
    SpeedLabel( intf_thread_t *, const QString );
158
159
160
161
162
163

protected:
    virtual void mouseDoubleClickEvent ( QMouseEvent * event )
    {
        THEMIM->getIM()->setRate( INPUT_RATE_DEFAULT );
    }
164
165
166
private slots:
    void showSpeedMenu( QPoint );
    void setRate( int );
167
168
private:
    intf_thread_t *p_intf;
169
170
    QMenu *speedControlMenu;
    SpeedControlWidget *speedControl;
171
};
172

173
174
175
176
177
/******************** Speed Control Widgets ****************/
class SpeedControlWidget : public QFrame
{
    Q_OBJECT
public:
178
    SpeedControlWidget( intf_thread_t *, QWidget * );
179
180
181
182
    void updateControls( int );
private:
    intf_thread_t *p_intf;
    QSlider *speedSlider;
183

184
public slots:
185
    void activateOnState();
186

187
188
189
190
191
private slots:
    void updateRate( int );
    void resetRate();
};

192
193
194
195
class CoverArtLabel : public QLabel
{
    Q_OBJECT
public:
196
    CoverArtLabel( QWidget *parent, intf_thread_t * );
197
    virtual ~CoverArtLabel();
198

199
private:
200
    intf_thread_t *p_intf;
201
202
203

public slots:
    void requestUpdate() { emit updateRequested(); };
204
    void update( )
205
206
207
    {
        requestUpdate();
    }
208
209
210

private slots:
    void doUpdate();
211
    void doUpdate(QString);
212
213
214
215
216

signals:
    void updateRequested();
};

217
#endif