]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/controller_widget.hpp
38bb76f386a7ca235bedf0964f39fe0129d5eae1
[vlc] / modules / gui / qt4 / components / controller_widget.hpp
1 /*****************************************************************************
2  * Controller_widget.cpp : Controller Widget for the controllers
3  ****************************************************************************
4  * Copyright (C) 2006-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Jean-Baptiste Kempf <jb@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef _CONTROLLER_WIDGET_H_
25 #define _CONTROLLER_WIDGET_H_
26
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include "qt4.hpp"
32
33 #include <QWidget>
34 #include <QToolButton>
35
36 #define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media")
37
38 class QLabel;
39 class QSpinBox;
40 class QAbstractSlider;
41
42 /**
43  * SPECIAL Widgets that are a bit more than just a ToolButton
44  * and have an icon/behaviour that changes depending on the context:
45  * - playButton
46  * - A->B Button
47  * - Teletext group buttons
48  * - Sound Widget group
49  **/
50 class PlayButton : public QToolButton
51 {
52     Q_OBJECT
53 private slots:
54     void updateButton( bool );
55 };
56
57 class AtoB_Button : public QToolButton
58 {
59     Q_OBJECT
60 private slots:
61     void setIcons( bool, bool );
62 };
63
64 class TeletextController : public QWidget
65 {
66     Q_OBJECT
67     friend class AbstractController;
68 private:
69     QToolButton         *telexTransparent, *telexOn;
70     QSpinBox            *telexPage;
71
72 private slots:
73     void enableTeletextButtons( bool );
74     void toggleTeletextTransparency( bool );
75 };
76
77 #define VOLUME_MAX 200
78 class VolumeClickHandler;
79
80 class SoundWidget : public QWidget
81 {
82     Q_OBJECT
83     friend class VolumeClickHandler;
84
85 public:
86     SoundWidget( QWidget *parent, intf_thread_t  *_p_i, bool );
87
88 private:
89     intf_thread_t       *p_intf;
90     QLabel              *volMuteLabel;
91     QAbstractSlider     *volumeSlider;
92     VolumeClickHandler  *hVolLabel;
93     bool                 b_my_volume;
94
95 protected slots:
96     void updateVolume( int );
97     void updateVolume( void );
98 };
99
100 class VolumeClickHandler : public QObject
101 {
102 public:
103     VolumeClickHandler( intf_thread_t *_p_intf, SoundWidget *_m ) : QObject(_m)
104     {m = _m; p_intf = _p_intf; }
105     virtual ~VolumeClickHandler() {};
106     virtual bool eventFilter( QObject *obj, QEvent *e );
107 private:
108     SoundWidget *m;
109     intf_thread_t *p_intf;
110 };
111
112 #endif