Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Itinerary
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
20
Issues
20
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PIM
Itinerary
Commits
b6805130
Commit
b6805130
authored
May 21, 2018
by
Volker Krause
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show tourist attraction visits in the timeline
parent
826b834d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
115 additions
and
5 deletions
+115
-5
src/app/CMakeLists.txt
src/app/CMakeLists.txt
+1
-0
src/app/TimelinePage.qml
src/app/TimelinePage.qml
+10
-0
src/app/TouristAttractionDelegate.qml
src/app/TouristAttractionDelegate.qml
+65
-0
src/app/qml.qrc
src/app/qml.qrc
+1
-0
src/app/timelinemodel.cpp
src/app/timelinemodel.cpp
+17
-5
src/app/timelinemodel.h
src/app/timelinemodel.h
+1
-0
tests/randa2017.json
tests/randa2017.json
+20
-0
No files found.
src/app/CMakeLists.txt
View file @
b6805130
...
...
@@ -72,6 +72,7 @@ qml_lint(
TicketTokenDelegate.qml
TimelineDelegate.qml
TimelinePage.qml
TouristAttractionDelegate.qml
TrainDelegate.qml
TrainPage.qml
)
...
...
src/app/TimelinePage.qml
View file @
b6805130
...
...
@@ -83,6 +83,15 @@ Kirigami.ScrollablePage {
rangeType
:
modelData
.
rangeType
}
}
Component
{
id
:
touristAttractionDelegate
App.TouristAttractionDelegate
{
reservation
:
modelData
.
reservation
passId
:
modelData
.
passId
pass
:
modelData
.
pass
rangeType
:
modelData
.
rangeType
}
}
Component
{
id
:
todayDelegate
Item
{
...
...
@@ -120,6 +129,7 @@ Kirigami.ScrollablePage {
case
TimelineModel
.
TrainTrip
:
return
trainDelegate
;
case
TimelineModel
.
BusTrip
:
return
busDelegate
;
case
TimelineModel
.
Restaurant
:
return
restaurantDelegate
;
case
TimelineModel
.
TouristAttraction
:
return
touristAttractionDelegate
;
case
TimelineModel
.
TodayMarker
:
return
todayDelegate
;
case
TimelineModel
.
CountryInfo
:
return
countryInfoDelegate
;
}
...
...
src/app/TouristAttractionDelegate.qml
0 → 100644
View file @
b6805130
/*
Copyright (C) 2018 Volker Krause <vkrause@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import
QtQuick
2.5
import
QtQuick
.
Layouts
1.1
import
QtQuick
.
Controls
2.1
as
QQC2
import
org
.
kde
.
kirigami
2.4
as
Kirigami
import
org
.
kde
.
itinerary
1.0
import
"
.
"
as
App
App.TimelineDelegate
{
id
:
root
header
:
Rectangle
{
id
:
headerBackground
Kirigami.Theme.colorSet
:
Kirigami
.
Theme
.
Complementary
Kirigami.Theme.inherit
:
false
color
:
Kirigami
.
Theme
.
backgroundColor
implicitHeight
:
headerLayout
.
implicitHeight
+
Kirigami
.
Units
.
largeSpacing
*
2
anchors.leftMargin
:
-
root
.
leftPadding
anchors.topMargin
:
-
root
.
topPadding
anchors.rightMargin
:
-
root
.
rightPadding
RowLayout
{
id
:
headerLayout
anchors.fill
:
parent
anchors.margins
:
Kirigami
.
Units
.
largeSpacing
QQC2.Label
{
text
:
qsTr
(
"
🎢 %1
"
).
arg
(
reservation
.
touristAttraction
.
name
)
color
:
Kirigami
.
Theme
.
textColor
font.pointSize
:
Kirigami
.
Theme
.
defaultFont
.
pointSize
*
root
.
headerFontScale
Layout.fillWidth
:
true
}
QQC2.Label
{
text
:
Localizer
.
formatTime
(
reservation
,
"
arrivalTime
"
)
color
:
Kirigami
.
Theme
.
textColor
font.pointSize
:
Kirigami
.
Theme
.
defaultFont
.
pointSize
*
root
.
headerFontScale
}
}
}
contentItem
:
ColumnLayout
{
id
:
topLayout
App.PlaceDelegate
{
place
:
reservation
.
touristAttraction
Layout.fillWidth
:
true
}
}
}
src/app/qml.qrc
View file @
b6805130
...
...
@@ -17,6 +17,7 @@
<file>TicketTokenDelegate.qml</file>
<file>TimelineDelegate.qml</file>
<file>TimelinePage.qml</file>
<file>TouristAttractionDelegate.qml</file>
<file>TrainDelegate.qml</file>
<file>TrainPage.qml</file>
</qresource>
...
...
src/app/timelinemodel.cpp
View file @
b6805130
...
...
@@ -27,6 +27,7 @@
#include <KItinerary/Organization>
#include <KItinerary/Reservation>
#include <KItinerary/TrainTrip>
#include <KItinerary/Visit>
#include <KPkPass/Pass>
...
...
@@ -47,7 +48,7 @@ static bool needsSplitting(const QVariant &res)
static
QDateTime
relevantDateTime
(
const
QVariant
&
res
,
TimelineModel
::
RangeType
range
)
{
if
(
res
.
userType
()
==
qMetaTypeId
<
FlightReservation
>
(
))
{
if
(
JsonLd
::
isA
<
FlightReservation
>
(
res
))
{
const
auto
flight
=
res
.
value
<
FlightReservation
>
().
reservationFor
().
value
<
Flight
>
();
if
(
flight
.
boardingTime
().
isValid
())
{
return
flight
.
boardingTime
();
...
...
@@ -56,13 +57,17 @@ static QDateTime relevantDateTime(const QVariant &res, TimelineModel::RangeType
return
flight
.
departureTime
();
}
return
QDateTime
(
flight
.
departureDay
(),
QTime
(
23
,
59
,
59
));
}
else
if
(
res
.
userType
()
==
qMetaTypeId
<
TrainReservation
>
())
{
}
if
(
JsonLd
::
isA
<
TrainReservation
>
(
res
))
{
return
res
.
value
<
TrainReservation
>
().
reservationFor
().
value
<
TrainTrip
>
().
departureTime
();
}
else
if
(
res
.
userType
()
==
qMetaTypeId
<
BusReservation
>
())
{
}
if
(
JsonLd
::
isA
<
BusReservation
>
(
res
))
{
return
res
.
value
<
BusReservation
>
().
reservationFor
().
value
<
BusTrip
>
().
departureTime
();
}
else
if
(
res
.
userType
()
==
qMetaTypeId
<
FoodEstablishmentReservation
>
())
{
}
if
(
JsonLd
::
isA
<
FoodEstablishmentReservation
>
(
res
))
{
return
res
.
value
<
FoodEstablishmentReservation
>
().
startTime
();
}
else
if
(
res
.
userType
()
==
qMetaTypeId
<
LodgingReservation
>
())
{
}
if
(
JsonLd
::
isA
<
LodgingReservation
>
(
res
))
{
const
auto
hotel
=
res
.
value
<
LodgingReservation
>
();
// hotel checkin/checkout is always considered the first/last thing of the day
if
(
range
==
TimelineModel
::
RangeEnd
)
{
...
...
@@ -71,6 +76,9 @@ static QDateTime relevantDateTime(const QVariant &res, TimelineModel::RangeType
return
QDateTime
(
hotel
.
checkinTime
().
date
(),
QTime
(
23
,
59
,
59
));
}
}
if
(
JsonLd
::
isA
<
TouristAttractionVisit
>
(
res
))
{
return
res
.
value
<
TouristAttractionVisit
>
().
arrivalTime
();
}
return
{};
}
...
...
@@ -92,6 +100,7 @@ static TimelineModel::ElementType elementType(const QVariant &res)
if
(
JsonLd
::
isA
<
TrainReservation
>
(
res
))
{
return
TimelineModel
::
TrainTrip
;
}
if
(
JsonLd
::
isA
<
BusReservation
>
(
res
))
{
return
TimelineModel
::
BusTrip
;
}
if
(
JsonLd
::
isA
<
FoodEstablishmentReservation
>
(
res
))
{
return
TimelineModel
::
Restaurant
;
}
if
(
JsonLd
::
isA
<
TouristAttractionVisit
>
(
res
))
{
return
TimelineModel
::
TouristAttraction
;
}
return
{};
}
...
...
@@ -112,6 +121,9 @@ static QString destinationCountry(const QVariant &res)
if
(
JsonLd
::
isA
<
FoodEstablishmentReservation
>
(
res
))
{
return
res
.
value
<
FoodEstablishmentReservation
>
().
reservationFor
().
value
<
FoodEstablishment
>
().
address
().
addressCountry
();
}
if
(
JsonLd
::
isA
<
TouristAttractionVisit
>
(
res
))
{
return
res
.
value
<
TouristAttractionVisit
>
().
touristAttraction
().
address
().
addressCountry
();
}
return
{};
}
...
...
src/app/timelinemodel.h
View file @
b6805130
...
...
@@ -50,6 +50,7 @@ public:
BusTrip
,
Hotel
,
Restaurant
,
TouristAttraction
,
TodayMarker
,
CountryInfo
};
...
...
tests/randa2017.json
View file @
b6805130
...
...
@@ -245,6 +245,26 @@
"departureTime"
:
"2017-09-13T14:00:00"
}
},
{
"@context"
:
"http://schema.org"
,
"@type"
:
"TouristAttractionVisit"
,
"arrivalTime"
:
"2017-09-13T14:30:00"
,
"departureTime"
:
"2017-09-13T15:30:00"
,
"touristAttraction"
:
{
"@type"
:
"TouristAttraction"
,
"name"
:
"Matterhorn"
,
"address"
:
{
"@type"
:
"PostalAddress"
,
"addressCountry"
:
"CH"
,
"addressLocality"
:
"Zermatt"
},
"geo"
:
{
"@type"
:
"GeoCoordinates"
,
"latitude"
:
46.01505
,
"longitude"
:
7.74224
}
}
},
{
"@context"
:
"http://schema.org"
,
"@type"
:
"FoodEstablishmentReservation"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment