File indexing completed on 2024-05-12 05:21:34

0001 /*
0002     SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kpkpass_export.h"
0010 
0011 #include <QMetaType>
0012 
0013 #include <memory>
0014 
0015 class QJsonObject;
0016 
0017 namespace KPkPass
0018 {
0019 class LocationPrivate;
0020 
0021 /** A pass location element.
0022  *  @see https://developer.apple.com/library/content/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/LowerLevel.html
0023  */
0024 class KPKPASS_EXPORT Location
0025 {
0026     Q_GADGET
0027     Q_PROPERTY(double altitude READ altitude CONSTANT)
0028     Q_PROPERTY(double latitude READ latitude CONSTANT)
0029     Q_PROPERTY(double longitude READ longitude CONSTANT)
0030     Q_PROPERTY(QString relevantText READ relevantText CONSTANT)
0031 public:
0032     Location();
0033     ~Location();
0034 
0035     /** Altitude in meters, NaN if not set. */
0036     [[nodiscard]] double altitude() const;
0037     /** Latitude in degree. */
0038     [[nodiscard]] double latitude() const;
0039     /** Longitude in degree. */
0040     [[nodiscard]] double longitude() const;
0041     /** Text to display when location is reached. */
0042     [[nodiscard]] QString relevantText() const;
0043 
0044 private:
0045     friend class Pass;
0046     explicit Location(const QJsonObject &obj);
0047     std::shared_ptr<LocationPrivate> d;
0048 };
0049 
0050 }