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();
116 void createSystray();
118 void handleSystray();
120 /* Central StackWidget Management */
121 void showTab( QWidget *);
123 void restoreStackOldWidget();
126 void setMinimalView( bool );
127 void setInterfaceFullScreen( bool );
128 void computeMinimumSize();
132 QSystemTrayIcon *sysTray;
136 QVBoxLayout *mainLayout;
137 ControlsWidget *controls;
138 InputControlsWidget *inputC;
139 FullscreenControllerWidget *fullscreenControls;
142 QStackedWidget *stackCentralW;
144 VideoWidget *videoWidget;
145 BackgroundWidget *bgWidget;
146 PlaylistWidget *playlistWidget;
147 //VisualSelector *visualSelector;
151 QLabel *cryptedLabel;
153 /* Status and flags */
154 QWidget *stackCentralOldWidget;
156 QMap<QWidget *, QSize> stackWidgetsSizes;
159 unsigned i_notificationSetting; /// Systray Notifications
160 bool b_autoresize; ///< persistent resizable window
161 bool b_videoEmbedded; ///< Want an external Video Window
162 bool b_videoFullScreen; ///< --fullscreen
163 bool b_hideAfterCreation;
164 bool b_minimalView; ///< Minimal video
165 bool b_interfaceFullScreen;
166 bool b_pauseOnMinimize;
169 bool playlistVisible; ///< Is the playlist visible ?
170 // bool videoIsActive; ///< Having a video now / THEMIM->hasV
171 // bool b_visualSelectorEnabled;
172 bool b_plDocked; ///< Is the playlist docked ?
174 bool b_hasPausedWhenMinimized;
175 bool b_statusbarVisible;
179 ITaskbarList3 *p_taskbl;
181 void createTaskBarButtons();
184 static const Qt::Key kc[10]; /* easter eggs */
188 void dockPlaylist( bool b_docked = true );
189 void toggleMinimalView( bool );
190 void togglePlaylist();
191 void toggleUpdateSystrayMenu();
192 void showUpdateSystrayMenu();
193 void hideUpdateSystrayMenu();
194 void toggleAdvancedButtons();
195 void toggleInterfaceFullScreen();
198 void setStatusBarVisibility(bool b_visible);
199 void setPlaylistVisibility(bool b_visible);
201 void popupMenu( const QPoint& );
203 void changeThumbbarButtons( int );
206 /* Manage the Video Functions from the vout threads */
207 void getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
208 unsigned *pi_width, unsigned *pi_height );
209 void releaseVideoSlot( void );
215 void toolBarConfUpdated();
219 void destroyPopupMenu();
220 void recreateToolbars();
221 void setName( const QString& );
222 void setVLCWindowsTitle( const QString& title = "" );
226 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
227 void updateSystrayTooltipName( const QString& );
228 void updateSystrayTooltipStatus( int );
229 void showCryptedLabel( bool );
231 void handleKeyPress( QKeyEvent * );
233 void showBuffering( float );
235 void resizeStack( int w, int h )
237 if( !isFullScreen() && !isMaximized() )
240 resize( w, h ); /* Oh yes, it shouldn't
241 be possible that size() - stackCentralW->size() < 0
242 since stackCentralW is contained in the QMW... */
244 resize( size() - stackCentralW->size() + QSize( w, h ) );
249 void setVideoSize( unsigned int, unsigned int );
250 void videoSizeChanged( int, int );
251 void setVideoFullScreen( bool );
252 void setVideoOnTop( bool );
257 void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
258 unsigned *pi_width, unsigned *pi_height );
259 void askReleaseVideo( );
260 void askVideoToResize( unsigned int, unsigned int );
261 void askVideoSetFullScreen( bool );
262 void askVideoOnTop( bool );
263 void minimalViewToggled( bool );
264 void fullscreenInterfaceToggled( bool );
268 void kc_pressed(); /* easter eggs */