]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/controller_widget.hpp
d6c622c0c2bb94d7188ddc682dc67028be5f38d0
[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 <QFrame>
35 #include <QToolButton>
36
37 #define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media")
38
39 class QLabel;
40 class QSpinBox;
41 class QAbstractSlider;
42
43 /**
44  * SPECIAL Widgets that are a bit more than just a ToolButton
45  * and have an icon/behaviour that changes depending on the context:
46  * - playButton
47  * - A->B Button
48  * - Teletext group buttons
49  * - Sound Widget group
50  **/
51 class PlayButton : public QToolButton
52 {
53     Q_OBJECT
54 private slots:
55     void updateButton( bool );
56 };
57
58 class AtoB_Button : public QToolButton
59 {
60     Q_OBJECT
61 private slots:
62     void setIcons( bool, bool );
63 };
64
65 class TeletextController : public QFrame
66 {
67     Q_OBJECT
68     friend class AbstractController;
69 private:
70     QToolButton         *telexTransparent, *telexOn;
71     QSpinBox            *telexPage;
72
73 private slots:
74     void enableTeletextButtons( bool );
75     void toggleTeletextTransparency( bool );
76 };
77
78 #define VOLUME_MAX 200
79 class VolumeClickHandler;
80
81 class SoundWidget : public QWidget
82 {
83     Q_OBJECT
84     friend class VolumeClickHandler;
85
86 public:
87     SoundWidget( QWidget *parent, intf_thread_t  *_p_i, bool );
88
89 private:
90     intf_thread_t       *p_intf;
91     QLabel              *volMuteLabel;
92     QAbstractSlider     *volumeSlider;
93     VolumeClickHandler  *hVolLabel;
94     bool                 b_my_volume;
95
96 protected slots:
97     void updateVolume( int );
98     void updateVolume( void );
99 };
100
101 class VolumeClickHandler : public QObject
102 {
103 public:
104     VolumeClickHandler( intf_thread_t *_p_intf, SoundWidget *_m ) : QObject(_m)
105     {m = _m; p_intf = _p_intf; }
106     virtual ~VolumeClickHandler() {};
107     virtual bool eventFilter( QObject *obj, QEvent *e );
108 private:
109     SoundWidget *m;
110     intf_thread_t *p_intf;
111 };
112
113 #endif