]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Volume control
[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 class QCloseEvent;
32 class QLabel;
33 class InputManager;
34 class InputSlider;
35 class VideoWidget;
36 class VolumeClickHandler;
37 class MainInterface : public QVLCMW
38 {
39     Q_OBJECT;
40 public:
41     MainInterface( intf_thread_t *);
42     virtual ~MainInterface();
43
44     void resizeEvent( QResizeEvent * );
45
46     QSize videoSize, addSize;
47
48 protected:
49     void closeEvent( QCloseEvent *);
50     Ui::MainInterfaceUI ui;
51     friend class VolumeClickHandler;
52 private:
53     VideoWidget *videoWidget;
54     InputManager *main_input_manager;
55     QLabel *timeLabel;
56     QLabel *nameLabel;
57     InputSlider *slider;
58     /// Main input associated to the playlist
59     input_thread_t *p_input;
60 private slots:
61     void setStatus( int );
62     void setName( QString );
63     void setDisplay( float, int, int );
64     void updateOnTimer();
65     void play();
66     void stop();
67     void prev();
68     void next();
69     void updateVolume( int sliderVolume );
70 };
71
72
73 class VolumeClickHandler : public QObject
74 {
75 public:
76     VolumeClickHandler( MainInterface *_m ) :QObject(_m) {m = _m; }
77     virtual ~VolumeClickHandler() {};
78     bool eventFilter( QObject *obj, QEvent *e )
79     {
80         if (e->type() == QEvent::MouseButtonPress )
81         {
82             if( obj->objectName() == "volLowLabel" )
83             {
84                 m->ui.volumeSlider->setValue( 0 );
85             }
86             else
87                 m->ui.volumeSlider->setValue( 100 );
88             return true;
89         }
90         return false;
91     }
92 private:
93     MainInterface *m;
94 };
95
96 #endif