]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Qt: add some missing const.
[vlc] / modules / gui / qt4 / main_interface.hpp
1 /*****************************************************************************
2  * main_interface.hpp : Main Interface
3  ****************************************************************************
4  * Copyright (C) 2006-2008 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 QVLC_MAIN_INTERFACE_H_
26 #define QVLC_MAIN_INTERFACE_H_
27
28 #include "qt4.hpp"
29
30 #include "util/qvlcframe.hpp"
31 #include "components/preferences_widgets.hpp" /* First Start */
32
33 #include <QSystemTrayIcon>
34
35 class QSettings;
36 class QCloseEvent;
37 class QKeyEvent;
38 class QLabel;
39 class QEvent;
40 class InputManager;
41 class VideoWidget;
42 class BackgroundWidget;
43 class PlaylistWidget;
44 class VisualSelector;
45 class AdvControlsWidget;
46 class ControlsWidget;
47 class InputControlsWidget;
48 class FullscreenControllerWidget;
49 class SpeedControlWidget;
50 class QMenu;
51 class QSize;
52
53 enum {
54     CONTROLS_VISIBLE = 0x1,
55     CONTROLS_HIDDEN = 0x2,
56     CONTROLS_ADVANCED = 0x4,
57 };
58
59 typedef enum pl_dock_e {
60     PL_UNDOCKED,
61     PL_BOTTOM,
62     PL_RIGHT,
63     PL_LEFT
64 } pl_dock_e;
65
66 class MainInterface : public QVLCMW
67 {
68     Q_OBJECT;
69
70     friend class PlaylistWidget;
71
72 public:
73     MainInterface( intf_thread_t *);
74     virtual ~MainInterface();
75
76     /* Video requests from core */
77     WId requestVideo( vout_thread_t *p_nvout, int *pi_x,
78                       int *pi_y, unsigned int *pi_width,
79                       unsigned int *pi_height );
80     void releaseVideo( void  );
81     int controlVideo( int i_query, va_list args );
82
83     /* Getters */
84     QSystemTrayIcon *getSysTray() { return sysTray; };
85     QMenu *getSysTrayMenu() { return systrayMenu; };
86     int getControlsVisibilityStatus();
87
88     /* Sizehint() */
89     virtual QSize sizeHint() const;
90
91 protected:
92     void dropEventPlay( QDropEvent *, bool);
93     virtual void dropEvent( QDropEvent *);
94     virtual void dragEnterEvent( QDragEnterEvent * );
95     virtual void dragMoveEvent( QDragMoveEvent * );
96     virtual void dragLeaveEvent( QDragLeaveEvent * );
97     virtual void closeEvent( QCloseEvent *);
98     virtual void customEvent( QEvent *);
99     virtual void keyPressEvent( QKeyEvent *);
100     virtual void wheelEvent( QWheelEvent * );
101     virtual void resizeEvent( QResizeEvent * event );
102
103 private:
104     QSettings           *settings;
105     QSystemTrayIcon     *sysTray;
106     QMenu               *systrayMenu;
107     QString              input_name;
108     QVBoxLayout         *mainLayout;
109     ControlsWidget      *controls;
110     InputControlsWidget *inputC;
111     FullscreenControllerWidget *fullscreenControls;
112
113     void createMainWidget( QSettings* );
114     void createStatusBar();
115
116     void askForPrivacy();
117     int  privacyDialog( QList<ConfigControl *> *controls );
118
119     /* Systray */
120     void handleSystray();
121     void createSystray();
122     void initSystray();
123
124
125     /* Video */
126     VideoWidget         *videoWidget;
127
128     BackgroundWidget    *bgWidget;
129     VisualSelector      *visualSelector;
130     PlaylistWidget      *playlistWidget;
131
132     bool                 videoIsActive;       ///< Having a video now / THEMIM->hasV
133     bool                 videoEmbeddedFlag;   ///< Want an external Video Window
134     bool                 playlistVisible;     ///< Is the playlist visible ?
135     bool                 visualSelectorEnabled;
136     bool                 notificationEnabled; /// Systray Notifications
137     bool                 bgWasVisible;
138     bool                 b_keep_size;         ///< persistent resizeable window
139     QSize                mainBasedSize;       ///< based Wnd (normal mode only)
140     QSize                mainVideoSize;       ///< Wnd with video (all modes)
141     int                  i_visualmode;        ///< Visual Mode
142     pl_dock_e            i_pl_dock;
143     bool                 isDocked() { return ( i_pl_dock != PL_UNDOCKED ); }
144     int                  i_bg_height;         ///< Save height of bgWidget
145     bool                 b_shouldHide;
146
147     /* Status Bar */
148     QLabel              *nameLabel;
149     QLabel              *cryptedLabel;
150
151 public slots:
152     void undockPlaylist();
153     void dockPlaylist( pl_dock_e i_pos = PL_BOTTOM );
154     void toggleMinimalView( bool );
155     void togglePlaylist();
156     void toggleUpdateSystrayMenu();
157     void toggleAdvanced();
158     void toggleFullScreen();
159     void toggleFSC();
160     void popupMenu( const QPoint& );
161
162     /* Manage the Video Functions from the vout threads */
163     void releaseVideoSlot( void );
164
165 private slots:
166     void debug();
167     void destroyPopupMenu();
168     void recreateToolbars();
169     void doComponentsUpdate();
170     void setName( const QString& );
171     void setVLCWindowsTitle( const QString& title = "" );
172 #if 0
173     void visual();
174 #endif
175     void handleSystrayClick( QSystemTrayIcon::ActivationReason );
176     void updateSystrayTooltipName( const QString& );
177     void updateSystrayTooltipStatus( int );
178
179     void showCryptedLabel( bool );
180 signals:
181     void askReleaseVideo( );
182     void askVideoToResize( unsigned int, unsigned int );
183     void askVideoToShow( unsigned int, unsigned int );
184     void askBgWidgetToToggle();
185     void askUpdate();
186     void minimalViewToggled( bool );
187     void fullscreenInterfaceToggled( bool );
188 };
189
190 #endif