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 );
84 QSystemTrayIcon *getSysTray() { return sysTray; }
85 QMenu *getSysTrayMenu() { return systrayMenu; }
87 int getControlsVisibilityStatus();
88 bool isPlDocked() { return ( b_plDocked != false ); }
91 void dropEventPlay( QDropEvent *, bool);
93 virtual bool winEvent( MSG *, long * );
95 virtual void dropEvent( QDropEvent *);
96 virtual void dragEnterEvent( QDragEnterEvent * );
97 virtual void dragMoveEvent( QDragMoveEvent * );
98 virtual void dragLeaveEvent( QDragLeaveEvent * );
99 virtual void closeEvent( QCloseEvent *);
100 virtual void keyPressEvent( QKeyEvent *);
101 virtual void wheelEvent( QWheelEvent * );
104 /* Main Widgets Creation */
105 void createMainWidget( QSettings* );
106 void createStatusBar();
107 void createPlaylist();
110 void createSystray();
112 void handleSystray();
114 /* Central StackWidget Management */
115 void showTab( QWidget *);
117 void restoreStackOldWidget();
122 QSystemTrayIcon *sysTray;
127 QVBoxLayout *mainLayout;
128 ControlsWidget *controls;
129 InputControlsWidget *inputC;
130 FullscreenControllerWidget *fullscreenControls;
133 QStackedWidget *stackCentralW;
135 VideoWidget *videoWidget;
136 BackgroundWidget *bgWidget;
137 PlaylistWidget *playlistWidget;
138 //VisualSelector *visualSelector;
142 QLabel *cryptedLabel;
144 /* Status and flags */
145 QWidget *stackCentralOldWidget;
147 QMap<QWidget *, QSize> stackWidgetsSizes;
150 bool b_notificationEnabled; /// Systray Notifications
151 bool b_autoresize; ///< persistent resizeable window
152 bool b_videoEmbedded; ///< Want an external Video Window
153 bool b_hideAfterCreation;
154 int i_visualmode; ///< Visual Mode
157 bool playlistVisible; ///< Is the playlist visible ?
158 // bool videoIsActive; ///< Having a video now / THEMIM->hasV
159 // bool b_visualSelectorEnabled;
160 bool b_plDocked; ///< Is the playlist docked ?
165 LPTASKBARLIST3 p_taskbl;
167 void createTaskBarButtons();
171 void dockPlaylist( bool b_docked = true );
172 void toggleMinimalView( bool );
173 void togglePlaylist();
175 void toggleUpdateSystrayMenu();
177 void toggleAdvancedButtons();
178 void toggleFullScreen();
181 void popupMenu( const QPoint& );
182 void changeThumbbarButtons( int );
184 /* Manage the Video Functions from the vout threads */
185 void getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
186 unsigned *pi_width, unsigned *pi_height );
187 void releaseVideoSlot( void );
191 void destroyPopupMenu();
192 void recreateToolbars();
193 void setName( const QString& );
194 void setVLCWindowsTitle( const QString& title = "" );
199 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
200 void updateSystrayTooltipName( const QString& );
201 void updateSystrayTooltipStatus( int );
203 void showCryptedLabel( bool );
205 void handleKeyPress( QKeyEvent * );
207 void showBuffering( float );
209 void resizeStack( int w, int h ) {
210 if( !isFullScreen() && !isMaximized() )
211 if( i_visualmode == 1 ) resize( w, h ); /* Oh yes, it shouldn't
212 be possible that size() - stackCentralW->size() < 0
213 since stackCentralW is contained in the QMW... */
214 else resize( size() - stackCentralW->size() + QSize( w, h ) );
217 void setVideoOnTop( bool );
220 void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
221 unsigned *pi_width, unsigned *pi_height );
222 void askReleaseVideo( );
223 void askVideoToResize( unsigned int, unsigned int );
224 void askVideoSetFullScreen( bool );
225 void askVideoOnTop( bool );
226 void minimalViewToggled( bool );
227 void fullscreenInterfaceToggled( bool );