]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Qt4 - SHould Fix -- Videos are always started with an incredibly small size.
[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
53 enum{
54     CONTROLS_HIDDEN = 0x0,
55     CONTROLS_VISIBLE = 0x1,
56     CONTROLS_ADVANCED = 0x2
57 };
58
59 class MainInterface : public QVLCMW
60 {
61     Q_OBJECT;
62 public:
63     MainInterface( intf_thread_t *);
64     virtual ~MainInterface();
65
66     void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
67                         int *pi_y, unsigned int *pi_width,
68                         unsigned int *pi_height );
69     void releaseVideo( void * );
70     int controlVideo( void *p_window, int i_query, va_list args );
71
72     QSystemTrayIcon *getSysTray() { return sysTray; };
73     QMenu *getSysTrayMenu() { return systrayMenu; };
74     int getControlsVisibilityStatus();
75     QSize sizeHint() const;
76 protected:
77 //    void resizeEvent( QResizeEvent * );
78     void dropEvent( QDropEvent *);
79     void dragEnterEvent( QDragEnterEvent * );
80     void dragMoveEvent( QDragMoveEvent * );
81     void dragLeaveEvent( QDragLeaveEvent * );
82     void closeEvent( QCloseEvent *);
83
84     friend class VolumeClickHandler;
85 private:
86     QSettings           *settings;
87     QSize                mainSize, addSize;
88     QSystemTrayIcon     *sysTray;
89     QMenu               *systrayMenu;
90     QString              input_name;
91     QVBoxLayout         *mainLayout;
92     ControlsWidget      *controls;
93     QMenu                *speedControlMenu;
94     SpeedControlWidget  *speedControl;
95
96     bool                 need_components_update;
97
98     void handleMainUi( QSettings* );
99     void privacy();
100     void handleSystray();
101     //void buildStatus();
102
103     void createSystray();
104     int privacyDialog( QList<ConfigControl *> controls );
105
106     /* Video */
107     VideoWidget         *videoWidget;
108     virtual void keyPressEvent( QKeyEvent *);
109     virtual void wheelEvent( QWheelEvent * );
110
111     bool                 videoIsActive;
112     QSize                savedVideoSize;
113
114     BackgroundWidget    *bgWidget;
115     VisualSelector      *visualSelector;
116     PlaylistWidget      *playlistWidget;
117     QDockWidget         *dockPL;
118
119     bool                 videoEmbeddedFlag;
120     bool                 alwaysVideoFlag;
121     bool                 visualSelectorEnabled;
122     bool                 notificationEnabled;
123
124     InputManager        *main_input_manager;
125     input_thread_t      *p_input;    ///< Main input associated to the playlist
126
127     /* Status Bar */
128     QLabel              *timeLabel;
129     QLabel              *speedLabel;
130     QLabel              *nameLabel;
131
132     bool                 b_remainingTime; /* showing elapsed or remaining time */
133
134     void customEvent( QEvent *);
135 public slots:
136     void undockPlaylist();
137     void toggleMinimalView();
138     void togglePlaylist();
139     void toggleUpdateSystrayMenu();
140     void toggleAdvanced();
141
142     /* Manage the Video Functions from the vout threads */
143     void releaseVideoSlot( void * );
144
145 private slots:
146     void debug();
147     void updateOnTimer();
148     void doComponentsUpdate();
149     void setStatus( int );
150     void setRate( int );
151     void setName( QString );
152     void setVLCWindowsTitle( QString title = "" );
153     void setDisplayPosition( float, int, int );
154     void toggleTimeDisplay();
155 #if 0
156     void visual();
157 #endif
158     void handleSystrayClick( QSystemTrayIcon::ActivationReason );
159     void updateSystrayTooltipName( QString );
160     void updateSystrayTooltipStatus( int );
161     void showSpeedMenu( QPoint );
162 signals:
163     void askReleaseVideo( void * );
164     void askVideoToResize( unsigned int, unsigned int );
165     void askVideoToToggle();
166     void askBgWidgetToToggle();
167     void askUpdate();
168 };
169
170 #endif