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;
57 class StandardPLPanel;
59 class MainInterface : public QVLCMW
63 friend class PlaylistWidget;
67 MainInterface( intf_thread_t *);
68 virtual ~MainInterface();
70 static const QEvent::Type ToolbarsNeedRebuild;
72 /* Video requests from core */
73 WId getVideo( int *pi_x, int *pi_y,
74 unsigned int *pi_width, unsigned int *pi_height );
75 void releaseVideo( void );
76 int controlVideo( int i_query, va_list args );
79 QSystemTrayIcon *getSysTray() { return sysTray; }
80 QMenu *getSysTrayMenu() { return systrayMenu; }
81 FullscreenControllerWidget* getFullscreenControllerWidget() { return fullscreenControls; }
84 CONTROLS_VISIBLE = 0x1,
85 CONTROLS_HIDDEN = 0x2,
86 CONTROLS_ADVANCED = 0x4,
88 int getControlsVisibilityStatus();
89 bool isPlDocked() { return ( b_plDocked != false ); }
90 bool isInterfaceFullScreen() { return b_interfaceFullScreen; }
91 StandardPLPanel* getPlaylistView();
94 void dropEventPlay( QDropEvent* event, bool b_play ) { dropEventPlay(event, b_play, true); }
95 void dropEventPlay( QDropEvent *, bool, bool );
97 virtual bool winEvent( MSG *, long * );
99 virtual void changeEvent( QEvent * );
100 virtual void dropEvent( QDropEvent *);
101 virtual void dragEnterEvent( QDragEnterEvent * );
102 virtual void dragMoveEvent( QDragMoveEvent * );
103 virtual void dragLeaveEvent( QDragLeaveEvent * );
104 virtual void closeEvent( QCloseEvent *);
105 virtual void keyPressEvent( QKeyEvent *);
106 virtual void wheelEvent( QWheelEvent * );
107 virtual bool eventFilter(QObject *, QEvent *);
110 /* Main Widgets Creation */
111 void createMainWidget( QSettings* );
112 void createStatusBar();
113 void createPlaylist();
114 void createContinueDialog( QWidget *w );
117 void createSystray();
119 void handleSystray();
121 /* Central StackWidget Management */
122 void showTab( QWidget *);
124 void restoreStackOldWidget();
127 void setMinimalView( bool );
128 void setInterfaceFullScreen( bool );
129 void computeMinimumSize();
133 QSystemTrayIcon *sysTray;
137 QVBoxLayout *mainLayout;
138 ControlsWidget *controls;
139 InputControlsWidget *inputC;
140 FullscreenControllerWidget *fullscreenControls;
143 QStackedWidget *stackCentralW;
145 VideoWidget *videoWidget;
146 BackgroundWidget *bgWidget;
147 PlaylistWidget *playlistWidget;
148 //VisualSelector *visualSelector;
151 QWidget *continueDialog;
152 int64_t i_continueTime;
156 QLabel *cryptedLabel;
158 /* Status and flags */
159 QWidget *stackCentralOldWidget;
161 QMap<QWidget *, QSize> stackWidgetsSizes;
164 unsigned i_notificationSetting; /// Systray Notifications
165 bool b_autoresize; ///< persistent resizable window
166 bool b_videoEmbedded; ///< Want an external Video Window
167 bool b_videoFullScreen; ///< --fullscreen
168 bool b_hideAfterCreation;
169 bool b_minimalView; ///< Minimal video
170 bool b_interfaceFullScreen;
171 bool b_pauseOnMinimize;
174 bool playlistVisible; ///< Is the playlist visible ?
175 // bool videoIsActive; ///< Having a video now / THEMIM->hasV
176 // bool b_visualSelectorEnabled;
177 bool b_plDocked; ///< Is the playlist docked ?
179 bool b_hasPausedWhenMinimized;
180 bool b_statusbarVisible;
183 HWND WinId( QWidget *);
185 ITaskbarList3 *p_taskbl;
187 void createTaskBarButtons();
190 static const Qt::Key kc[10]; /* easter eggs */
194 void dockPlaylist( bool b_docked = true );
195 void toggleMinimalView( bool );
196 void togglePlaylist();
197 void toggleUpdateSystrayMenu();
198 void showUpdateSystrayMenu();
199 void hideUpdateSystrayMenu();
200 void toggleAdvancedButtons();
201 void toggleInterfaceFullScreen();
204 void setStatusBarVisibility(bool b_visible);
205 void setPlaylistVisibility(bool b_visible);
208 void changeThumbbarButtons( int );
211 /* Manage the Video Functions from the vout threads */
212 void getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
213 unsigned *pi_width, unsigned *pi_height );
214 void releaseVideoSlot( void );
220 void toolBarConfUpdated();
224 void recreateToolbars();
225 void setName( const QString& );
226 void setVLCWindowsTitle( const QString& title = "" );
230 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
231 void updateSystrayTooltipName( const QString& );
232 void updateSystrayTooltipStatus( int );
233 void showCryptedLabel( bool );
235 void handleKeyPress( QKeyEvent * );
237 void showBuffering( float );
239 void resizeStack( int w, int h )
241 if( !isFullScreen() && !isMaximized() )
244 resize( w, h ); /* Oh yes, it shouldn't
245 be possible that size() - stackCentralW->size() < 0
246 since stackCentralW is contained in the QMW... */
248 resize( size() - stackCentralW->size() + QSize( w, h ) );
253 void setVideoSize( unsigned int, unsigned int );
254 void videoSizeChanged( int, int );
255 void setVideoFullScreen( bool );
256 void setVideoOnTop( bool );
260 void showContinueDialog( int64_t);
261 void continuePlayback();
264 void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
265 unsigned *pi_width, unsigned *pi_height );
266 void askReleaseVideo( );
267 void askVideoToResize( unsigned int, unsigned int );
268 void askVideoSetFullScreen( bool );
269 void askVideoOnTop( bool );
270 void minimalViewToggled( bool );
271 void fullscreenInterfaceToggled( bool );
275 void kc_pressed(); /* easter eggs */