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 );
79 QSystemTrayIcon *getSysTray() { return sysTray; };
80 QMenu *getSysTrayMenu() { return systrayMenu; };
81 int getControlsVisibilityStatus();
84 QSize sizeHint() const;
86 // void resizeEvent( QResizeEvent * );
87 void dropEvent( QDropEvent *);
88 void dragEnterEvent( QDragEnterEvent * );
89 void dragMoveEvent( QDragMoveEvent * );
90 void dragLeaveEvent( QDragLeaveEvent * );
91 void closeEvent( QCloseEvent *);
95 QSystemTrayIcon *sysTray;
98 QVBoxLayout *mainLayout;
99 ControlsWidget *controls;
100 QMenu *speedControlMenu;
101 SpeedControlWidget *speedControl;
104 void handleMainUi( QSettings* );
106 int privacyDialog( QList<ConfigControl *> controls );
109 void handleSystray();
110 void createSystray();
113 VideoWidget *videoWidget;
114 // QSize savedVideoSize;
116 BackgroundWidget *bgWidget;
117 VisualSelector *visualSelector;
118 PlaylistWidget *playlistWidget;
121 bool videoIsActive; ///< Having a video now / THEMIM->hasV
122 bool videoEmbeddedFlag; ///< Want an external Video Window
123 bool playlistVisible; ///< Is the playlist visible ?
124 bool alwaysVideoFlag; ///< Always show the background
125 bool visualSelectorEnabled;
126 bool notificationEnabled; /// Systray Notifications
127 bool b_remainingTime; /* showing elapsed or remaining time */
129 input_thread_t *p_input; ///< Main input associated to the playlist
136 virtual void customEvent( QEvent *);
137 virtual void keyPressEvent( QKeyEvent *);
138 virtual void wheelEvent( QWheelEvent * );
141 void undockPlaylist();
142 void toggleMinimalView();
143 void togglePlaylist();
144 void toggleUpdateSystrayMenu();
145 void toggleAdvanced();
146 void toggleFullScreen();
148 /* Manage the Video Functions from the vout threads */
149 void releaseVideoSlot( void * );
153 void updateOnTimer();
154 void doComponentsUpdate();
155 void setStatus( int );
157 void setName( QString );
158 void setVLCWindowsTitle( QString title = "" );
159 void setDisplayPosition( float, int, int );
160 void toggleTimeDisplay();
164 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
165 void updateSystrayTooltipName( QString );
166 void updateSystrayTooltipStatus( int );
167 void showSpeedMenu( QPoint );
169 void askReleaseVideo( void * );
170 void askVideoToResize( unsigned int, unsigned int );
171 void askVideoToToggle();
172 void askBgWidgetToToggle();