1 /*****************************************************************************
2 * main_interface.hpp : Main Interface
3 ****************************************************************************
4 * Copyright (C) 2006-2010 VideoLAN and AUTHORS
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"
33 #include <vlc_windows_interfaces.h>
36 #include <QSystemTrayIcon>
37 #include <QStackedWidget>
46 class BackgroundWidget
;
49 class AdvControlsWidget
;
51 class InputControlsWidget
;
52 class FullscreenControllerWidget
;
53 class SpeedControlWidget
;
59 CONTROLS_VISIBLE
= 0x1,
60 CONTROLS_HIDDEN
= 0x2,
61 CONTROLS_ADVANCED
= 0x4,
65 class MainInterface
: public QVLCMW
69 friend class PlaylistWidget
;
73 MainInterface( intf_thread_t
*);
74 virtual ~MainInterface();
76 /* Video requests from core */
77 WId
getVideo( int *pi_x
, int *pi_y
,
78 unsigned int *pi_width
, unsigned int *pi_height
);
79 void releaseVideo( void );
80 int controlVideo( int i_query
, va_list args
);
83 QSystemTrayIcon
*getSysTray() { return sysTray
; }
84 QMenu
*getSysTrayMenu() { return systrayMenu
; }
85 FullscreenControllerWidget
* getFullscreenControllerWidget() { return fullscreenControls
; }
86 int getControlsVisibilityStatus();
87 bool isPlDocked() { return ( b_plDocked
!= false ); }
88 bool isInterfaceFullScreen() { return b_interfaceFullScreen
; }
91 void dropEventPlay( QDropEvent
* event
, bool b_play
) { dropEventPlay(event
, b_play
, true); }
92 void dropEventPlay( QDropEvent
*, bool, bool );
94 virtual bool winEvent( MSG
*, long * );
96 virtual void changeEvent( QEvent
* );
97 virtual void dropEvent( QDropEvent
*);
98 virtual void dragEnterEvent( QDragEnterEvent
* );
99 virtual void dragMoveEvent( QDragMoveEvent
* );
100 virtual void dragLeaveEvent( QDragLeaveEvent
* );
101 virtual void closeEvent( QCloseEvent
*);
102 virtual void keyPressEvent( QKeyEvent
*);
103 virtual void wheelEvent( QWheelEvent
* );
106 /* Main Widgets Creation */
107 void createMainWidget( QSettings
* );
108 void createStatusBar();
109 void createPlaylist();
112 void createSystray();
114 void handleSystray();
116 /* Central StackWidget Management */
117 void showTab( QWidget
*);
119 void restoreStackOldWidget();
122 void setMinimalView( bool );
123 void setInterfaceFullScreen( bool );
124 void computeMinimumSize();
128 QSystemTrayIcon
*sysTray
;
132 QVBoxLayout
*mainLayout
;
133 ControlsWidget
*controls
;
134 InputControlsWidget
*inputC
;
135 FullscreenControllerWidget
*fullscreenControls
;
138 QStackedWidget
*stackCentralW
;
140 VideoWidget
*videoWidget
;
141 BackgroundWidget
*bgWidget
;
142 PlaylistWidget
*playlistWidget
;
143 //VisualSelector *visualSelector;
147 QLabel
*cryptedLabel
;
149 /* Status and flags */
150 QWidget
*stackCentralOldWidget
;
152 QMap
<QWidget
*, QSize
> stackWidgetsSizes
;
155 unsigned i_notificationSetting
; /// Systray Notifications
156 bool b_autoresize
; ///< persistent resizable window
157 bool b_videoEmbedded
; ///< Want an external Video Window
158 bool b_videoFullScreen
; ///< --fullscreen
159 bool b_hideAfterCreation
;
160 bool b_minimalView
; ///< Minimal video
161 bool b_interfaceFullScreen
;
162 bool b_pauseOnMinimize
;
165 bool playlistVisible
; ///< Is the playlist visible ?
166 // bool videoIsActive; ///< Having a video now / THEMIM->hasV
167 // bool b_visualSelectorEnabled;
168 bool b_plDocked
; ///< Is the playlist docked ?
170 bool b_hasPausedWhenMinimized
;
171 bool b_statusbarVisible
;
175 ITaskbarList3
*p_taskbl
;
177 void createTaskBarButtons();
181 void dockPlaylist( bool b_docked
= true );
182 void toggleMinimalView( bool );
183 void togglePlaylist();
184 void toggleUpdateSystrayMenu();
185 void showUpdateSystrayMenu();
186 void hideUpdateSystrayMenu();
187 void toggleAdvancedButtons();
188 void toggleInterfaceFullScreen();
191 void setStatusBarVisibility(bool b_visible
);
193 void popupMenu( const QPoint
& );
195 void changeThumbbarButtons( int );
198 /* Manage the Video Functions from the vout threads */
199 void getVideoSlot( WId
*p_id
, int *pi_x
, int *pi_y
,
200 unsigned *pi_width
, unsigned *pi_height
);
201 void releaseVideoSlot( void );
210 void destroyPopupMenu();
211 void recreateToolbars();
212 void setName( const QString
& );
213 void setVLCWindowsTitle( const QString
& title
= "" );
217 void handleSystrayClick( QSystemTrayIcon::ActivationReason
);
218 void updateSystrayTooltipName( const QString
& );
219 void updateSystrayTooltipStatus( int );
220 void showCryptedLabel( bool );
222 void handleKeyPress( QKeyEvent
* );
224 void showBuffering( float );
226 void resizeStack( int w
, int h
)
228 if( !isFullScreen() && !isMaximized() )
231 resize( w
, h
); /* Oh yes, it shouldn't
232 be possible that size() - stackCentralW->size() < 0
233 since stackCentralW is contained in the QMW... */
235 resize( size() - stackCentralW
->size() + QSize( w
, h
) );
240 void setVideoSize( unsigned int, unsigned int );
241 void setVideoFullScreen( bool );
242 void setVideoOnTop( bool );
247 void askGetVideo( WId
*p_id
, int *pi_x
, int *pi_y
,
248 unsigned *pi_width
, unsigned *pi_height
);
249 void askReleaseVideo( );
250 void askVideoToResize( unsigned int, unsigned int );
251 void askVideoSetFullScreen( bool );
252 void askVideoOnTop( bool );
253 void minimalViewToggled( bool );
254 void fullscreenInterfaceToggled( bool );