interface_widgets.hpp 4.94 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"
38

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

41
#include <QWidget>
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 ****************/
53
class VideoWidget : public QFrame
54
{
55
    Q_OBJECT
56 57
friend class MainInterface;

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

62 63
    WId request( vout_thread_t *, int *, int *,
                 unsigned int *, unsigned int *, bool );
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 84
public slots:
    void SetSizing( unsigned int, unsigned int );
85

86 87
};

88
/******************** Background Widget ****************/
89
class BackgroundWidget : public QWidget
90 91 92 93 94
{
    Q_OBJECT
public:
    BackgroundWidget( intf_thread_t * );
    virtual ~BackgroundWidget();
95

96 97 98
private:
    QPalette plt;
    QLabel *label;
99
    virtual void contextMenuEvent( QContextMenuEvent *event );
100
    intf_thread_t *p_intf;
101
    virtual void resizeEvent( QResizeEvent * event );
102

103
public slots:
104
    void toggle(){ TOGGLEV( this ); }
105
    void updateArt( const QString& );
106 107
};

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

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

152 153 154 155
class SpeedLabel : public QLabel
{
    Q_OBJECT
public:
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
156
    SpeedLabel( intf_thread_t *, const QString&, QWidget * );
157
    virtual ~SpeedLabel();
158 159

protected:
160
    virtual void mousePressEvent ( QMouseEvent * event )
161
    {
162
        showSpeedMenu( event->pos() );
163
    }
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( const QString& );
212 213 214 215 216

signals:
    void updateRequested();
};

217
#endif