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