1 /*****************************************************************************
2 * Controller.hpp : Controller 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_
38 #define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media")
47 class QAbstractSlider;
48 class QAbstractButton;
51 class VolumeClickHandler;
57 typedef enum buttonType_e
94 static const QString nameL[BUTTON_MAX] = { "Play", "Stop", "Open",
95 "Previous", "Next", "Slower", "Faster", "Fullscreen", "De-Fullscreen",
96 "Extended panel", "Playlist", "Snapshot", "Record", "A->B Loop",
97 "Frame By Frame", "Reverse", "Skip backward" , "Skip forward" };
98 static const QString tooltipL[BUTTON_MAX] = { I_PLAY_TOOLTIP,
99 _("Stop playback"), _("Open a media"),
100 _("Previous media in the playlist"),
101 _("Next media in the playlist"), _("Slower"), _("Faster"),
102 _("Toggle the video in fullscreen"), _("Toggle the video out fullscreen"),
103 _("Show extended settings" ), _( "Show playlist" ), _( "Take a snapshot" ),
104 _( "Record" ), _( "Loop from point A to point B continuously." ),
105 _("Frame by frame"), _("Reverse"), _("Skip backward"), _("Skip forward") };
106 static const QString iconL[BUTTON_MAX] ={ ":/play_b", ":/stop_b", ":/eject",
107 ":/previous_b", ":/next_b", ":/slower", ":/faster", ":/fullscreen",
108 ":/defullscreen", ":/extended", ":/playlist", ":/snapshot", ":/record",
109 ":/atob_nob", ":/frame", ":/reverse", ":/skip_back", ":/skip_fw" };
111 typedef enum actionType_e
140 class AdvControlsWidget;
141 class AbstractController : public QFrame
143 friend class WidgetListing; /* For ToolBar Edition HACKS */
147 AbstractController( intf_thread_t *_p_i, QWidget *_parent = 0 );
150 intf_thread_t *p_intf;
152 QSignalMapper *toolbarActionsMapper;
153 QHBoxLayout *controlLayout;
154 /* Change to BoxLayout if both dir are needed */
156 AdvControlsWidget *advControls;
158 void parseAndCreate( QString config, QBoxLayout *controlLayout );
160 virtual void createAndAddWidget( QBoxLayout *controlLayout, int i_index,
161 buttonType_e i_type, int i_option );
163 QWidget *createWidget( buttonType_e, int options = WIDGET_NORMAL );
165 static void setupButton( QAbstractButton * );
166 QWidget *discFrame();
167 QWidget *telexFrame();
170 virtual void doAction( int );
187 virtual void setStatus( int );
190 void inputExists( bool ); /// This might be usefull in the IM ?
191 void inputPlaying( bool ); /// This might be usefull in the IM ?
192 void inputIsRecordable( bool ); /// same ?
195 /* Advanced Button Bar */
196 class AdvControlsWidget : public AbstractController
200 AdvControlsWidget( intf_thread_t *, QWidget *_parent = 0 );
204 class InputControlsWidget : public AbstractController
208 InputControlsWidget( intf_thread_t * , QWidget *_parent = 0 );
212 class ControlsWidget : public AbstractController
216 /* p_intf, advanced control visible or not, blingbling or not */
217 ControlsWidget( intf_thread_t *_p_i, bool b_advControls,
218 QWidget *_parent = 0 );
219 virtual ~ControlsWidget();
222 friend class MainInterface;
224 bool b_advancedVisible;
227 void toggleAdvanced();
230 void advancedControlsToggled( bool );
233 /* on WIN32 hide() for fullscreen controller doesnt work, so it have to be
234 done by trick with setting the opacity of window */
239 /* to trying transparency with fullscreen controller on windows enable that */
240 /* it can be enabled on-non windows systems,
241 but it will be transparent only with composite manager */
243 #define HAVE_TRANSPARENCY 1
245 #define HAVE_TRANSPARENCY 0
248 /* Default value of opacity for FS controller */
249 #define DEFAULT_OPACITY 0.75
251 /***********************************
252 * Fullscreen controller
253 ***********************************/
254 class FullscreenControllerWidget : public AbstractController
258 FullscreenControllerWidget( intf_thread_t * );
259 virtual ~FullscreenControllerWidget();
262 vout_thread_t *p_vout;
263 void attachVout( vout_thread_t *p_vout );
265 void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
267 int i_mouse_last_move_x;
268 int i_mouse_last_move_y;
271 friend class MainInterface;
273 virtual void mouseMoveEvent( QMouseEvent *event );
274 virtual void mousePressEvent( QMouseEvent *event );
275 virtual void enterEvent( QEvent *event );
276 virtual void leaveEvent( QEvent *event );
277 virtual void keyPressEvent( QKeyEvent *event );
286 virtual void customEvent( QEvent *event );
289 #if HAVE_TRANSPARENCY
290 QTimer *p_slowHideTimer;
291 bool b_slow_hide_begin;
292 int i_slow_hide_timeout;
295 int i_mouse_last_x, i_mouse_last_y;
303 /* Shared variable between FSC and VLC (protected by a lock) */
306 int i_hide_timeout; /* FSC hiding timeout, same as mouse hiding timeout */