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"
33 #include <vlc_windows_interfaces.h>
36 #include <QSystemTrayIcon>
45 class BackgroundWidget;
48 class AdvControlsWidget;
50 class InputControlsWidget;
51 class FullscreenControllerWidget;
52 class SpeedControlWidget;
59 CONTROLS_VISIBLE = 0x1,
60 CONTROLS_HIDDEN = 0x2,
61 CONTROLS_ADVANCED = 0x4,
65 class MainInterface : public QVLCMW
69 friend class PlaylistWidget;
72 MainInterface( intf_thread_t *);
73 virtual ~MainInterface();
75 /* Video requests from core */
76 WId getVideo( int *pi_x, int *pi_y,
77 unsigned int *pi_width, unsigned int *pi_height );
78 void releaseVideo( void );
79 int controlVideo( int i_query, va_list args );
83 QSystemTrayIcon *getSysTray() { return sysTray; }
84 QMenu *getSysTrayMenu() { return systrayMenu; }
86 int getControlsVisibilityStatus();
87 bool isPlDocked() { return ( b_plDocked != false ); }
90 // virtual QSize sizeHint() const;
93 void dropEventPlay( QDropEvent *, bool);
95 virtual bool winEvent( MSG *, long * );
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 customEvent( QEvent *);
103 virtual void keyPressEvent( QKeyEvent *);
104 virtual void wheelEvent( QWheelEvent * );
105 virtual void resizeEvent( QResizeEvent * event );
108 /* Main Widgets Creation */
109 void createMainWidget( QSettings* );
110 void createStatusBar();
111 void createPlaylist();
114 void createSystray();
115 void handleSystray();
118 /* Mess about stackWidget */
119 void showTab( QWidget *);
122 void restoreStackOldWidget();
127 QSystemTrayIcon *sysTray;
131 QVBoxLayout *mainLayout;
132 ControlsWidget *controls;
133 InputControlsWidget *inputC;
134 FullscreenControllerWidget *fullscreenControls;
137 QStackedWidget *stackCentralW;
139 VideoWidget *videoWidget;
140 BackgroundWidget *bgWidget;
141 PlaylistWidget *playlistWidget;
142 //VisualSelector *visualSelector;
146 QLabel *cryptedLabel;
148 /* Status and flags */
149 QWidget *stackCentralOldWidget;
152 bool b_notificationEnabled; /// Systray Notifications
153 bool b_keep_size; ///< persistent resizeable window
154 bool b_videoEmbedded; ///< Want an external Video Window
155 bool b_hideAfterCreation;
156 int i_visualmode; ///< Visual Mode
159 bool playlistVisible; ///< Is the playlist visible ?
160 // bool videoIsActive; ///< Having a video now / THEMIM->hasV
161 // bool b_visualSelectorEnabled;
162 bool b_plDocked; ///< Is the playlist docked ?
164 QSize mainBasedSize; ///< based Wnd (normal mode only)
165 QSize mainVideoSize; ///< Wnd with video (all modes)
166 int i_bg_height; ///< Save height of bgWidget
170 LPTASKBARLIST3 p_taskbl;
172 void createTaskBarButtons();
176 void dockPlaylist( bool b_docked = true );
177 void toggleMinimalView( bool );
178 void togglePlaylist();
180 void toggleUpdateSystrayMenu();
182 void toggleAdvanced();
183 void toggleFullScreen();
185 void popupMenu( const QPoint& );
186 void changeThumbbarButtons( int );
188 /* Manage the Video Functions from the vout threads */
189 void getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
190 unsigned *pi_width, unsigned *pi_height );
191 void releaseVideoSlot( void );
195 void destroyPopupMenu();
196 void recreateToolbars();
197 void doComponentsUpdate();
198 void setName( const QString& );
199 void setVLCWindowsTitle( const QString& title = "" );
204 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
205 void updateSystrayTooltipName( const QString& );
206 void updateSystrayTooltipStatus( int );
208 void showCryptedLabel( bool );
210 void handleKeyPress( QKeyEvent * );
212 void showBuffering( float );
215 void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
216 unsigned *pi_width, unsigned *pi_height );
217 void askReleaseVideo( );
218 void askVideoToResize( unsigned int, unsigned int );
219 void askVideoSetFullScreen( bool );
221 void minimalViewToggled( bool );
222 void fullscreenInterfaceToggled( bool );