]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Rework of the embedded stuff. This breaks everything :)
[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
45 class MainInterface : public QVLCMW
46 {
47     Q_OBJECT;
48 public:
49     MainInterface( intf_thread_t *);
50     virtual ~MainInterface();
51
52     void resizeEvent( QResizeEvent * );
53
54 protected:
55     void closeEvent( QCloseEvent *);
56     Ui::MainInterfaceUI ui;
57     friend class VolumeClickHandler;
58 private:
59     QSettings *settings;
60     QSize mainSize, addSize;
61
62     void calculateInterfaceSize();
63     void handleMainUi( QSettings* );
64     
65     virtual void keyPressEvent( QKeyEvent *);
66
67     /* All the stuff that goes in the main position */
68     VideoWidget         *videoWidget;
69     BackgroundWidget    *bgWidget;
70     PlaylistWidget      *playlistWidget;
71
72     bool                 playlistEmbeddedFlag;
73     bool                 videoEmbeddedFlag;
74
75     InputManager        *main_input_manager;
76     InputSlider         *slider;
77     input_thread_t      *p_input;    ///< Main input associated to the playlist
78
79     QLabel              *timeLabel;
80     QLabel              *nameLabel;
81 private slots:
82     void setStatus( int );
83     void setName( QString );
84     void setDisplay( float, int, int );
85     void updateOnTimer();
86     void play();
87     void stop();
88     void prev();
89     void next();
90     void playlist();
91     void updateVolume( int sliderVolume );
92 };
93
94
95 class VolumeClickHandler : public QObject
96 {
97 public:
98     VolumeClickHandler( MainInterface *_m ) :QObject(_m) {m = _m; }
99     virtual ~VolumeClickHandler() {};
100     bool eventFilter( QObject *obj, QEvent *e )
101     {
102         if (e->type() == QEvent::MouseButtonPress )
103         {
104             if( obj->objectName() == "volLowLabel" )
105             {
106                 m->ui.volumeSlider->setValue( 0 );
107             }
108             else
109                 m->ui.volumeSlider->setValue( 100 );
110             return true;
111         }
112         return false;
113     }
114 private:
115     MainInterface *m;
116 };
117
118 #endif