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;
58 typedef enum buttonType_e
88 typedef enum actionType_e
114 class AbstractController : public QFrame
118 AbstractController( intf_thread_t *_p_i );
119 int getWidth() { return controlLayout->columnCount(); }
122 intf_thread_t *p_intf;
124 QSignalMapper *toolbarActionsMapper;
125 QGridLayout *controlLayout;
127 AdvControlsWidget *advControls;
129 void parseAndCreateLine( QString config, int i_line );
132 QWidget *createWidget( buttonType_e, int *i_size,
133 int options = WIDGET_NORMAL );
134 void setupButton( QAbstractButton * );
135 QWidget *discFrame();
136 QWidget *telexFrame();
139 void doAction( int );
155 virtual void setStatus( int );
158 void inputExists( bool ); /// This might be usefull in the IM ?
159 void inputPlaying( bool ); /// This might be usefull in the IM ?
160 void inputIsRecordable( bool ); /// same ?
164 * SPECIAL Widgets that are a bit more than just a ToolButton
165 * and have an icon/behaviour that changes depending on the context:
168 * - Teletext group buttons
169 * - Sound Widget group
171 class PlayButton : public QToolButton
175 void updateButton( bool );
178 class AtoB_Button : public QToolButton
182 void setIcons( bool, bool );
185 class TeletextController : public QWidget
188 friend class AbstractController;
190 QToolButton *telexTransparent, *telexOn;
194 void enableTeletextButtons( bool );
195 void toggleTeletextTransparency( bool );
198 class SoundWidget : public QWidget
201 friend class VolumeClickHandler;
204 SoundWidget( intf_thread_t *_p_i, bool );
207 intf_thread_t *p_intf;
208 QLabel *volMuteLabel;
209 QAbstractSlider *volumeSlider;
210 VolumeClickHandler *hVolLabel;
214 void updateVolume( int );
215 void updateVolume( void );
218 /* Advanced Button Bar */
219 class AdvControlsWidget : public AbstractController
223 AdvControlsWidget( intf_thread_t * );
227 class InputControlsWidget : public AbstractController
231 InputControlsWidget( intf_thread_t * );
235 class ControlsWidget : public AbstractController
239 /* p_intf, advanced control visible or not, blingbling or not */
240 ControlsWidget( intf_thread_t *_p_i, bool b_advControls );
241 virtual ~ControlsWidget();
244 friend class MainInterface;
246 bool b_advancedVisible;
249 void toggleAdvanced();
252 void advancedControlsToggled( bool );
255 /* on WIN32 hide() for fullscreen controller doesnt work, so it have to be
256 done by trick with setting the opacity of window */
261 /* to trying transparency with fullscreen controller on windows enable that */
262 /* it can be enabled on-non windows systems,
263 but it will be transparent only with composite manager */
265 #define HAVE_TRANSPARENCY 1
267 #define HAVE_TRANSPARENCY 0
270 /* Default value of opacity for FS controller */
271 #define DEFAULT_OPACITY 0.75
273 /***********************************
274 * Fullscreen controller
275 ***********************************/
276 class FullscreenControllerWidget : public AbstractController
280 FullscreenControllerWidget( intf_thread_t * );
281 virtual ~FullscreenControllerWidget();
284 vout_thread_t *p_vout;
285 void attachVout( vout_thread_t *p_vout );
287 void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
289 int i_mouse_last_move_x;
290 int i_mouse_last_move_y;
293 friend class MainInterface;
295 virtual void mouseMoveEvent( QMouseEvent *event );
296 virtual void mousePressEvent( QMouseEvent *event );
297 virtual void enterEvent( QEvent *event );
298 virtual void leaveEvent( QEvent *event );
299 virtual void keyPressEvent( QKeyEvent *event );
308 virtual void customEvent( QEvent *event );
311 #if HAVE_TRANSPARENCY
312 QTimer *p_slowHideTimer;
313 bool b_slow_hide_begin;
314 int i_slow_hide_timeout;
317 int i_mouse_last_x, i_mouse_last_y;
325 /* Shared variable between FSC and VLC (protected by a lock) */
328 int i_hide_timeout; /* FSC hiding timeout, same as mouse hiding timeout */