]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Qt4 - lame attempt for the resizing of the interface.
[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 handleSystray();
100
101     void createSystray();
102     void privacyDialog( QList<ConfigControl *> controls );
103
104     /* Video */
105     VideoWidget         *videoWidget;
106     virtual void keyPressEvent( QKeyEvent *);
107     virtual void wheelEvent( QWheelEvent * );
108
109     bool                 embeddedPlaylistWasActive;
110     bool                 videoIsActive;
111     QSize                savedVideoSize;
112
113     BackgroundWidget    *bgWidget;
114     VisualSelector      *visualSelector;
115     PlaylistWidget      *playlistWidget;
116     QDockWidget         *dockPL;
117
118     bool                 videoEmbeddedFlag;
119     bool                 alwaysVideoFlag;
120     bool                 visualSelectorEnabled;
121     bool                 notificationEnabled;
122
123     InputManager        *main_input_manager;
124     input_thread_t      *p_input;    ///< Main input associated to the playlist
125
126     /* Status Bar */
127     QLabel              *timeLabel;
128     QLabel              *speedLabel;
129     QLabel              *nameLabel;
130
131     bool                 b_remainingTime; /* showing elapsed or remaining time */
132
133     void customEvent( QEvent *);
134 public slots:
135     void undockPlaylist();
136     void toggleMinimalView();
137     void togglePlaylist();
138     void toggleUpdateSystrayMenu();
139     void toggleAdvanced();
140
141     /* Manage the Video Functions from the vout threads */
142     void releaseVideoSlot( void * );
143
144 private slots:
145     void debug();
146     void updateOnTimer();
147     void doComponentsUpdate();
148     void setStatus( int );
149     void setRate( int );
150     void setName( QString );
151     void setVLCWindowsTitle( QString title = "" );
152     void setDisplayPosition( float, int, int );
153     void toggleTimeDisplay();
154 #if 0
155     void visual();
156 #endif
157     void handleSystrayClick( QSystemTrayIcon::ActivationReason );
158     void updateSystrayTooltipName( QString );
159     void updateSystrayTooltipStatus( int );
160     void showSpeedMenu( QPoint );
161 signals:
162     void askReleaseVideo( void * );
163     void askVideoToToggle();
164     void askBgWidgetToToggle();
165 };
166
167 #endif