Silence g++/moc warnings
[harmattan/cameraplus] / src / cameraresources.h
1 // -*- c++ -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012 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 CAMERA_RESOURCES_H
24 #define CAMERA_RESOURCES_H
25
26 #include <QObject>
27 #include <policy/resource-set.h>
28
29 class CameraResources : public QObject {
30   Q_OBJECT
31
32   Q_PROPERTY(bool acquired READ acquired NOTIFY acquiredChanged);
33
34   Q_ENUMS(Mode);
35
36 public:
37   typedef enum {
38     None,
39     Image,
40     Video,
41     Recording,
42     PostCapture,
43   } Mode;
44
45   CameraResources(QObject *parent = 0);
46   ~CameraResources();
47
48   bool acquired() const;
49
50 public slots:
51   void acquire(const Mode& mode);
52
53 signals:
54   void acquiredChanged();
55
56 private slots:
57   void resourcesReleased();
58   void lostResources();
59   void resourcesGranted(const QList<ResourcePolicy::ResourceType>& optional);
60   void updateOK();
61
62 private:
63   void updateSet(const QList<ResourcePolicy::ResourceType>& required,
64                  const QList<ResourcePolicy::ResourceType>& optional =
65                  QList<ResourcePolicy::ResourceType>());
66
67   QList<ResourcePolicy::ResourceType> listSet();
68
69   ResourcePolicy::ResourceSet *m_set;
70   Mode m_mode;
71   bool m_acquired;
72 };
73
74 #endif /* CAMERA_RESOURCES_H */