KOSMIndoorMap

RoutingProfileSheet.qml
1/*
2 SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6import QtQuick
7import QtQuick.Layouts
8import QtQuick.Controls as QQC2
9import org.kde.kirigami as Kirigami
10import org.kde.kosmindoorrouting
11
12Kirigami.Dialog {
13 id: root
14
15 property routingProfile routingProfile
16 signal applyRoutingProfile()
17
18 title: i18n("Configure Routing Profile")
19
20 contentItem: Kirigami.FormLayout {
21 Layout.preferredWidth: Kirigami.Units.gridUnit * 25
23 Kirigami.FormData.isSection: true
24 Kirigami.FormData.label: "Flags"
25 }
26
27 QQC2.CheckBox {
28 id: stairFlag
29 Kirigami.FormData.label: i18n("Use stairs")
30 }
31 QQC2.CheckBox {
32 id: escalatorFlag
33 Kirigami.FormData.label: i18n("Use escalators")
34 }
35 QQC2.CheckBox {
36 id: elevatorFlag
37 Kirigami.FormData.label: i18n("Use elevators")
38 }
39
41 Kirigami.FormData.isSection: true
42 Kirigami.FormData.label: "Cost factors"
43 }
44
45 QQC2.TextField {
46 id: stairCost
47 Kirigami.FormData.label: i18n("Stairs")
48 }
49 QQC2.TextField {
50 id: elevatorCost
51 Kirigami.FormData.label: i18n("Elevator")
52 }
53 QQC2.TextField {
54 id: escalatorCost
55 Kirigami.FormData.label: i18n("Escalator")
56 }
57 QQC2.TextField {
58 id: movingWalkwayCost
59 Kirigami.FormData.label: i18n("Moving Walkways")
60 }
61 QQC2.TextField {
62 id: tactilePavingCost
63 Kirigami.FormData.label: i18n("Tactile Paving")
64 }
65 QQC2.TextField {
66 id: streetCrossingCost
67 Kirigami.FormData.label: i18n("Street Crossing")
68 }
69 QQC2.TextField {
70 id: rampCost
71 Kirigami.FormData.label: i18n("Ramp")
72 }
73 QQC2.TextField {
74 id: roomCost
75 Kirigami.FormData.label: i18n("Room")
76 }
77 QQC2.TextField {
78 id: walkingCost
79 Kirigami.FormData.label: i18n("Walking")
80 }
81 }
82
83 onOpened: {
84 stairFlag.checked = root.routingProfile.flags & AreaFlag.Stairs;
85 escalatorFlag.checked = root.routingProfile.flags & AreaFlag.Escalator;
86 elevatorFlag.checked = root.routingProfile.flags & AreaFlag.Elevator;
87
88 stairCost.text = root.routingProfile.cost(AreaType.Stairs);
89 elevatorCost.text = root.routingProfile.cost(AreaType.Elevator);
90 escalatorCost.text = root.routingProfile.cost(AreaType.Escalator);
91 movingWalkwayCost.text = root.routingProfile.cost(AreaType.MovingWalkway);
92 tactilePavingCost.text = root.routingProfile.cost(AreaType.TactilePaving);
93 streetCrossingCost.text = root.routingProfile.cost(AreaType.StreetCrossing);
94 rampCost.text = root.routingProfile.cost(AreaType.Ramp);
95 roomCost.text = root.routingProfile.cost(AreaType.Room);
96 walkingCost.text = root.routingProfile.cost(AreaType.Walkable);
97 }
98
99 customFooterActions: [
100 Kirigami.Action {
101 text: i18n("Apply")
102 icon.name: "dialog-ok-apply"
103 onTriggered: {
104 let flags = AreaFlag.Walkable;
105 if (stairFlag.checked)
106 flags |= AreaFlag.Stairs;
107 if (escalatorFlag.checked)
108 flags |= AreaFlag.Escalator;
109 if (elevatorFlag.checked)
110 flags |= AreaFlag.Elevator;
111 root.routingProfile.flags = flags;
112
113 root.routingProfile.setCost(AreaType.Stairs, stairCost.text);
114 root.routingProfile.setCost(AreaType.Elevator, elevatorCost.text);
115 root.routingProfile.setCost(AreaType.Escalator, escalatorCost.text);
116 root.routingProfile.setCost(AreaType.MovingWalkway, movingWalkwayCost.text);
117 root.routingProfile.setCost(AreaType.TactilePaving, tactilePavingCost.text);
118 root.routingProfile.setCost(AreaType.StreetCrossing, streetCrossingCost.text);
119 root.routingProfile.setCost(AreaType.Ramp, rampCost.text);
120 root.routingProfile.setCost(AreaType.Room, roomCost.text);
121 root.routingProfile.setCost(AreaType.Walkable, walkingCost.text);
122
123 root.close()
124 root.applyRoutingProfile()
125 }
126 }
127 ]
128}
QString i18n(const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.