]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Qt4 - Main Windows: Rename the interface to $MEDIANAME - VLC media player.
[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     void setVLCWindowsTitle( QString title = "" );
60 protected:
61     void resizeEvent( QResizeEvent * );
62     void dropEvent( QDropEvent *);
63     void dragEnterEvent( QDragEnterEvent * );
64     void dragMoveEvent( QDragMoveEvent * );
65     void dragLeaveEvent( QDragLeaveEvent * );
66     void closeEvent( QCloseEvent *);
67     Ui::MainInterfaceUI ui;
68     friend class VolumeClickHandler;
69 private:
70     QSettings *settings;
71     QSize mainSize, addSize;
72
73     bool need_components_update;
74     void calculateInterfaceSize();
75     void handleMainUi( QSettings* );
76     void doComponentsUpdate();
77
78     /* Video */
79     VideoWidget         *videoWidget;
80     virtual void keyPressEvent( QKeyEvent *);
81     virtual void wheelEvent( QWheelEvent * );
82
83     bool embeddedPlaylistWasActive;
84     bool videoIsActive;
85     QSize savedVideoSize;
86
87
88     BackgroundWidget    *bgWidget;
89     VisualSelector      *visualSelector;
90     ControlsWidget      *advControls;
91     PlaylistWidget      *playlistWidget;
92
93     bool                 playlistEmbeddedFlag;
94     bool                 videoEmbeddedFlag;
95     bool                 alwaysVideoFlag;
96     bool                 advControlsEnabled;
97     bool                 visualSelectorEnabled;
98
99     InputManager        *main_input_manager;
100     InputSlider         *slider;
101     input_thread_t      *p_input;    ///< Main input associated to the playlist
102
103     QLabel              *timeLabel;
104     QLabel              *nameLabel;
105
106     void customEvent( QEvent *);
107 public slots:
108     void undockPlaylist();
109     void playlist();
110 private slots:
111     void setNavigation( int );
112     void setStatus( int );
113     void setName( QString );
114     void setDisplay( float, int, int );
115     void updateOnTimer();
116     void play();
117     void stop();
118     void prev();
119     void next();
120     void visual();
121     void advanced();
122     void updateVolume( int sliderVolume );
123 };
124
125
126 class VolumeClickHandler : public QObject
127 {
128 public:
129     VolumeClickHandler( intf_thread_t *_p_intf, MainInterface *_m ) :QObject(_m)
130     {m = _m; p_intf = _p_intf; }
131     virtual ~VolumeClickHandler() {};
132     bool eventFilter( QObject *obj, QEvent *e )
133     {
134         if (e->type() == QEvent::MouseButtonPress )
135         {
136             aout_VolumeMute( p_intf, NULL );
137             return true;
138         }
139         return false;
140     }
141 private:
142     MainInterface *m;
143     intf_thread_t *p_intf;
144 };
145
146 #endif