1 /*****************************************************************************
2 * Controller.hpp : Controller for the main interface
3 ****************************************************************************
4 * Copyright (C) 2006-2008 the VideoLAN team
7 * Authors: Jean-Baptiste Kempf <jb@videolan.org>
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.
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.
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 *****************************************************************************/
24 #ifndef _CONTROLLER_H_
25 #define _CONTROLLER_H_
36 #define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media")
38 #define MAIN_TB1_DEFAULT "64;38;64;37-4;65"
39 #define MAIN_TB2_DEFAULT "0-2;64;3;1;4;64;7;10;9;64-4;36-4;65;35-4"
40 #define ADV_TB_DEFAULT "12;11;13;14"
41 #define INPT_TB_DEFAULT "5-1;33;6-1"
42 #define FSC_TB_DEFAULT "0-2;64;3;1;4;64;36;64;37;64;8;65;35-4;34"
52 class QAbstractSlider;
53 class QAbstractButton;
56 class VolumeClickHandler;
62 typedef enum buttonType_e
100 static const QString nameL[BUTTON_MAX] = { "Play", "Stop", "Open",
101 "Previous", "Next", "Slower", "Faster", "Fullscreen", "De-Fullscreen",
102 "Extended panel", "Playlist", "Snapshot", "Record", "A->B Loop",
103 "Frame By Frame", "Reverse", "Skip backward" , "Skip forward",
105 static const QString tooltipL[BUTTON_MAX] = { I_PLAY_TOOLTIP,
106 _("Stop playback"), _("Open a media"),
107 _("Previous media in the playlist"),
108 _("Next media in the playlist"), _("Slower"), _("Faster"),
109 _("Toggle the video in fullscreen"), _("Toggle the video out fullscreen"),
110 _("Show extended settings" ), _( "Show playlist" ), _( "Take a snapshot" ),
111 _( "Record" ), _( "Loop from point A to point B continuously." ),
112 _("Frame by frame"), _("Reverse"), _("Skip backward"), _("Skip forward"),
114 static const QString iconL[BUTTON_MAX] ={ ":/play_b", ":/stop_b", ":/eject",
115 ":/previous_b", ":/next_b", ":/slower", ":/faster", ":/fullscreen",
116 ":/defullscreen", ":/extended", ":/playlist", ":/snapshot", ":/record",
117 ":/atob_nob", ":/frame", ":/reverse", ":/skip_back", ":/skip_fw",
128 class AdvControlsWidget;
129 class AbstractController : public QFrame
131 friend class WidgetListing; /* For ToolBar Edition HACKS */
135 AbstractController( intf_thread_t *_p_i, QWidget *_parent = 0 );
138 intf_thread_t *p_intf;
140 QSignalMapper *toolbarActionsMapper;
141 QHBoxLayout *controlLayout;
142 /* Change to BoxLayout if both dir are needed */
144 AdvControlsWidget *advControls;
146 void parseAndCreate( QString config, QBoxLayout *controlLayout );
148 virtual void createAndAddWidget( QBoxLayout *controlLayout, int i_index,
149 buttonType_e i_type, int i_option );
151 QWidget *createWidget( buttonType_e, int options = WIDGET_NORMAL );
153 static void setupButton( QAbstractButton * );
155 QFrame *telexFrame();
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 ?
166 /* Advanced Button Bar */
167 class AdvControlsWidget : public AbstractController
171 AdvControlsWidget( intf_thread_t *, QWidget *_parent = 0 );
175 class InputControlsWidget : public AbstractController
179 InputControlsWidget( intf_thread_t * , QWidget *_parent = 0 );
183 class ControlsWidget : public AbstractController
187 /* p_intf, advanced control visible or not, blingbling or not */
188 ControlsWidget( intf_thread_t *_p_i, bool b_advControls,
189 QWidget *_parent = 0 );
190 virtual ~ControlsWidget();
193 friend class MainInterface;
195 bool b_advancedVisible;
198 void toggleAdvanced();
201 void advancedControlsToggled( bool );
204 /* on WIN32 hide() for fullscreen controller doesnt work, so it have to be
205 done by trick with setting the opacity of window */
210 /* to trying transparency with fullscreen controller on windows enable that */
211 /* it can be enabled on-non windows systems,
212 but it will be transparent only with composite manager */
214 #define HAVE_TRANSPARENCY 1
216 #define HAVE_TRANSPARENCY 0
219 /* Default value of opacity for FS controller */
220 #define DEFAULT_OPACITY 0.75
222 /***********************************
223 * Fullscreen controller
224 ***********************************/
225 class FullscreenControllerWidget : public AbstractController
229 FullscreenControllerWidget( intf_thread_t * );
230 virtual ~FullscreenControllerWidget();
233 void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
234 void mouseChanged( vout_thread_t *, int i_mousex, int i_mousey );
237 void setVoutList( vout_thread_t **, int );
240 friend class MainInterface;
242 virtual void mouseMoveEvent( QMouseEvent *event );
243 virtual void mousePressEvent( QMouseEvent *event );
244 virtual void enterEvent( QEvent *event );
245 virtual void leaveEvent( QEvent *event );
246 virtual void keyPressEvent( QKeyEvent *event );
255 virtual void customEvent( QEvent *event );
258 #if HAVE_TRANSPARENCY
259 QTimer *p_slowHideTimer;
260 bool b_slow_hide_begin;
261 int i_slow_hide_timeout;
264 int i_mouse_last_x, i_mouse_last_y;
273 /* List of vouts currently tracked */
274 QList<vout_thread_t *> vout;
276 /* Shared variable between FSC and VLC (protected by a lock) */
279 int i_hide_timeout; /* FSC hiding timeout, same as mouse hiding timeout */
280 int i_mouse_last_move_x;
281 int i_mouse_last_move_y;