Disable debug by default
[harmattan/cameraplus] / declarative / imageresolutionmodel.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 IMAGE_RESOLUTION_MODEL_H
24 #define IMAGE_RESOLUTION_MODEL_H
25
26 #include <QAbstractListModel>
27
28 class QtCamImageSettings;
29 class QtCamImageResolution;
30
31 class ImageResolutionModel : public QAbstractListModel {
32   Q_OBJECT
33
34   Q_PROPERTY(QString aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged);
35
36 public:
37
38   enum ResolutionRoles {
39     IdRole = Qt::UserRole + 1,
40     NameRole,
41     CaptureRole,
42     PreviewRole,
43     FpsRole,
44     NightFpsRole,
45     MegaPixelsRole,
46     AspectRatioRole,
47   };
48
49   ImageResolutionModel(QtCamImageSettings *settings, QObject *parent = 0);
50   ~ImageResolutionModel();
51
52   int rowCount(const QModelIndex& parent = QModelIndex()) const;
53
54   QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
55
56   QString aspectRatio() const;
57   void setAspectRatio(const QString& aspectRatio);
58
59 signals:
60   void aspectRatioChanged();
61
62 private:
63   QString m_aspectRatio;
64
65   QtCamImageSettings *m_settings;
66
67   QList<QtCamImageResolution> m_resolutions;
68 };
69
70 #endif /* IMAGE_RESOLUTION_MODEL_H */