2029f79fc03cc333dfd933d18828cc628848011c
[qtmeetings] / src / IO / DeviceControl / HWKeyListener.cpp
1 #include "HWKeyListener.h"
2
3 #include <QCoreApplication>
4 #include <QKeyEvent>
5 #include <QtDebug>
6
7 HWKeyListener::HWKeyListener() : QObject()
8 {
9         iApplication = QCoreApplication::instance( );
10         iApplication->installEventFilter( this );
11 }
12
13 HWKeyListener::~HWKeyListener()
14 {
15
16 }
17
18 bool HWKeyListener::eventFilter( QObject*, QEvent* e )
19 {
20         if ( e->type() == QEvent::KeyPress )
21         {
22                 QKeyEvent *keyEvent = static_cast<QKeyEvent *>( e );
23                 switch ( keyEvent->key() )
24                 {
25                         case Qt::Key_F6:
26                                 qDebug() << "HW key full screen pressed";
27                                 emit HWKeyFullScreenPressed();
28                                 break;
29                         case Qt::Key_F7:
30                                 qDebug() << "HW key zoom out pressed";
31                                 emit HWKeyZoomOutPressed();
32                                 break;
33                         case Qt::Key_F8:
34                                 qDebug() << "HW key zoom in pressed";
35                                 emit HWKeyZoomInPressed();
36                 }
37         }
38         return false;
39 }