]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Some cleanup, start integrating audio visualizations
[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 <vlc/intf.h>
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
38 class InputManager;
39 class InputSlider;
40 class VideoWidget;
41 class BackgroundWidget;
42 class PlaylistWidget;
43 class VolumeClickHandler;
44 class VisualSelector;
45
46 class MainInterface : public QVLCMW
47 {
48     Q_OBJECT;
49 public:
50     MainInterface( intf_thread_t *);
51     virtual ~MainInterface();
52     void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
53                         int *pi_y, unsigned int *pi_width,
54                         unsigned int *pi_height );
55     void releaseVideo( void *);
56     int controlVideo( void *p_window, int i_query, va_list args );
57 protected:
58     void resizeEvent( QResizeEvent * );
59     void closeEvent( QCloseEvent *);
60     Ui::MainInterfaceUI ui;
61     friend class VolumeClickHandler;
62 private:
63     QSettings *settings;
64     QSize mainSize, addSize;
65
66     bool need_components_update;
67     void calculateInterfaceSize();
68     void handleMainUi( QSettings* );
69     void doComponentsUpdate();
70
71     /* Video */
72     VideoWidget         *videoWidget;
73     virtual void keyPressEvent( QKeyEvent *);
74
75     BackgroundWidget    *bgWidget;
76     VisualSelector      *visualSelector;
77     PlaylistWidget      *playlistWidget;
78
79     bool                 playlistEmbeddedFlag;
80     bool                 videoEmbeddedFlag;
81     bool                 alwaysVideoFlag;
82
83     InputManager        *main_input_manager;
84     InputSlider         *slider;
85     input_thread_t      *p_input;    ///< Main input associated to the playlist
86
87     QLabel              *timeLabel;
88     QLabel              *nameLabel;
89 private slots:
90     void setStatus( int );
91     void setName( QString );
92     void setDisplay( float, int, int );
93     void updateOnTimer();
94     void play();
95     void stop();
96     void prev();
97     void next();
98     void playlist();
99     void visual();
100     void updateVolume( int sliderVolume );
101 };
102
103
104 class VolumeClickHandler : public QObject
105 {
106 public:
107     VolumeClickHandler( intf_thread_t *_p_intf, MainInterface *_m ) :QObject(_m)
108     {m = _m; p_intf = _p_intf; }
109     virtual ~VolumeClickHandler() {};
110     bool eventFilter( QObject *obj, QEvent *e )
111     {
112         if (e->type() == QEvent::MouseButtonPress )
113         {
114             aout_VolumeMute( p_intf, NULL );
115             return true;
116         }
117         return false;
118     }
119 private:
120     MainInterface *m;
121     intf_thread_t *p_intf;
122 };
123
124 #endif