CameraSpec.h 3.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#pragma once

Don Gagne's avatar
Don Gagne committed
12
#include "SettingsFact.h"
13 14 15 16 17 18

class CameraSpec : public QObject
{
    Q_OBJECT

public:
19
    CameraSpec(const QString& settingsGroup, QObject* parent = nullptr);
20 21 22 23 24 25 26 27 28 29 30 31 32

    const CameraSpec& operator=(const CameraSpec& other);

    // These properties are persisted to Json
    Q_PROPERTY(Fact* sensorWidth        READ sensorWidth        CONSTANT)   ///< Sensor size in millimeters
    Q_PROPERTY(Fact* sensorHeight       READ sensorHeight       CONSTANT)   ///< Sensor size in millimeters
    Q_PROPERTY(Fact* imageWidth         READ imageWidth         CONSTANT)   ///< Image size in pixels
    Q_PROPERTY(Fact* imageHeight        READ imageHeight        CONSTANT)   ///< Image size in pixels
    Q_PROPERTY(Fact* focalLength        READ focalLength        CONSTANT)   ///< Focal length in millimeters
    Q_PROPERTY(Fact* landscape          READ landscape          CONSTANT)   ///< true: camera is in landscape orientation
    Q_PROPERTY(Fact* fixedOrientation   READ fixedOrientation   CONSTANT)   ///< true: camera is in fixed orientation
    Q_PROPERTY(Fact* minTriggerInterval READ minTriggerInterval CONSTANT)   ///< Minimum time in seconds between each photo taken, 0 for not specified

Don Gagne's avatar
Don Gagne committed
33 34 35 36 37 38 39 40
    SettingsFact* sensorWidth       (void) { return &_sensorWidthFact; }
    SettingsFact* sensorHeight      (void) { return &_sensorHeightFact; }
    SettingsFact* imageWidth        (void) { return &_imageWidthFact; }
    SettingsFact* imageHeight       (void) { return &_imageHeightFact; }
    SettingsFact* focalLength       (void) { return &_focalLengthFact; }
    SettingsFact* landscape         (void) { return &_landscapeFact; }
    SettingsFact* fixedOrientation  (void) { return &_fixedOrientationFact; }
    SettingsFact* minTriggerInterval(void) { return &_minTriggerIntervalFact; }
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

    bool dirty      (void) const { return _dirty; }
    void setDirty   (bool dirty);

    void save(QJsonObject& json) const;
    bool load(const QJsonObject& json, QString& errorString);

signals:
    void dirtyChanged(bool dirty);

private:
    bool _dirty;

    QMap<QString, FactMetaData*> _metaDataMap;

Don Gagne's avatar
Don Gagne committed
56 57 58 59 60 61 62 63
    SettingsFact _sensorWidthFact;
    SettingsFact _sensorHeightFact;
    SettingsFact _imageWidthFact;
    SettingsFact _imageHeightFact;
    SettingsFact _focalLengthFact;
    SettingsFact _landscapeFact;
    SettingsFact _fixedOrientationFact;
    SettingsFact _minTriggerIntervalFact;
64 65 66 67 68 69 70 71 72 73

    static const char* _sensorWidthName;
    static const char* _sensorHeightName;
    static const char* _imageWidthName;
    static const char* _imageHeightName;
    static const char* _focalLengthName;
    static const char* _landscapeName;
    static const char* _fixedOrientationName;
    static const char* _minTriggerIntervalName;
};