KPublicTransport

equipment.h
1/*
2 SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KPUBLICTRANSPORT_EQUIPMENT_H
8#define KPUBLICTRANSPORT_EQUIPMENT_H
9
10#include "kpublictransport_export.h"
11
12#include "datatypes.h"
13#include "disruption.h"
14
15#include <QStringList>
16
17class QJsonObject;
18
19namespace KPublicTransport {
20
21class EquipmentPrivate;
22
23/** Status information about equipment such as elevators or escalators. */
24class KPUBLICTRANSPORT_EXPORT Equipment
25{
26 KPUBLICTRANSPORT_GADGET(Equipment)
27public:
28 /** Type of equipment. */
29 enum Type {
30 Unknown,
31 Elevator,
32 Escalator,
33 };
34 Q_ENUM(Type)
35 KPUBLICTRANSPORT_PROPERTY(Type, type, setType)
36
37 /** Disruption effect on this section, if any. */
38 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Disruption::Effect, disruptionEffect, setDisruptionEffect)
39 /** General human-readable notes on this service, e.g. details about a disruption. */
40 KPUBLICTRANSPORT_PROPERTY(QStringList, notes, setNotes)
41
42 /** An icon representing the equipment type.
43 * Can be a qrc: URL or XDG icon name.
44 */
45 Q_PROPERTY(QString iconName READ iconName STORED false)
46
47public:
48 /** Adds a note. This will check for duplicates and normalize the notes. */
49 void addNote(const QString &note);
50
51 [[nodiscard]] QString iconName() const;
52
53 /** Serializes one object to JSON. */
54 static QJsonObject toJson(const Equipment &equipment);
55 /** Deserialize an object from JSON. */
56 static Equipment fromJson(const QJsonObject &obj);
57};
58
59}
60
61Q_DECLARE_METATYPE(KPublicTransport::Equipment)
62
63#endif // KPUBLICTRANSPORT_EQUIPMENT_H
Status information about equipment such as elevators or escalators.
Definition equipment.h:25
Type
Type of equipment.
Definition equipment.h:29
Query operations and data types for accessing realtime public transport information from online servi...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.