]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Qt4 - remember if the playlist was inside or not. Clean.
[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     /* Video requests from core */
67     void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
68                         int *pi_y, unsigned int *pi_width,
69                         unsigned int *pi_height );
70     void releaseVideo( void * );
71     int controlVideo( void *p_window, int i_query, va_list args );
72
73     /* Getters */
74     QSystemTrayIcon *getSysTray() { return sysTray; };
75     QMenu *getSysTrayMenu() { return systrayMenu; };
76     int getControlsVisibilityStatus();
77
78     /* Sizehint() */
79     QSize sizeHint() const;
80 protected:
81 //    void resizeEvent( QResizeEvent * );
82     void dropEvent( QDropEvent *);
83     void dragEnterEvent( QDragEnterEvent * );
84     void dragMoveEvent( QDragMoveEvent * );
85     void dragLeaveEvent( QDragLeaveEvent * );
86     void closeEvent( QCloseEvent *);
87
88     friend class VolumeClickHandler;
89 private:
90     QSettings           *settings;
91     QSystemTrayIcon     *sysTray;
92     QMenu               *systrayMenu;
93     QString              input_name;
94     QVBoxLayout         *mainLayout;
95     ControlsWidget      *controls;
96     QMenu               *speedControlMenu;
97     SpeedControlWidget  *speedControl;
98
99     void handleMainUi( QSettings* );
100     void privacy();
101     int  privacyDialog( QList<ConfigControl *> controls );
102
103     /* Systray */
104     void handleSystray();
105     void createSystray();
106
107     /* Video */
108     VideoWidget         *videoWidget;
109     //    QSize                savedVideoSize;
110
111     BackgroundWidget    *bgWidget;
112     VisualSelector      *visualSelector;
113     PlaylistWidget      *playlistWidget;
114     QDockWidget         *dockPL;
115
116     bool                 videoIsActive; ///< Having a video now / THEMIM->hasV
117     bool                 videoEmbeddedFlag; ///< Want an external Video Window
118     bool                 playlistVisible; ///< Is the playlist visible ?
119     bool                 alwaysVideoFlag; ///< Always show the background
120     bool                 visualSelectorEnabled;
121     bool                 notificationEnabled; /// Systray Notifications
122     bool                 b_remainingTime; /* showing elapsed or remaining time */
123
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     virtual void customEvent( QEvent *);
132     virtual void keyPressEvent( QKeyEvent *);
133     virtual void wheelEvent( QWheelEvent * );
134
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