1 /*****************************************************************************
2 * interface_widgets.hpp : Custom widgets for the main interface
3 ****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste Kempf <jb@videolan.org>
9 * Rafaël Carré <funman@videolanorg>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
26 #ifndef _CONTROLLER_H_
27 #define _CONTROLLER_H_
33 #include <vlc_common.h>
34 #include <vlc_interface.h>
37 #include "main_interface.hpp"
38 #include "input_manager.hpp"
42 #include <QToolButton>
49 class QAbstractSlider;
51 class QAbstractButton;
53 class VolumeClickHandler;
56 typedef enum buttonType_e
82 typedef enum actionType_e
99 class AbstractController : public QFrame
103 AbstractController( intf_thread_t *_p_i );
104 virtual ~AbstractController() {};
107 intf_thread_t *p_intf;
109 QSignalMapper *toolbarActionsMapper;
110 QGridLayout *controlLayout;
112 QWidget *createWidget( buttonType_e, bool b_flat = false,
113 bool b_big = false, bool b_shiny = false );
114 void setupButton( QAbstractButton * );
117 QWidget *discFrame();
118 QWidget *telexFrame();
121 void doAction( int );
139 virtual void setStatus( int );
142 void inputExists( bool ); /// This might be usefull in the IM ?
143 void inputPlaying( bool ); /// This might be usefull in the IM ?
144 void inputIsRecordable( bool ); /// same ?
147 class PlayButton : public QToolButton
151 void updateButton( bool );
154 class AtoB_Button : public QToolButton
158 void setIcons( bool, bool );
161 class TeletextController : public QWidget
164 friend class AbstractController;
166 QToolButton *telexTransparent, *telexOn;
170 void enableTeletextButtons( bool );
171 void toggleTeletextTransparency( bool );
174 class SoundWidget : public QWidget
177 friend class VolumeClickHandler;
180 SoundWidget( intf_thread_t *_p_i, bool );
183 intf_thread_t *p_intf;
184 QLabel *volMuteLabel;
185 QAbstractSlider *volumeSlider;
186 VolumeClickHandler *hVolLabel;
190 void updateVolume( int );
191 void updateVolume( void );
194 /* Advanced Button Bar */
195 class AdvControlsWidget : public AbstractController
199 AdvControlsWidget( intf_thread_t * );
200 virtual ~AdvControlsWidget();
204 class ControlsWidget : public AbstractController
208 /* p_intf, advanced control visible or not, blingbling or not */
209 ControlsWidget( intf_thread_t *_p_i, bool b_advControls );
210 virtual ~ControlsWidget();
213 friend class MainInterface;
215 AdvControlsWidget *advControls;
216 bool b_advancedVisible;
219 void toggleAdvanced();
222 void advancedControlsToggled( bool );
225 /* on WIN32 hide() for fullscreen controller doesnt work, so it have to be
226 done by trick with setting the opacity of window */
231 /* to trying transparency with fullscreen controller on windows enable that */
232 /* it can be enabled on-non windows systems,
233 but it will be transparent only with composite manager */
235 #define HAVE_TRANSPARENCY 1
237 #define HAVE_TRANSPARENCY 0
240 /* Default value of opacity for FS controller */
241 #define DEFAULT_OPACITY 0.75
243 /***********************************
244 * Fullscreen controller
245 ***********************************/
246 class FullscreenControllerWidget : public AbstractController
250 FullscreenControllerWidget( intf_thread_t * );
251 virtual ~FullscreenControllerWidget();
254 vout_thread_t *p_vout;
255 void attachVout( vout_thread_t *p_vout );
257 void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
259 int i_mouse_last_move_x;
260 int i_mouse_last_move_y;
263 friend class MainInterface;
265 virtual void mouseMoveEvent( QMouseEvent *event );
266 virtual void mousePressEvent( QMouseEvent *event );
267 virtual void enterEvent( QEvent *event );
268 virtual void leaveEvent( QEvent *event );
269 virtual void keyPressEvent( QKeyEvent *event );
278 virtual void customEvent( QEvent *event );
281 #if HAVE_TRANSPARENCY
282 QTimer *p_slowHideTimer;
283 bool b_slow_hide_begin;
284 int i_slow_hide_timeout;
287 int i_mouse_last_x, i_mouse_last_y;
295 /* Shared variable between FSC and VLC (protected by a lock) */
298 int i_hide_timeout; /* FSC hiding timeout, same as mouse hiding timeout */