]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
fe44a46302de8c5b6f005186db3a4decd097d732
[vlc] / modules / gui / qt4 / main_interface.hpp
1 /*****************************************************************************
2  * main_interface.hpp : Main Interface
3  ****************************************************************************
4  * Copyright (C) 2006-2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
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.
14  *
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.
19  *
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  *****************************************************************************/
24
25 #ifndef _MAIN_INTERFACE_H_
26 #define _MAIN_INTERFACE_H_
27
28 #include "qt4.hpp"
29 #include "util/qvlcframe.hpp"
30 #include "components/preferences_widgets.hpp"
31
32 #include <vlc_aout.h>
33
34 #include <QSystemTrayIcon>
35
36 class QSettings;
37 class QCloseEvent;
38 class QKeyEvent;
39 class QLabel;
40 class QEvent;
41 class InputManager;
42 class VideoWidget;
43 class BackgroundWidget;
44 class PlaylistWidget;
45 class VisualSelector;
46 class AdvControlsWidget;
47 class ControlsWidget;
48 class FullscreenControllerWidget;
49 class SpeedControlWidget;
50 class QMenu;
51 class QSize;
52 //class QDockWidet;
53 class QProgressBar;
54
55 enum{
56     CONTROLS_HIDDEN = 0x0,
57     CONTROLS_VISIBLE = 0x1,
58     CONTROLS_ADVANCED = 0x2
59 };
60
61 class MainInterface : public QVLCMW
62 {
63     Q_OBJECT;
64
65     friend class VolumeClickHandler;
66     friend class InteractionDialog;
67
68 public:
69     MainInterface( intf_thread_t *);
70     virtual ~MainInterface();
71
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( vout_thread_t *, void * );
77     int controlVideo( void *p_window, int i_query, va_list args );
78
79     void requestLayoutUpdate();
80
81     /* Getters */
82     QSystemTrayIcon *getSysTray() { return sysTray; };
83     QMenu *getSysTrayMenu() { return systrayMenu; };
84     int getControlsVisibilityStatus();
85
86 #if 0    /* Sizehint() */
87     QSize sizeHint() const;
88 #endif
89 protected:
90 //    void resizeEvent( QResizeEvent * );
91     void dropEvent( QDropEvent *);
92     void dragEnterEvent( QDragEnterEvent * );
93     void dragMoveEvent( QDragMoveEvent * );
94     void dragLeaveEvent( QDragLeaveEvent * );
95     void closeEvent( QCloseEvent *);
96
97 private:
98     QSettings           *settings;
99     QSystemTrayIcon     *sysTray;
100     QMenu               *systrayMenu;
101     QString              input_name;
102     QVBoxLayout         *mainLayout;
103     ControlsWidget      *controls;
104     FullscreenControllerWidget *fullscreenControls;
105     QMenu               *speedControlMenu;
106     SpeedControlWidget  *speedControl;
107     QProgressBar        *pgBar;
108
109     void handleMainUi( QSettings* );
110     void askForPrivacy();
111     int  privacyDialog( QList<ConfigControl *> controls );
112
113     /* Systray */
114     void handleSystray();
115     void createSystray();
116
117     void createStatusBar();
118     void initSystray();
119
120     /* Video */
121     VideoWidget         *videoWidget;
122     //    QSize                savedVideoSize;
123
124     BackgroundWidget    *bgWidget;
125     VisualSelector      *visualSelector;
126     PlaylistWidget      *playlistWidget;
127 //    QDockWidget         *dockPL;
128
129     bool                 videoIsActive; ///< Having a video now / THEMIM->hasV
130     bool                 videoEmbeddedFlag; ///< Want an external Video Window
131     bool                 playlistVisible; ///< Is the playlist visible ?
132     bool                 visualSelectorEnabled;
133     bool                 notificationEnabled; /// Systray Notifications
134     bool                 b_remainingTime; /* showing elapsed or remaining time */
135     int                  i_visualmode; ///< Visual Mode
136
137     input_thread_t      *p_input;    ///< Main input associated to the playlist
138
139     /* Status Bar */
140     QLabel              *timeLabel;
141     QLabel              *speedLabel;
142     QLabel              *nameLabel;
143
144     virtual void customEvent( QEvent *);
145     virtual void keyPressEvent( QKeyEvent *);
146     virtual void wheelEvent( QWheelEvent * );
147
148 public slots:
149     void undockPlaylist();
150     void toggleMinimalView();
151     void togglePlaylist();
152     void toggleUpdateSystrayMenu();
153     void toggleAdvanced();
154     void toggleFullScreen();
155
156     /* Manage the Video Functions from the vout threads */
157     void releaseVideoSlot( void * );
158
159 private slots:
160     void debug();
161     void updateOnTimer();
162     void doComponentsUpdate();
163     void setStatus( int );
164     void setRate( int );
165     void setName( QString );
166     void setVLCWindowsTitle( QString title = "" );
167     void setDisplayPosition( float, int, int );
168     void toggleTimeDisplay();
169 #if 0
170     void visual();
171 #endif
172     void handleSystrayClick( QSystemTrayIcon::ActivationReason );
173     void updateSystrayTooltipName( QString );
174     void updateSystrayTooltipStatus( int );
175     void showSpeedMenu( QPoint );
176 signals:
177     void askReleaseVideo( void * );
178     void askVideoToResize( unsigned int, unsigned int );
179     void askVideoToToggle();
180     void askBgWidgetToToggle();
181     void askUpdate();
182 };
183
184 #endif