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 SpeedControlWidget;
55 CONTROLS_HIDDEN = 0x0,
56 CONTROLS_VISIBLE = 0x1,
57 CONTROLS_ADVANCED = 0x2
60 class MainInterface : public QVLCMW
64 friend class VolumeClickHandler;
65 friend class InteractionDialog;
68 MainInterface( intf_thread_t *);
69 virtual ~MainInterface();
71 /* Video requests from core */
72 void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
73 int *pi_y, unsigned int *pi_width,
74 unsigned int *pi_height );
75 void releaseVideo( void * );
76 int controlVideo( void *p_window, int i_query, va_list args );
77 void requestLayoutUpdate();
80 QSystemTrayIcon *getSysTray() { return sysTray; };
81 QMenu *getSysTrayMenu() { return systrayMenu; };
82 int getControlsVisibilityStatus();
84 #if 0 /* Sizehint() */
85 QSize sizeHint() const;
88 // void resizeEvent( QResizeEvent * );
89 void dropEvent( QDropEvent *);
90 void dragEnterEvent( QDragEnterEvent * );
91 void dragMoveEvent( QDragMoveEvent * );
92 void dragLeaveEvent( QDragLeaveEvent * );
93 void closeEvent( QCloseEvent *);
97 QSystemTrayIcon *sysTray;
100 QVBoxLayout *mainLayout;
101 ControlsWidget *controls;
102 QMenu *speedControlMenu;
103 SpeedControlWidget *speedControl;
106 void handleMainUi( QSettings* );
107 void askForPrivacy();
108 int privacyDialog( QList<ConfigControl *> controls );
111 void handleSystray();
112 void createSystray();
114 void createStatusBar();
118 VideoWidget *videoWidget;
119 // QSize savedVideoSize;
121 BackgroundWidget *bgWidget;
122 VisualSelector *visualSelector;
123 PlaylistWidget *playlistWidget;
124 // QDockWidget *dockPL;
126 bool videoIsActive; ///< Having a video now / THEMIM->hasV
127 bool videoEmbeddedFlag; ///< Want an external Video Window
128 bool playlistVisible; ///< Is the playlist visible ?
129 bool visualSelectorEnabled;
130 bool notificationEnabled; /// Systray Notifications
131 bool b_remainingTime; /* showing elapsed or remaining time */
132 int i_visualmode; ///< Visual Mode
134 input_thread_t *p_input; ///< Main input associated to the playlist
141 virtual void customEvent( QEvent *);
142 virtual void keyPressEvent( QKeyEvent *);
143 virtual void wheelEvent( QWheelEvent * );
146 void undockPlaylist();
147 void toggleMinimalView();
148 void togglePlaylist();
149 void toggleUpdateSystrayMenu();
150 void toggleAdvanced();
151 void toggleFullScreen();
153 /* Manage the Video Functions from the vout threads */
154 void releaseVideoSlot( void * );
158 void updateOnTimer();
159 void doComponentsUpdate();
160 void setStatus( int );
162 void setName( QString );
163 void setVLCWindowsTitle( QString title = "" );
164 void setDisplayPosition( float, int, int );
165 void toggleTimeDisplay();
169 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
170 void updateSystrayTooltipName( QString );
171 void updateSystrayTooltipStatus( int );
172 void showSpeedMenu( QPoint );
174 void askReleaseVideo( void * );
175 void askVideoToResize( unsigned int, unsigned int );
176 void askVideoToToggle();
177 void askBgWidgetToToggle();