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 */
34 #include <vlc_windows_interfaces.h>
37 #include <QSystemTrayIcon>
46 class BackgroundWidget;
49 class AdvControlsWidget;
51 class InputControlsWidget;
52 class FullscreenControllerWidget;
53 class SpeedControlWidget;
60 CONTROLS_VISIBLE = 0x1,
61 CONTROLS_HIDDEN = 0x2,
62 CONTROLS_ADVANCED = 0x4,
66 class MainInterface : public QVLCMW
70 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 // virtual QSize sizeHint() const;
94 void dropEventPlay( QDropEvent *, bool);
96 virtual bool winEvent( MSG *, long * );
98 virtual void dropEvent( QDropEvent *);
99 virtual void dragEnterEvent( QDragEnterEvent * );
100 virtual void dragMoveEvent( QDragMoveEvent * );
101 virtual void dragLeaveEvent( QDragLeaveEvent * );
102 virtual void closeEvent( QCloseEvent *);
103 virtual void customEvent( QEvent *);
104 virtual void keyPressEvent( QKeyEvent *);
105 virtual void wheelEvent( QWheelEvent * );
106 virtual void resizeEvent( QResizeEvent * event );
109 /* Main Widgets Creation */
110 void createMainWidget( QSettings* );
111 void createStatusBar();
112 void createPlaylist();
115 void createSystray();
116 void handleSystray();
119 /* Mess about stackWidget */
120 void showTab( QWidget *);
123 void restoreStackOldWidget();
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;
153 bool b_notificationEnabled; /// Systray Notifications
154 bool b_keep_size; ///< persistent resizeable window
155 bool b_videoEmbedded; ///< Want an external Video Window
156 bool b_hideAfterCreation;
157 int i_visualmode; ///< Visual Mode
160 bool playlistVisible; ///< Is the playlist visible ?
161 // bool videoIsActive; ///< Having a video now / THEMIM->hasV
162 // bool b_visualSelectorEnabled;
163 bool b_plDocked; ///< Is the playlist docked ?
165 QSize mainBasedSize; ///< based Wnd (normal mode only)
166 QSize mainVideoSize; ///< Wnd with video (all modes)
167 int i_bg_height; ///< Save height of bgWidget
171 LPTASKBARLIST3 p_taskbl;
173 void createTaskBarButtons();
177 void dockPlaylist( bool b_docked = true );
178 void toggleMinimalView( bool );
179 void togglePlaylist();
181 void toggleUpdateSystrayMenu();
183 void toggleAdvanced();
184 void toggleFullScreen();
186 void popupMenu( const QPoint& );
187 void changeThumbbarButtons( int );
189 /* Manage the Video Functions from the vout threads */
190 void getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
191 unsigned *pi_width, unsigned *pi_height );
192 void releaseVideoSlot( void );
196 void destroyPopupMenu();
197 void recreateToolbars();
198 void doComponentsUpdate();
199 void setName( const QString& );
200 void setVLCWindowsTitle( const QString& title = "" );
205 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
206 void updateSystrayTooltipName( const QString& );
207 void updateSystrayTooltipStatus( int );
209 void showCryptedLabel( bool );
211 void handleKeyPress( QKeyEvent * );
213 void showBuffering( float );
216 void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
217 unsigned *pi_width, unsigned *pi_height );
218 void askReleaseVideo( );
219 void askVideoToResize( unsigned int, unsigned int );
220 void askVideoSetFullScreen( bool );
222 void minimalViewToggled( bool );
223 void fullscreenInterfaceToggled( bool );