]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Qt4 - Resizing changes. Part 1
[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 SpeedControlWidget;
49 class QMenu;
50 class QSize;
51 class QDockWidet;
52 class QProgressBar;
53
54 enum{
55     CONTROLS_HIDDEN = 0x0,
56     CONTROLS_VISIBLE = 0x1,
57     CONTROLS_ADVANCED = 0x2
58 };
59
60 class MainInterface : public QVLCMW
61 {
62     Q_OBJECT;
63
64     friend class VolumeClickHandler;
65     friend class InteractionDialog;
66
67 public:
68     MainInterface( intf_thread_t *);
69     virtual ~MainInterface();
70
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();
78
79     /* Getters */
80     QSystemTrayIcon *getSysTray() { return sysTray; };
81     QMenu *getSysTrayMenu() { return systrayMenu; };
82     int getControlsVisibilityStatus();
83
84     bool b_toUpdate;
85 #if 0    /* Sizehint() */
86     QSize sizeHint() const;
87 #endif
88 protected:
89 //    void resizeEvent( QResizeEvent * );
90     void dropEvent( QDropEvent *);
91     void dragEnterEvent( QDragEnterEvent * );
92     void dragMoveEvent( QDragMoveEvent * );
93     void dragLeaveEvent( QDragLeaveEvent * );
94     void closeEvent( QCloseEvent *);
95
96 private:
97     QSettings           *settings;
98     QSystemTrayIcon     *sysTray;
99     QMenu               *systrayMenu;
100     QString              input_name;
101     QVBoxLayout         *mainLayout;
102     ControlsWidget      *controls;
103     QMenu               *speedControlMenu;
104     SpeedControlWidget  *speedControl;
105     QProgressBar        *pgBar;
106
107     void handleMainUi( QSettings* );
108     void askForPrivacy();
109     int  privacyDialog( QList<ConfigControl *> controls );
110
111     /* Systray */
112     void handleSystray();
113     void createSystray();
114
115     void createStatusBar();
116     void initSystray();
117
118     /* Video */
119     VideoWidget         *videoWidget;
120     //    QSize                savedVideoSize;
121
122     BackgroundWidget    *bgWidget;
123     VisualSelector      *visualSelector;
124     PlaylistWidget      *playlistWidget;
125     QDockWidget         *dockPL;
126
127     bool                 videoIsActive; ///< Having a video now / THEMIM->hasV
128     bool                 videoEmbeddedFlag; ///< Want an external Video Window
129     bool                 playlistVisible; ///< Is the playlist visible ?
130     bool                 visualSelectorEnabled;
131     bool                 notificationEnabled; /// Systray Notifications
132     bool                 b_remainingTime; /* showing elapsed or remaining time */
133     int                  i_visualmode; ///< Visual Mode
134
135     input_thread_t      *p_input;    ///< Main input associated to the playlist
136
137     /* Status Bar */
138     QLabel              *timeLabel;
139     QLabel              *speedLabel;
140     QLabel              *nameLabel;
141
142     virtual void customEvent( QEvent *);
143     virtual void keyPressEvent( QKeyEvent *);
144     virtual void wheelEvent( QWheelEvent * );
145
146 public slots:
147     void undockPlaylist();
148     void toggleMinimalView();
149     void togglePlaylist();
150     void toggleUpdateSystrayMenu();
151     void toggleAdvanced();
152     void toggleFullScreen();
153
154     /* Manage the Video Functions from the vout threads */
155     void releaseVideoSlot( void * );
156
157 private slots:
158     void debug();
159     void updateOnTimer();
160     void doComponentsUpdate();
161     void setStatus( int );
162     void setRate( int );
163     void setName( QString );
164     void setVLCWindowsTitle( QString title = "" );
165     void setDisplayPosition( float, int, int );
166     void toggleTimeDisplay();
167 #if 0
168     void visual();
169 #endif
170     void handleSystrayClick( QSystemTrayIcon::ActivationReason );
171     void updateSystrayTooltipName( QString );
172     void updateSystrayTooltipStatus( int );
173     void showSpeedMenu( QPoint );
174 signals:
175     void askReleaseVideo( void * );
176     void askVideoToResize( unsigned int, unsigned int );
177     void askVideoToToggle();
178     void askBgWidgetToToggle();
179     void askUpdate();
180 };
181
182 #endif