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