File indexing completed on 2024-04-14 14:11:11

0001 /*
0002     SPDX-FileCopyrightText: 2021 Jasem Mutlaq
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "oal/dslrlens.h"
0008 #include <QJsonObject>
0009 
0010 void OAL::DSLRLens::setDSLRLens(const QString &_id, const QString &_model, const QString &_vendor, double _focalLength, double _focalRatio)
0011 {
0012     m_Id          = _id;
0013     m_Model       = _model;
0014     m_Vendor      = _vendor;
0015     m_FocalLength = _focalLength;
0016     m_FocalRatio  = _focalRatio;
0017 
0018     m_Name = QString("%1 %2 %3@F/%4").arg(m_Vendor, m_Model, QString::number(m_FocalLength, 'f', 0), QString::number(m_FocalRatio, 'f', 1));
0019 }
0020 
0021 QJsonObject OAL::DSLRLens::toJson() const
0022 {
0023     return
0024     {
0025         {"id", m_Id},
0026         {"model", m_Model},
0027         {"vendor", m_Vendor},
0028         {"name", m_Name},
0029         {"focal_length", m_FocalLength},
0030         {"focal_ratio", m_FocalRatio},
0031     };
0032 }