]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
A bit of headers cleanup
[vlc] / modules / gui / qt4 / main_interface.hpp
1 /*****************************************************************************
2  * main_interface.hpp : Main Interface
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
22
23 #ifndef _MAIN_INTERFACE_H_
24 #define _MAIN_INTERFACE_H_
25
26 #include "qt4.hpp"
27 #include <vlc_aout.h>
28 #include "ui/main_interface.h"
29 #include "util/qvlcframe.hpp"
30
31 #include <QSize>
32
33 class QSettings;
34 class QCloseEvent;
35 class QKeyEvent;
36 class QLabel;
37 class QEvent;
38 class InputManager;
39 class InputSlider;
40 class VideoWidget;
41 class BackgroundWidget;
42 class PlaylistWidget;
43 class VolumeClickHandler;
44 class VisualSelector;
45 class ControlsWidget;
46
47 class MainInterface : public QVLCMW
48 {
49     Q_OBJECT;
50 public:
51     MainInterface( intf_thread_t *);
52     virtual ~MainInterface();
53     void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
54                         int *pi_y, unsigned int *pi_width,
55                         unsigned int *pi_height );
56     void releaseVideo( void *);
57     int controlVideo( void *p_window, int i_query, va_list args );
58 protected:
59     void resizeEvent( QResizeEvent * );
60     void dropEvent( QDropEvent *);
61     void dragEnterEvent( QDragEnterEvent * );
62     void dragMoveEvent( QDragMoveEvent * );
63     void dragLeaveEvent( QDragLeaveEvent * );
64     void closeEvent( QCloseEvent *);
65     Ui::MainInterfaceUI ui;
66     friend class VolumeClickHandler;
67 private:
68     QSettings *settings;
69     QSize mainSize, addSize;
70
71     bool need_components_update;
72     void calculateInterfaceSize();
73     void handleMainUi( QSettings* );
74     void doComponentsUpdate();
75
76     /* Video */
77     VideoWidget         *videoWidget;
78     virtual void keyPressEvent( QKeyEvent *);
79
80     BackgroundWidget    *bgWidget;
81     VisualSelector      *visualSelector;
82     ControlsWidget      *advControls;
83     PlaylistWidget      *playlistWidget;
84
85     bool                 playlistEmbeddedFlag;
86     bool                 videoEmbeddedFlag;
87     bool                 alwaysVideoFlag;
88     bool                 advControlsEnabled;
89     bool                 visualSelectorEnabled;
90
91     InputManager        *main_input_manager;
92     InputSlider         *slider;
93     input_thread_t      *p_input;    ///< Main input associated to the playlist
94
95     QLabel              *timeLabel;
96     QLabel              *nameLabel;
97
98     void customEvent( QEvent *);
99 public slots:
100     void undockPlaylist();
101 private slots:
102     void setStatus( int );
103     void setName( QString );
104     void setDisplay( float, int, int );
105     void updateOnTimer();
106     void play();
107     void stop();
108     void prev();
109     void next();
110     void playlist();
111     void visual();
112     void advanced();
113     void updateVolume( int sliderVolume );
114 };
115
116
117 class VolumeClickHandler : public QObject
118 {
119 public:
120     VolumeClickHandler( intf_thread_t *_p_intf, MainInterface *_m ) :QObject(_m)
121     {m = _m; p_intf = _p_intf; }
122     virtual ~VolumeClickHandler() {};
123     bool eventFilter( QObject *obj, QEvent *e )
124     {
125         if (e->type() == QEvent::MouseButtonPress )
126         {
127             aout_VolumeMute( p_intf, NULL );
128             return true;
129         }
130         return false;
131     }
132 private:
133     MainInterface *m;
134     intf_thread_t *p_intf;
135 };
136
137 #endif