File indexing completed on 2024-04-14 03:42:57

0001 /*
0002     SPDX-FileCopyrightText: 2009 Prakash Mohan <prakash.mohan@kdemail.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "oal/scope.h"
0008 #include <QJsonObject>
0009 
0010 void OAL::Scope::setScope(const QString &_id, const QString &_model, const QString &_vendor, const QString &_type,
0011                           double _focalLength, double _aperture)
0012 {
0013     m_Id          = _id;
0014     m_Model       = _model;
0015     m_Vendor      = _vendor;
0016     m_Type        = _type;
0017     m_FocalLength = _focalLength;
0018     m_Aperture    = _aperture;
0019 
0020     m_Name = QString("%1 %2 %3@F/%4").arg(m_Vendor, m_Model, QString::number(m_FocalLength, 'f', 0),
0021                                           QString::number(m_FocalLength / m_Aperture, 'f', 1));
0022 }
0023 
0024 QJsonObject OAL::Scope::toJson() const
0025 {
0026     return
0027     {
0028         {"id", m_Id},
0029         {"model", m_Model},
0030         {"vendor", m_Vendor},
0031         {"type", m_Type},
0032         {"name", m_Name},
0033         {"focal_length", m_FocalLength},
0034         {"aperture", m_Aperture},
0035     };
0036 }