1 /*****************************************************************************
2 * main_interface.hpp : Main Interface
3 ****************************************************************************
4 * Copyright (C) 2006-2007 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;
56 CONTROLS_HIDDEN = 0x0,
57 CONTROLS_VISIBLE = 0x1,
58 CONTROLS_ADVANCED = 0x2
61 class MainInterface : public QVLCMW
65 friend class VolumeClickHandler;
66 friend class InteractionDialog;
69 MainInterface( intf_thread_t *);
70 virtual ~MainInterface();
72 /* Video requests from core */
73 void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
74 int *pi_y, unsigned int *pi_width,
75 unsigned int *pi_height );
76 void releaseVideo( void * );
77 int controlVideo( void *p_window, int i_query, va_list args );
78 void requestLayoutUpdate();
81 QSystemTrayIcon *getSysTray() { return sysTray; };
82 QMenu *getSysTrayMenu() { return systrayMenu; };
83 int getControlsVisibilityStatus();
85 #if 0 /* Sizehint() */
86 QSize sizeHint() const;
89 // void resizeEvent( QResizeEvent * );
90 void dropEvent( QDropEvent *);
91 void dragEnterEvent( QDragEnterEvent * );
92 void dragMoveEvent( QDragMoveEvent * );
93 void dragLeaveEvent( QDragLeaveEvent * );
94 void closeEvent( QCloseEvent *);
98 QSystemTrayIcon *sysTray;
101 QVBoxLayout *mainLayout;
102 ControlsWidget *controls;
103 FullscreenControllerWidget *fullscreenControls;
104 QMenu *speedControlMenu;
105 SpeedControlWidget *speedControl;
108 void handleMainUi( QSettings* );
109 void askForPrivacy();
110 int privacyDialog( QList<ConfigControl *> controls );
113 void handleSystray();
114 void createSystray();
116 void createStatusBar();
120 VideoWidget *videoWidget;
121 // QSize savedVideoSize;
123 BackgroundWidget *bgWidget;
124 VisualSelector *visualSelector;
125 PlaylistWidget *playlistWidget;
126 // QDockWidget *dockPL;
128 bool videoIsActive; ///< Having a video now / THEMIM->hasV
129 bool videoEmbeddedFlag; ///< Want an external Video Window
130 bool playlistVisible; ///< Is the playlist visible ?
131 bool visualSelectorEnabled;
132 bool notificationEnabled; /// Systray Notifications
133 bool b_remainingTime; /* showing elapsed or remaining time */
134 int i_visualmode; ///< Visual Mode
136 input_thread_t *p_input; ///< Main input associated to the playlist
143 virtual void customEvent( QEvent *);
144 virtual void keyPressEvent( QKeyEvent *);
145 virtual void wheelEvent( QWheelEvent * );
148 void undockPlaylist();
149 void toggleMinimalView();
150 void togglePlaylist();
151 void toggleUpdateSystrayMenu();
152 void toggleAdvanced();
153 void toggleFullScreen();
155 /* Manage the Video Functions from the vout threads */
156 void releaseVideoSlot( void * );
160 void updateOnTimer();
161 void doComponentsUpdate();
162 void setStatus( int );
164 void setName( QString );
165 void setVLCWindowsTitle( QString title = "" );
166 void setDisplayPosition( float, int, int );
167 void toggleTimeDisplay();
171 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
172 void updateSystrayTooltipName( QString );
173 void updateSystrayTooltipStatus( int );
174 void showSpeedMenu( QPoint );
176 void askReleaseVideo( void * );
177 void askVideoToResize( unsigned int, unsigned int );
178 void askVideoToToggle();
179 void askBgWidgetToToggle();