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;
55 CONTROLS_HIDDEN = 0x0,
56 CONTROLS_VISIBLE = 0x1,
57 CONTROLS_ADVANCED = 0x2
60 typedef enum pl_dock_e {
67 class MainInterface : public QVLCMW
71 friend class VolumeClickHandler;
72 friend class InteractionDialog;
73 friend class PlaylistWidget;
76 MainInterface( intf_thread_t *);
77 virtual ~MainInterface();
79 /* Video requests from core */
80 void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
81 int *pi_y, unsigned int *pi_width,
82 unsigned int *pi_height );
83 void releaseVideo( void * );
84 int controlVideo( void *p_window, int i_query, va_list args );
87 QSystemTrayIcon *getSysTray() { return sysTray; };
88 QMenu *getSysTrayMenu() { return systrayMenu; };
89 int getControlsVisibilityStatus();
92 QSize sizeHint() const;
94 // void resizeEvent( QResizeEvent * );
95 void dropEvent( QDropEvent *);
96 void dropEventPlay( QDropEvent *, bool);
97 void dragEnterEvent( QDragEnterEvent * );
98 void dragMoveEvent( QDragMoveEvent * );
99 void dragLeaveEvent( QDragLeaveEvent * );
100 void closeEvent( QCloseEvent *);
104 QSystemTrayIcon *sysTray;
107 QVBoxLayout *mainLayout;
108 ControlsWidget *controls;
109 FullscreenControllerWidget *fullscreenControls;
110 QMenu *speedControlMenu;
111 SpeedControlWidget *speedControl;
113 void handleMainUi( QSettings* );
114 void askForPrivacy();
115 int privacyDialog( QList<ConfigControl *> *controls );
118 void handleSystray();
119 void createSystray();
121 void createStatusBar();
125 VideoWidget *videoWidget;
127 BackgroundWidget *bgWidget;
128 VisualSelector *visualSelector;
129 PlaylistWidget *playlistWidget;
131 bool videoIsActive; ///< Having a video now / THEMIM->hasV
132 bool videoEmbeddedFlag; ///< Want an external Video Window
133 bool playlistVisible; ///< Is the playlist visible ?
134 bool visualSelectorEnabled;
135 bool notificationEnabled; /// Systray Notifications
136 bool b_remainingTime; /* Show elapsed or remaining time */
138 int i_visualmode; ///< Visual Mode
140 bool isDocked() { return ( i_pl_dock != PL_UNDOCKED ); }
142 input_thread_t *p_input; ///< Main input associated to the playlist
149 virtual void customEvent( QEvent *);
150 virtual void keyPressEvent( QKeyEvent *);
151 virtual void wheelEvent( QWheelEvent * );
154 void undockPlaylist();
155 void dockPlaylist( pl_dock_e i_pos = PL_BOTTOM );
156 void toggleMinimalView();
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 updateOnTimer();
169 void doComponentsUpdate();
170 void setStatus( int );
172 void setName( QString );
173 void setVLCWindowsTitle( QString title = "" );
174 void setDisplayPosition( float, int, int );
175 void toggleTimeDisplay();
179 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
180 void updateSystrayTooltipName( QString );
181 void updateSystrayTooltipStatus( int );
182 void showSpeedMenu( QPoint );
184 void askReleaseVideo( void * );
185 void askVideoToResize( unsigned int, unsigned int );
186 void askVideoToToggle();
187 void askBgWidgetToToggle();