Add missing capability.cpp
[harmattan/cameraplus] / src / harmattan / devicekeys.h
1 // -*- c++ -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22
23 #ifndef DEVICE_KEYS_H
24 #define DEVICE_KEYS_H
25
26 #include <QObject>
27 #include <qmkeys.h>
28 #include <QMap>
29
30 class DeviceKeys : public QObject {
31   Q_OBJECT
32
33   Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged);
34   Q_PROPERTY(bool repeat READ isRepeating WRITE doRepeat NOTIFY repeatChanged);
35
36 public:
37   DeviceKeys(QObject *parent = 0);
38   ~DeviceKeys();
39
40   bool isActive() const;
41   void setActive(bool active);
42
43   bool isRepeating();
44   void doRepeat(bool repeat);
45
46 signals:
47   void activeChanged();
48   void volumeUpPressed();
49   void volumeUpReleased();
50   void volumeDownPressed();
51   void volumeDownReleased();
52   void repeatChanged();
53
54 private slots:
55   void keyEvent(MeeGo::QmKeys::Key key, MeeGo::QmKeys::State state);
56
57 private:
58   bool setStats(MeeGo::QmKeys::Key key, MeeGo::QmKeys::State state);
59
60   MeeGo::QmKeys *m_keys;
61   QMap<MeeGo::QmKeys::Key, MeeGo::QmKeys::State> m_stats;
62   bool m_repeating;
63 };
64
65 #endif /* DEVICE_KEYS_H */