1 /*****************************************************************************
2 * main_interface.hpp : Main Interface
3 ****************************************************************************
4 * Copyright (C) 2006-2008 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste Kempf <jb@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifndef QVLC_MAIN_INTERFACE_H_
26 #define QVLC_MAIN_INTERFACE_H_
30 #include "util/qvlcframe.hpp"
31 #include "components/preferences_widgets.hpp" /* First Start */
33 #include <vlc_windows_interfaces.h>
36 #include <QSystemTrayIcon>
45 class BackgroundWidget;
48 class AdvControlsWidget;
50 class InputControlsWidget;
51 class FullscreenControllerWidget;
52 class SpeedControlWidget;
59 CONTROLS_VISIBLE = 0x1,
60 CONTROLS_HIDDEN = 0x2,
61 CONTROLS_ADVANCED = 0x4,
65 typedef enum pl_dock_e {
72 class MainInterface : public QVLCMW
76 friend class PlaylistWidget;
79 MainInterface( intf_thread_t *);
80 virtual ~MainInterface();
82 /* Video requests from core */
83 WId getVideo( int *pi_x, int *pi_y,
84 unsigned int *pi_width, unsigned int *pi_height );
85 void releaseVideo( void );
86 int controlVideo( int i_query, va_list args );
90 QSystemTrayIcon *getSysTray() { return sysTray; }
91 QMenu *getSysTrayMenu() { return systrayMenu; }
93 int getControlsVisibilityStatus();
96 virtual QSize sizeHint() const;
99 void dropEventPlay( QDropEvent *, bool);
101 bool winEvent( MSG *, long * );
103 virtual void dropEvent( QDropEvent *);
104 virtual void dragEnterEvent( QDragEnterEvent * );
105 virtual void dragMoveEvent( QDragMoveEvent * );
106 virtual void dragLeaveEvent( QDragLeaveEvent * );
107 virtual void closeEvent( QCloseEvent *);
108 virtual void customEvent( QEvent *);
109 virtual void keyPressEvent( QKeyEvent *);
110 virtual void wheelEvent( QWheelEvent * );
111 virtual void resizeEvent( QResizeEvent * event );
114 void createMainWidget( QSettings* );
115 void createStatusBar();
118 void handleSystray();
119 void createSystray();
121 bool isDocked() { return ( i_pl_dock != PL_UNDOCKED ); }
123 void showTab( int i_tab );
124 void restoreStackOldWidget();
125 void showVideo() { showTab( VIDEO_TAB ); }
126 void showBg() { showTab( BACKG_TAB ); }
127 void hideStackWidget() { showTab( HIDDEN_TAB ); }
131 QSystemTrayIcon *sysTray;
135 QVBoxLayout *mainLayout;
136 ControlsWidget *controls;
137 InputControlsWidget *inputC;
138 FullscreenControllerWidget *fullscreenControls;
139 QStackedWidget *stackCentralW;
141 VideoWidget *videoWidget;
143 BackgroundWidget *bgWidget;
144 VisualSelector *visualSelector;
145 PlaylistWidget *playlistWidget;
149 QLabel *cryptedLabel;
151 /* Status and flags */
158 int stackCentralOldState;
160 // bool videoIsActive; ///< Having a video now / THEMIM->hasV
161 bool videoEmbeddedFlag; ///< Want an external Video Window
162 bool playlistVisible; ///< Is the playlist visible ?
163 bool visualSelectorEnabled;
164 bool notificationEnabled; /// Systray Notifications
166 bool b_keep_size; ///< persistent resizeable window
167 QSize mainBasedSize; ///< based Wnd (normal mode only)
168 QSize mainVideoSize; ///< Wnd with video (all modes)
169 int i_visualmode; ///< Visual Mode
171 int i_bg_height; ///< Save height of bgWidget
172 bool b_hideAfterCreation;
176 LPTASKBARLIST3 p_taskbl;
178 void createTaskBarButtons();
180 void createPlaylist( bool );
183 void undockPlaylist();
184 void dockPlaylist( pl_dock_e i_pos = PL_BOTTOM );
185 void toggleMinimalView( bool );
186 void togglePlaylist();
188 void toggleUpdateSystrayMenu();
190 void toggleAdvanced();
191 void toggleFullScreen();
193 void popupMenu( const QPoint& );
194 void changeThumbbarButtons( int );
196 /* Manage the Video Functions from the vout threads */
197 void getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
198 unsigned *pi_width, unsigned *pi_height );
199 void releaseVideoSlot( void );
203 void destroyPopupMenu();
204 void recreateToolbars();
205 void doComponentsUpdate();
206 void setName( const QString& );
207 void setVLCWindowsTitle( const QString& title = "" );
212 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
213 void updateSystrayTooltipName( const QString& );
214 void updateSystrayTooltipStatus( int );
216 void showCryptedLabel( bool );
218 void handleKeyPress( QKeyEvent * );
221 void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
222 unsigned *pi_width, unsigned *pi_height );
223 void askReleaseVideo( );
224 void askVideoToResize( unsigned int, unsigned int );
225 void askVideoSetFullScreen( bool );
227 void minimalViewToggled( bool );
228 void fullscreenInterfaceToggled( bool );
229 void playPauseSignal();
241 #define WM_APPCOMMAND 0x0319
243 #define APPCOMMAND_VOLUME_MUTE 8
244 #define APPCOMMAND_VOLUME_DOWN 9
245 #define APPCOMMAND_VOLUME_UP 10
246 #define APPCOMMAND_MEDIA_NEXTTRACK 11
247 #define APPCOMMAND_MEDIA_PREVIOUSTRACK 12
248 #define APPCOMMAND_MEDIA_STOP 13
249 #define APPCOMMAND_MEDIA_PLAY_PAUSE 14
250 #define APPCOMMAND_LAUNCH_MEDIA_SELECT 16
251 #define APPCOMMAND_BASS_DOWN 19
252 #define APPCOMMAND_BASS_BOOST 20
253 #define APPCOMMAND_BASS_UP 21
254 #define APPCOMMAND_TREBLE_DOWN 22
255 #define APPCOMMAND_TREBLE_UP 23
256 #define APPCOMMAND_MICROPHONE_VOLUME_MUTE 24
257 #define APPCOMMAND_MICROPHONE_VOLUME_DOWN 25
258 #define APPCOMMAND_MICROPHONE_VOLUME_UP 26
259 #define APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE 43
260 #define APPCOMMAND_MIC_ON_OFF_TOGGLE 44
261 #define APPCOMMAND_MEDIA_PLAY 46
262 #define APPCOMMAND_MEDIA_PAUSE 47
263 #define APPCOMMAND_MEDIA_RECORD 48
264 #define APPCOMMAND_MEDIA_FAST_FORWARD 49
265 #define APPCOMMAND_MEDIA_REWIND 50
266 #define APPCOMMAND_MEDIA_CHANNEL_UP 51
267 #define APPCOMMAND_MEDIA_CHANNEL_DOWN 52
269 #define FAPPCOMMAND_MOUSE 0x8000
270 #define FAPPCOMMAND_KEY 0
271 #define FAPPCOMMAND_OEM 0x1000
272 #define FAPPCOMMAND_MASK 0xF000
274 #define GET_APPCOMMAND_LPARAM(lParam) ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK))
275 #define GET_DEVICE_LPARAM(lParam) ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK))
276 #define GET_MOUSEORKEY_LPARAM GET_DEVICE_LPARAM
277 #define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam))
278 #define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam)