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_
29 #include "util/qvlcframe.hpp"
30 #include "components/preferences_widgets.hpp"
34 #include <QSystemTrayIcon>
43 class BackgroundWidget;
46 class AdvControlsWidget;
48 class FullscreenControllerWidget;
49 class SpeedControlWidget;
54 CONTROLS_HIDDEN = 0x0,
55 CONTROLS_VISIBLE = 0x1,
56 CONTROLS_ADVANCED = 0x2
59 typedef enum pl_dock_e {
66 class MainInterface : public QVLCMW
70 friend class VolumeClickHandler;
71 friend class InteractionDialog;
72 friend class PlaylistWidget;
75 MainInterface( intf_thread_t *);
76 virtual ~MainInterface();
78 /* Video requests from core */
79 void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
80 int *pi_y, unsigned int *pi_width,
81 unsigned int *pi_height );
82 void releaseVideo( void );
83 int controlVideo( void *p_window, int i_query, va_list args );
86 QSystemTrayIcon *getSysTray() { return sysTray; };
87 QMenu *getSysTrayMenu() { return systrayMenu; };
88 int getControlsVisibilityStatus();
91 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 FullscreenControllerWidget *fullscreenControls;
109 QMenu *speedControlMenu;
110 SpeedControlWidget *speedControl;
112 void handleMainUi( QSettings* );
113 void askForPrivacy();
114 int privacyDialog( QList<ConfigControl *> *controls );
117 void handleSystray();
118 void createSystray();
120 void createStatusBar();
124 VideoWidget *videoWidget;
126 BackgroundWidget *bgWidget;
127 VisualSelector *visualSelector;
128 PlaylistWidget *playlistWidget;
130 bool videoIsActive; ///< Having a video now / THEMIM->hasV
131 bool videoEmbeddedFlag; ///< Want an external Video Window
132 bool playlistVisible; ///< Is the playlist visible ?
133 bool visualSelectorEnabled;
134 bool notificationEnabled; /// Systray Notifications
136 int i_visualmode; ///< Visual Mode
138 bool isDocked() { return ( i_pl_dock != PL_UNDOCKED ); }
140 input_thread_t *p_input; ///< Main input associated to the playlist
147 virtual void customEvent( QEvent *);
148 virtual void keyPressEvent( QKeyEvent *);
149 virtual void wheelEvent( QWheelEvent * );
152 void undockPlaylist();
153 void dockPlaylist( pl_dock_e i_pos = PL_BOTTOM );
154 void toggleMinimalView();
155 void togglePlaylist();
156 void toggleUpdateSystrayMenu();
157 void toggleAdvanced();
158 void toggleFullScreen();
161 /* Manage the Video Functions from the vout threads */
162 void releaseVideoSlot( void );
166 void doComponentsUpdate();
167 void setStatus( int );
169 void setName( QString );
170 void setVLCWindowsTitle( QString title = "" );
174 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
175 void updateSystrayTooltipName( QString );
176 void updateSystrayTooltipStatus( int );
177 void showSpeedMenu( QPoint );
178 void updateRecentsMenu();
180 void askReleaseVideo( );
181 void askVideoToResize( unsigned int, unsigned int );
182 void askVideoToToggle();
183 void askBgWidgetToToggle();