Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit bfd9c1fb authored by Volker Krause's avatar Volker Krause

Expand data model for seat reservations

parent b51b492c
......@@ -133,11 +133,26 @@ private:
QString arrivalTimeLocalized() const;
};
class Seat
{
SEMANTIC_GADGET
SEMANTIC_PROPERTY(QString, seatNumber)
SEMANTIC_PROPERTY(QString, seatRow)
SEMANTIC_PROPERTY(QString, seatSection)
};
class Ticket
{
SEMANTIC_GADGET
SEMANTIC_PROPERTY(QVariant, ticketedSeat)
};
class Reservation
{
Q_GADGET
SEMANTIC_PROPERTY(QString, reservationNumber)
SEMANTIC_PROPERTY(QVariant, reservationFor)
SEMANTIC_PROPERTY(QVariant, reservedTicket)
};
class LodgingReservation : protected Reservation
......@@ -171,6 +186,8 @@ Q_DECLARE_METATYPE(FlightReservation)
Q_DECLARE_METATYPE(LodgingBusiness)
Q_DECLARE_METATYPE(LodgingReservation)
Q_DECLARE_METATYPE(PostalAddress)
Q_DECLARE_METATYPE(Seat)
Q_DECLARE_METATYPE(Ticket)
Q_DECLARE_METATYPE(TrainStation)
Q_DECLARE_METATYPE(TrainTrip)
......
......@@ -59,8 +59,10 @@ function main(text) {
res.reservationFor.trainNumber = trainNumber[1];
var seatRes = legText.match(/VOITURE (\d+) - PLACE (\d+)/);
if (seatRes) {
// TODO seat reservation data model is missing
console.warn("coach:", seatRes[1], "seat:", seatRes[2]);
res.reservedTicket = JsonLd.newObject("Ticket");
res.reservedTicket.ticketedSeat = JsonLd.newObject("Seat");
res.reservedTicket.ticketedSeat.seatSection = seatRes[1];
res.reservedTicket.ticketedSeat.seatNumber = seatRes[2];
}
reservations.push(res);
......
......@@ -97,6 +97,8 @@ static QVariant createInstance(const QJsonObject &obj)
MAKE_FACTORY(LodgingBusiness);
MAKE_FACTORY(LodgingReservation);
MAKE_FACTORY(PostalAddress);
MAKE_FACTORY(Seat);
MAKE_FACTORY(Ticket);
MAKE_FACTORY(TrainStation);
MAKE_FACTORY(TrainTrip);
MAKE_FACTORY(TrainReservation);
......
......@@ -49,6 +49,8 @@ GRANTLEE_MAKE_GADGET(FlightReservation)
GRANTLEE_MAKE_GADGET(LodgingBusiness)
GRANTLEE_MAKE_GADGET(LodgingReservation)
GRANTLEE_MAKE_GADGET(PostalAddress)
GRANTLEE_MAKE_GADGET(Seat)
GRANTLEE_MAKE_GADGET(Ticket)
GRANTLEE_MAKE_GADGET(TrainStation)
GRANTLEE_MAKE_GADGET(TrainTrip)
GRANTLEE_MAKE_GADGET(TrainReservation)
......@@ -62,6 +64,8 @@ SemanticRenderer::SemanticRenderer()
Grantlee::registerMetaType<LodgingBusiness>();
Grantlee::registerMetaType<LodgingReservation>();
Grantlee::registerMetaType<PostalAddress>();
Grantlee::registerMetaType<Seat>();
Grantlee::registerMetaType<Ticket>();
Grantlee::registerMetaType<TrainStation>();
Grantlee::registerMetaType<TrainTrip>();
Grantlee::registerMetaType<TrainReservation>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment