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
89 typedef enum actionType_e
116 class AbstractController : public QFrame
120 AbstractController( intf_thread_t *_p_i );
121 int getWidth() { return controlLayout->columnCount(); }
124 intf_thread_t *p_intf;
126 QSignalMapper *toolbarActionsMapper;
127 QGridLayout *controlLayout;
129 AdvControlsWidget *advControls;
131 void parseAndCreateLine( QString config, int i_line );
134 QWidget *createWidget( buttonType_e, int *i_size,
135 int options = WIDGET_NORMAL );
136 void setupButton( QAbstractButton * );
137 QWidget *discFrame();
138 QWidget *telexFrame();
141 void doAction( int );
158 virtual void setStatus( int );
161 void inputExists( bool ); /// This might be usefull in the IM ?
162 void inputPlaying( bool ); /// This might be usefull in the IM ?
163 void inputIsRecordable( bool ); /// same ?
167 * SPECIAL Widgets that are a bit more than just a ToolButton
168 * and have an icon/behaviour that changes depending on the context:
171 * - Teletext group buttons
172 * - Sound Widget group
174 class PlayButton : public QToolButton
178 void updateButton( bool );
181 class AtoB_Button : public QToolButton
185 void setIcons( bool, bool );
188 class TeletextController : public QWidget
191 friend class AbstractController;
193 QToolButton *telexTransparent, *telexOn;
197 void enableTeletextButtons( bool );
198 void toggleTeletextTransparency( bool );
201 class SoundWidget : public QWidget
204 friend class VolumeClickHandler;
207 SoundWidget( intf_thread_t *_p_i, bool );
210 intf_thread_t *p_intf;
211 QLabel *volMuteLabel;
212 QAbstractSlider *volumeSlider;
213 VolumeClickHandler *hVolLabel;
217 void updateVolume( int );
218 void updateVolume( void );
221 /* Advanced Button Bar */
222 class AdvControlsWidget : public AbstractController
226 AdvControlsWidget( intf_thread_t * );
230 class InputControlsWidget : public AbstractController
234 InputControlsWidget( intf_thread_t * );
238 class ControlsWidget : public AbstractController
242 /* p_intf, advanced control visible or not, blingbling or not */
243 ControlsWidget( intf_thread_t *_p_i, bool b_advControls );
244 virtual ~ControlsWidget();
247 friend class MainInterface;
249 bool b_advancedVisible;
252 void toggleAdvanced();
255 void advancedControlsToggled( bool );
258 /* on WIN32 hide() for fullscreen controller doesnt work, so it have to be
259 done by trick with setting the opacity of window */
264 /* to trying transparency with fullscreen controller on windows enable that */
265 /* it can be enabled on-non windows systems,
266 but it will be transparent only with composite manager */
268 #define HAVE_TRANSPARENCY 1
270 #define HAVE_TRANSPARENCY 0
273 /* Default value of opacity for FS controller */
274 #define DEFAULT_OPACITY 0.75
276 /***********************************
277 * Fullscreen controller
278 ***********************************/
279 class FullscreenControllerWidget : public AbstractController
283 FullscreenControllerWidget( intf_thread_t * );
284 virtual ~FullscreenControllerWidget();
287 vout_thread_t *p_vout;
288 void attachVout( vout_thread_t *p_vout );
290 void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
292 int i_mouse_last_move_x;
293 int i_mouse_last_move_y;
296 friend class MainInterface;
298 virtual void mouseMoveEvent( QMouseEvent *event );
299 virtual void mousePressEvent( QMouseEvent *event );
300 virtual void enterEvent( QEvent *event );
301 virtual void leaveEvent( QEvent *event );
302 virtual void keyPressEvent( QKeyEvent *event );
311 virtual void customEvent( QEvent *event );
314 #if HAVE_TRANSPARENCY
315 QTimer *p_slowHideTimer;
316 bool b_slow_hide_begin;
317 int i_slow_hide_timeout;
320 int i_mouse_last_x, i_mouse_last_y;
328 /* Shared variable between FSC and VLC (protected by a lock) */
331 int i_hide_timeout; /* FSC hiding timeout, same as mouse hiding timeout */