interface_widgets.hpp 5.2 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
/******************** Background Widget ****************/
68 69 70 71 72 73
class BackgroundWidget : public QFrame
{
    Q_OBJECT
public:
    BackgroundWidget( intf_thread_t * );
    virtual ~BackgroundWidget();
74 75
    QSize widgetSize;
    virtual QSize sizeHint() const;
76 77 78 79 80 81 82 83
private:
    QPalette plt;
    QLabel *label;
    QHBoxLayout *backgroundLayout;
    virtual void resizeEvent( QResizeEvent *e );
    int DrawBackground();
    int CleanBackground();
    intf_thread_t *p_intf;
84 85
private slots:
    void setArt( QString );
86 87
};

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

zorglub's avatar
zorglub committed
102
class QPushButton;
103
class AdvControlsWidget : public QFrame
zorglub's avatar
zorglub committed
104 105 106
{
    Q_OBJECT
public:
107 108
    AdvControlsWidget( intf_thread_t *);
    virtual ~AdvControlsWidget();
zorglub's avatar
zorglub committed
109 110 111 112
    void enableInput( bool );
    void enableVideo( bool );
private:
    intf_thread_t *p_intf;
113
    QPushButton *normalButton;
zorglub's avatar
zorglub committed
114 115 116 117 118 119 120
    QPushButton *fullscreenButton, *snapshotButton;
private slots:
    void normal();
    void snapshot();
    void fullscreen();
};

121 122 123 124 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:
    ControlsWidget( intf_thread_t *);
    virtual ~ControlsWidget();

    QPushButton *playlistButton;
    QSlider *volumeSlider;
    void setStatus( int );
135
    void enableInput( bool );
136
    void enableVideo( bool );
137 138 139 140 141 142 143 144 145 146 147 148
public slots:
    void setNavigation( int );
    void updateOnTimer();
protected:
    friend class MainInterface;
    friend class VolumeClickHandler;
private:
    intf_thread_t *p_intf;
    QFrame *discFrame;
    QGridLayout *controlLayout;
    InputSlider         *slider;
    QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
149
    QPushButton *playButton, *fullscreenButton;
150
    QPushButton *slowerButton, *fasterButton;
151 152 153 154 155 156 157 158 159
private slots:
    void play();
    void stop();
    void prev();
    void next();
    void updateVolume( int );
    void fullscreen();
    void extSettings();
    void prefs();
160 161
    void faster();
    void slower();
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
};

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
184

zorglub's avatar
zorglub committed
185
/******************** Playlist Widgets ****************/
186
#include <QModelIndex>
187
#include <QSplitter>
188 189 190
class QSignalMapper;
class PLSelector;
class PLPanel;
zorglub's avatar
zorglub committed
191
class QPushButton;
192

193
class PlaylistWidget : public QSplitter
194 195 196
{
    Q_OBJECT;
public:
197
    PlaylistWidget( intf_thread_t *_p_i ) ;
198 199 200 201 202 203
    virtual ~PlaylistWidget();
    QSize widgetSize;
    virtual QSize sizeHint() const;
private:
    PLSelector *selector;
    PLPanel *rightPanel;
zorglub's avatar
zorglub committed
204
    QPushButton *addButton;
205
    QLabel *art;
zorglub's avatar
zorglub committed
206
    QString prevArt;
207 208
protected:
     intf_thread_t *p_intf;
209 210
private slots:
    void setArt( QString );
zorglub's avatar
zorglub committed
211 212
signals:
    void rootChanged( int );
213
    void artSet( QString );
214
};
215

216
#endif