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 _MAIN_INTERFACE_H_
26 #define _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 InteractionDialog;
71 friend class PlaylistWidget;
74 MainInterface( intf_thread_t *);
75 virtual ~MainInterface();
77 /* Video requests from core */
78 WId requestVideo( vout_thread_t *p_nvout, int *pi_x,
79 int *pi_y, unsigned int *pi_width,
80 unsigned int *pi_height );
81 void releaseVideo( void );
82 int controlVideo( int i_query, va_list args );
85 QSystemTrayIcon *getSysTray() { return sysTray; };
86 QMenu *getSysTrayMenu() { return systrayMenu; };
87 int getControlsVisibilityStatus();
90 virtual QSize sizeHint() const;
93 // void resizeEvent( QResizeEvent * );
94 void dropEvent( QDropEvent *);
95 void dropEventPlay( QDropEvent *, bool);
96 void dragEnterEvent( QDragEnterEvent * );
97 void dragMoveEvent( QDragMoveEvent * );
98 void dragLeaveEvent( QDragLeaveEvent * );
99 void closeEvent( QCloseEvent *);
103 QSystemTrayIcon *sysTray;
106 QVBoxLayout *mainLayout;
107 ControlsWidget *controls;
108 InputControlsWidget *inputC;
109 FullscreenControllerWidget *fullscreenControls;
111 void handleMainUi( QSettings* );
112 void askForPrivacy();
113 int privacyDialog( QList<ConfigControl *> *controls );
116 void handleSystray();
117 void createSystray();
120 void createStatusBar();
123 VideoWidget *videoWidget;
125 BackgroundWidget *bgWidget;
126 VisualSelector *visualSelector;
127 PlaylistWidget *playlistWidget;
129 bool videoIsActive; ///< Having a video now / THEMIM->hasV
130 bool videoEmbeddedFlag; ///< Want an external Video Window
131 bool playlistVisible; ///< Is the playlist visible ?
132 bool visualSelectorEnabled;
133 bool notificationEnabled; /// Systray Notifications
135 bool b_keep_size; ///< persistent resizeable window
136 QSize mainBasedSize; ///< based Wnd (normal mode only)
137 QSize mainVideoSize; ///< Wnd with video (all modes)
138 int i_visualmode; ///< Visual Mode
140 bool isDocked() { return ( i_pl_dock != PL_UNDOCKED ); }
145 QLabel *cryptedLabel;
148 virtual void customEvent( QEvent *);
149 virtual void keyPressEvent( QKeyEvent *);
150 virtual void wheelEvent( QWheelEvent * );
151 virtual void resizeEvent( QResizeEvent * event );
154 void undockPlaylist();
155 void dockPlaylist( pl_dock_e i_pos = PL_BOTTOM );
156 void toggleMinimalView( bool );
157 void togglePlaylist();
158 void toggleUpdateSystrayMenu();
159 void toggleAdvanced();
160 void toggleFullScreen();
163 /* Manage the Video Functions from the vout threads */
164 void releaseVideoSlot( void );
168 void doComponentsUpdate();
169 void setName( QString );
170 void setVLCWindowsTitle( QString title = "" );
174 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
175 void updateSystrayTooltipName( QString );
176 void updateSystrayTooltipStatus( int );
179 void showCryptedLabel( bool );
182 void askReleaseVideo( );
183 void askVideoToResize( unsigned int, unsigned int );
184 void askVideoToShow( unsigned int, unsigned int );
185 void askVideoToToggle();
186 void askBgWidgetToToggle();
188 void minimalViewToggled( bool );
189 void fullscreenInterfaceToggled( bool );