]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Qt4 - Menus modifications and additions. ( hide & playlist mainly )
[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  *
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
24 #ifndef _MAIN_INTERFACE_H_
25 #define _MAIN_INTERFACE_H_
26
27 #include "qt4.hpp"
28 #include <vlc_aout.h>
29 #include "ui/main_interface.h"
30 #include "util/qvlcframe.hpp"
31
32 #include <QSize>
33
34 class QSettings;
35 class QCloseEvent;
36 class QKeyEvent;
37 class QLabel;
38 class QEvent;
39 class InputManager;
40 class InputSlider;
41 class VideoWidget;
42 class BackgroundWidget;
43 class PlaylistWidget;
44 class VolumeClickHandler;
45 class VisualSelector;
46 class ControlsWidget;
47
48 class MainInterface : public QVLCMW
49 {
50     Q_OBJECT;
51 public:
52     MainInterface( intf_thread_t *);
53     virtual ~MainInterface();
54     void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
55                         int *pi_y, unsigned int *pi_width,
56                         unsigned int *pi_height );
57     void releaseVideo( void *);
58     int controlVideo( void *p_window, int i_query, va_list args );
59 protected:
60     void resizeEvent( QResizeEvent * );
61     void dropEvent( QDropEvent *);
62     void dragEnterEvent( QDragEnterEvent * );
63     void dragMoveEvent( QDragMoveEvent * );
64     void dragLeaveEvent( QDragLeaveEvent * );
65     void closeEvent( QCloseEvent *);
66     Ui::MainInterfaceUI ui;
67     friend class VolumeClickHandler;
68 private:
69     QSettings *settings;
70     QSize mainSize, addSize;
71
72     bool need_components_update;
73     void calculateInterfaceSize();
74     void handleMainUi( QSettings* );
75     void doComponentsUpdate();
76
77     /* Video */
78     VideoWidget         *videoWidget;
79     virtual void keyPressEvent( QKeyEvent *);
80     virtual void wheelEvent( QWheelEvent * );
81
82     bool embeddedPlaylistWasActive;
83     bool videoIsActive;
84     QSize savedVideoSize;
85
86
87     BackgroundWidget    *bgWidget;
88     VisualSelector      *visualSelector;
89     ControlsWidget      *advControls;
90     PlaylistWidget      *playlistWidget;
91
92     bool                 playlistEmbeddedFlag;
93     bool                 videoEmbeddedFlag;
94     bool                 alwaysVideoFlag;
95     bool                 advControlsEnabled;
96     bool                 visualSelectorEnabled;
97
98     InputManager        *main_input_manager;
99     InputSlider         *slider;
100     input_thread_t      *p_input;    ///< Main input associated to the playlist
101
102     QLabel              *timeLabel;
103     QLabel              *nameLabel;
104
105     void customEvent( QEvent *);
106 public slots:
107     void undockPlaylist();
108     void playlist();
109 private slots:
110     void setNavigation( int );
111     void setStatus( int );
112     void setName( QString );
113     void setDisplay( float, int, int );
114     void updateOnTimer();
115     void play();
116     void stop();
117     void prev();
118     void next();
119     void visual();
120     void advanced();
121     void updateVolume( int sliderVolume );
122 };
123
124
125 class VolumeClickHandler : public QObject
126 {
127 public:
128     VolumeClickHandler( intf_thread_t *_p_intf, MainInterface *_m ) :QObject(_m)
129     {m = _m; p_intf = _p_intf; }
130     virtual ~VolumeClickHandler() {};
131     bool eventFilter( QObject *obj, QEvent *e )
132     {
133         if (e->type() == QEvent::MouseButtonPress )
134         {
135             aout_VolumeMute( p_intf, NULL );
136             return true;
137         }
138         return false;
139     }
140 private:
141     MainInterface *m;
142     intf_thread_t *p_intf;
143 };
144
145 #endif