Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
Itinerary
Commits
3ce9f7c9
Commit
3ce9f7c9
authored
May 13, 2018
by
Volker Krause
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add details page for train trips
parent
f949c9a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
242 additions
and
8 deletions
+242
-8
src/app/TicketTokenDelegate.qml
src/app/TicketTokenDelegate.qml
+64
-0
src/app/TrainDelegate.qml
src/app/TrainDelegate.qml
+12
-8
src/app/TrainPage.qml
src/app/TrainPage.qml
+164
-0
src/app/qml.qrc
src/app/qml.qrc
+2
-0
No files found.
src/app/TicketTokenDelegate.qml
0 → 100644
View file @
3ce9f7c9
/*
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.0
as
Kirigami
import
org
.
kde
.
prison
1.0
as
Prison
import
org
.
kde
.
kitinerary
1.0
import
org
.
kde
.
itinerary
1.0
import
"
.
"
as
App
Rectangle
{
id
:
root
property
var
ticket
implicitHeight
:
barcodeLayout
.
implicitHeight
implicitWidth
:
barcodeLayout
.
implicitWidth
color
:
"
white
"
Layout.alignment
:
Qt
.
AlignCenter
ColumnLayout
{
id
:
barcodeLayout
anchors.fill
:
parent
Prison.Barcode
{
id
:
barcode
Layout.alignment
:
Qt
.
AlignCenter
Layout.margins
:
4
barcodeType
:
{
console
.
log
(
root
.
ticket
.
ticketTokenType
,
Ticket
.
AztecCode
);
if
(
ticket
==
undefined
)
return
Prison
.
Barcode
.
Null
;
switch
(
ticket
.
ticketTokenType
)
{
case
Ticket
.
QRCode
:
return
Prison
.
Barcode
.
QRCode
;
case
Ticket
.
AztecCode
:
return
Prison
.
Barcode
.
Aztec
;
}
return
Prison
.
Barcode
.
Null
;
}
content
:
{
if
(
barcodeType
==
Prison
.
Barcode
.
Null
||
ticket
==
undefined
)
return
""
;
return
ticket
.
ticketTokenData
;
}
}
}
}
src/app/TrainDelegate.qml
View file @
3ce9f7c9
...
...
@@ -92,16 +92,20 @@ App.TimelineDelegate {
QQC2.Button
{
Layout.alignment
:
Qt
.
AlignHCenter
text
:
root
.
passId
!==
""
?
qsTr
(
"
Boarding Pass
"
)
:
qsTr
(
"
🎫 Ticket
"
)
onClicked
:
{
if
(
root
.
passId
!==
""
)
showBoardingPass
();
else
showTicket
();
}
visible
:
root
.
passId
!==
""
||
(
root
.
reservation
.
reservedTicket
!=
undefined
&&
root
.
reservation
.
reservedTicket
.
ticketToken
!=
""
)
text
:
qsTr
(
"
Boarding Pass
"
)
onClicked
:
showBoardingPass
();
visible
:
root
.
passId
!==
""
icon.source
:
root
.
passId
!==
""
?
"
image://org.kde.pkpass/
"
+
passId
+
"
/icon
"
:
""
}
}
Component
{
id
:
detailsComponent
App.TrainPage
{
reservation
:
root
.
reservation
}
}
onClicked
:
applicationWindow
().
pageStack
.
push
(
detailsComponent
);
}
src/app/TrainPage.qml
0 → 100644
View file @
3ce9f7c9
/*
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.0
as
Kirigami
import
org
.
kde
.
kitinerary
1.0
import
org
.
kde
.
itinerary
1.0
import
"
.
"
as
App
App.DetailsPage
{
id
:
root
title
:
qsTr
(
"
Train Ticket
"
)
GridLayout
{
id
:
grid
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
columns
:
2
QQC2.Label
{
Layout.columnSpan
:
2
Layout.fillWidth
:
true
text
:
reservation
.
reservationFor
.
trainName
+
"
"
+
reservation
.
reservationFor
.
trainNumber
horizontalAlignment
:
Qt
.
AlignHCenter
font.bold
:
true
}
// ticket barcode
App.TicketTokenDelegate
{
Layout.columnSpan
:
2
ticket
:
reservation
.
reservedTicket
}
// departure data
QQC2.Label
{
Layout.columnSpan
:
2
Layout.fillWidth
:
true
text
:
qsTr
(
"
Departure
"
)
horizontalAlignment
:
Qt
.
AlignHCenter
}
QQC2.Label
{
text
:
qsTr
(
"
Departure time:
"
)
}
QQC2.Label
{
text
:
Localizer
.
formatDateTime
(
reservation
.
reservationFor
,
"
departureTime
"
)
}
QQC2.Label
{
text
:
reservation
.
reservationFor
.
departureStation
.
name
Layout.columnSpan
:
2
}
App.PlaceDelegate
{
Layout.columnSpan
:
2
Layout.fillWidth
:
true
place
:
reservation
.
reservationFor
.
departureStation
}
QQC2.Label
{
text
:
qsTr
(
"
Departure platform:
"
)
}
QQC2.Label
{
text
:
reservation
.
reservationFor
.
departurePlatform
}
Kirigami.Separator
{
Layout.columnSpan
:
2
Layout.fillWidth
:
true
}
// arrival data
QQC2.Label
{
Layout.columnSpan
:
2
Layout.fillWidth
:
true
text
:
qsTr
(
"
Arrival
"
)
horizontalAlignment
:
Qt
.
AlignHCenter
}
QQC2.Label
{
text
:
qsTr
(
"
Arrival time:
"
)
}
QQC2.Label
{
text
:
Localizer
.
formatDateTime
(
reservation
.
reservationFor
,
"
arrivalTime
"
)
}
QQC2.Label
{
text
:
reservation
.
reservationFor
.
arrivalStation
.
name
Layout.columnSpan
:
2
}
App.PlaceDelegate
{
Layout.columnSpan
:
2
Layout.fillWidth
:
true
place
:
reservation
.
reservationFor
.
arrivalStation
}
QQC2.Label
{
text
:
qsTr
(
"
Arrival platform:
"
)
}
QQC2.Label
{
text
:
reservation
.
reservationFor
.
arrivalPlatform
}
Kirigami.Separator
{
Layout.columnSpan
:
2
Layout.fillWidth
:
true
}
// seat reservation
QQC2.Label
{
Layout.columnSpan
:
2
Layout.fillWidth
:
true
text
:
qsTr
(
"
Seat
"
)
horizontalAlignment
:
Qt
.
AlignHCenter
}
QQC2.Label
{
text
:
qsTr
(
"
Coach:
"
)
}
QQC2.Label
{
text
:
reservation
.
reservedTicket
.
ticketedSeat
.
seatSection
}
QQC2.Label
{
text
:
qsTr
(
"
Seat:
"
)
}
QQC2.Label
{
text
:
reservation
.
reservedTicket
.
ticketedSeat
.
seatNumber
}
// booking details
Kirigami.Separator
{
Layout.columnSpan
:
2
Layout.fillWidth
:
true
}
QQC2.Label
{
Layout.columnSpan
:
2
Layout.fillWidth
:
true
text
:
qsTr
(
"
Booking
"
)
horizontalAlignment
:
Qt
.
AlignHCenter
}
QQC2.Label
{
text
:
qsTr
(
"
Booking reference:
"
)
}
QQC2.Label
{
text
:
reservation
.
reservationNumber
}
QQC2.Label
{
text
:
qsTr
(
"
Under name:
"
)
}
QQC2.Label
{
text
:
reservation
.
underName
.
name
}
}
}
src/app/qml.qrc
View file @
3ce9f7c9
...
...
@@ -11,8 +11,10 @@
<file>PlaceDelegate.qml</file>
<file>RestaurantDelegate.qml</file>
<file>TicketPage.qml</file>
<file>TicketTokenDelegate.qml</file>
<file>TimelineDelegate.qml</file>
<file>TimelinePage.qml</file>
<file>TrainDelegate.qml</file>
<file>TrainPage.qml</file>
</qresource>
</RCC>
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