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 */
33 #include <QSystemTrayIcon>
42 class BackgroundWidget;
45 class AdvControlsWidget;
47 class InputControlsWidget;
48 class FullscreenControllerWidget;
49 class SpeedControlWidget;
54 CONTROLS_VISIBLE = 0x1,
55 CONTROLS_HIDDEN = 0x2,
56 CONTROLS_ADVANCED = 0x4,
59 typedef enum pl_dock_e {
66 class MainInterface : public QVLCMW
70 friend class PlaylistWidget;
73 MainInterface( intf_thread_t *);
74 virtual ~MainInterface();
76 /* Video requests from core */
77 WId requestVideo( vout_thread_t *p_nvout, int *pi_x,
78 int *pi_y, unsigned int *pi_width,
79 unsigned int *pi_height );
80 void releaseVideo( void );
81 int controlVideo( int i_query, va_list args );
84 QSystemTrayIcon *getSysTray() { return sysTray; };
85 QMenu *getSysTrayMenu() { return systrayMenu; };
86 int getControlsVisibilityStatus();
89 virtual QSize sizeHint() const;
92 void dropEventPlay( QDropEvent *, bool);
93 virtual void dropEvent( QDropEvent *);
94 virtual void dragEnterEvent( QDragEnterEvent * );
95 virtual void dragMoveEvent( QDragMoveEvent * );
96 virtual void dragLeaveEvent( QDragLeaveEvent * );
97 virtual void closeEvent( QCloseEvent *);
98 virtual void customEvent( QEvent *);
99 virtual void keyPressEvent( QKeyEvent *);
100 virtual void wheelEvent( QWheelEvent * );
101 virtual void resizeEvent( QResizeEvent * event );
105 QSystemTrayIcon *sysTray;
108 QVBoxLayout *mainLayout;
109 ControlsWidget *controls;
110 InputControlsWidget *inputC;
111 FullscreenControllerWidget *fullscreenControls;
113 void createMainWidget( QSettings* );
114 void createStatusBar();
116 void askForPrivacy();
117 int privacyDialog( QList<ConfigControl *> *controls );
120 void handleSystray();
121 void createSystray();
126 VideoWidget *videoWidget;
128 BackgroundWidget *bgWidget;
129 VisualSelector *visualSelector;
130 PlaylistWidget *playlistWidget;
132 bool videoIsActive; ///< Having a video now / THEMIM->hasV
133 bool videoEmbeddedFlag; ///< Want an external Video Window
134 bool playlistVisible; ///< Is the playlist visible ?
135 bool visualSelectorEnabled;
136 bool notificationEnabled; /// Systray Notifications
138 bool b_keep_size; ///< persistent resizeable window
139 QSize mainBasedSize; ///< based Wnd (normal mode only)
140 QSize mainVideoSize; ///< Wnd with video (all modes)
141 int i_visualmode; ///< Visual Mode
143 bool isDocked() { return ( i_pl_dock != PL_UNDOCKED ); }
144 int i_bg_height; ///< Save height of bgWidget
149 QLabel *cryptedLabel;
152 void undockPlaylist();
153 void dockPlaylist( pl_dock_e i_pos = PL_BOTTOM );
154 void toggleMinimalView( bool );
155 void togglePlaylist();
156 void toggleUpdateSystrayMenu();
157 void toggleAdvanced();
158 void toggleFullScreen();
160 void popupMenu( const QPoint& );
162 /* Manage the Video Functions from the vout threads */
163 void releaseVideoSlot( void );
167 void destroyPopupMenu();
168 void recreateToolbars();
169 void doComponentsUpdate();
170 void setName( const QString& );
171 void setVLCWindowsTitle( const QString& title = "" );
175 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
176 void updateSystrayTooltipName( const QString& );
177 void updateSystrayTooltipStatus( int );
179 void showCryptedLabel( bool );
181 void askReleaseVideo( );
182 void askVideoToResize( unsigned int, unsigned int );
183 void askVideoToShow( unsigned int, unsigned int );
184 void askBgWidgetToToggle();
186 void minimalViewToggled( bool );
187 void fullscreenInterfaceToggled( bool );