]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Qt4 - Have a slider to control precisely the rate, usefull since we can here audio...
[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
51 class MainInterface : public QVLCMW
52 {
53     Q_OBJECT;
54 public:
55     MainInterface( intf_thread_t *);
56     virtual ~MainInterface();
57
58     void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
59                         int *pi_y, unsigned int *pi_width,
60                         unsigned int *pi_height );
61     void releaseVideo( void * );
62     int controlVideo( void *p_window, int i_query, va_list args );
63
64     QSystemTrayIcon *getSysTray() { return sysTray; };
65     QMenu *getSysTrayMenu() { return systrayMenu; };
66     int getControlsVisibilityStatus();
67 protected:
68     void resizeEvent( QResizeEvent * );
69     void dropEvent( QDropEvent *);
70     void dragEnterEvent( QDragEnterEvent * );
71     void dragMoveEvent( QDragMoveEvent * );
72     void dragLeaveEvent( QDragLeaveEvent * );
73     void closeEvent( QCloseEvent *);
74  
75     bool eventFilter(QObject *obj, QEvent *event);
76
77     friend class VolumeClickHandler;
78 private:
79     QSettings           *settings;
80     QSize                mainSize, addSize;
81     QSystemTrayIcon     *sysTray;
82     QMenu               *systrayMenu;
83     QString              input_name;
84     QVBoxLayout         *mainLayout;
85     ControlsWidget      *controls;
86     QMenu                               *speedControlMenu;
87     SpeedControlWidget  *speedControl;
88
89     bool                 need_components_update;
90
91     void calculateInterfaceSize();
92     void handleMainUi( QSettings* );
93     void handleSystray();
94     void doComponentsUpdate();
95     void createSystray();
96
97     /* Video */
98     VideoWidget         *videoWidget;
99     virtual void keyPressEvent( QKeyEvent *);
100     virtual void wheelEvent( QWheelEvent * );
101
102     bool                 embeddedPlaylistWasActive;
103     bool                 videoIsActive;
104     QSize                savedVideoSize;
105
106     BackgroundWidget    *bgWidget;
107     VisualSelector      *visualSelector;
108     PlaylistWidget      *playlistWidget;
109
110     bool                 playlistEmbeddedFlag;
111     bool                 videoEmbeddedFlag;
112     bool                 alwaysVideoFlag;
113     bool                 visualSelectorEnabled;
114     bool                 notificationEnabled;
115
116     InputManager        *main_input_manager;
117     input_thread_t      *p_input;    ///< Main input associated to the playlist
118
119     QLabel              *timeLabel;
120     QLabel              *speedLabel;
121     QLabel              *nameLabel;
122     
123     bool                 b_remainingTime;
124
125     void customEvent( QEvent *);
126 public slots:
127     void undockPlaylist();
128     void toggleMenus();
129     void togglePlaylist();
130     void toggleUpdateSystrayMenu();
131     void toggleAdvanced();
132 private slots:
133     void updateOnTimer();
134
135     void setStatus( int );
136     void setRate( int );
137     void setName( QString );
138     void setVLCWindowsTitle( QString title = "" );
139     void setDisplayPosition( float, int, int );
140     void toggleTimeDisplay();
141     void setElapsedTime();
142     void setRemainTime();
143 #if 0
144     void visual();
145 #endif
146     void handleSystrayClick( QSystemTrayIcon::ActivationReason );
147     void updateSystrayMenu( int );
148     void updateSystrayTooltipName( QString );
149     void updateSystrayTooltipStatus( int );
150     void showSpeedMenu( QPoint );
151     void showTimeMenu( QPoint );
152 };
153
154 #endif