View | Details | Raw Unified | Return to bug 60555
Collapse All | Expand All

(-)file_not_specified_in_diff (-8 / +73 lines)
Line  Link Here
0
-- a/components/timezoneselector/GeoJsonDelegate.qml
0
++ b/components/timezoneselector/GeoJsonDelegate.qml
Lines 68-74 Link Here
68
68
69
            property bool thisItemSelected: root.selectedTimeZone == modelData?.properties?.tzid
69
            property bool thisItemSelected: root.selectedTimeZone == modelData?.properties?.tzid
70
            onThisItemSelectedChanged: {
70
            onThisItemSelectedChanged: {
71
                if (!thisItemSelected) return;
71
                if (!thisItemSelected || root.selectingZoneOnMap) return;
72
                view.animateCenterTo(delegateChooser.centerOf(rect))
72
                view.animateCenterTo(delegateChooser.centerOf(rect))
73
                delegateChooser.animateZoomLevel(delegateChooser.suggestedZoomOf(rect))
73
                delegateChooser.animateZoomLevel(delegateChooser.suggestedZoomOf(rect))
74
            }
74
            }
Lines 77-83 Link Here
77
            property bool tzidselected: root.selectedTimeZone == tzid
77
            property bool tzidselected: root.selectedTimeZone == tzid
78
78
79
            geoShape: modelData.data
79
            geoShape: modelData.data
80
            opacity: tzidselected ? selectedOpacity : (tzidhover ? delegateChooser.hoveredOpacity : delegateChooser.defaultOpacity)
80
            opacity: 0
81
            color: delegateChooser.defaultColor
81
            color: delegateChooser.defaultColor
82
            border {
82
            border {
83
                width: 2
83
                width: 2
Lines 88-98 Link Here
88
88
89
            TapHandler {
89
            TapHandler {
90
                onTapped: {
90
                onTapped: {
91
                    const mapPosition = view.map.mapFromItem(mapPolygon, point.position)
92
                    root.selectedMapMarker = {timeZone: tzid, coordinate: view.map.toCoordinate(mapPosition)}
93
                    root.selectingZoneOnMap = true
91
                    root.selectedTimeZone = tzid
94
                    root.selectedTimeZone = tzid
95
                    root.selectingZoneOnMap = false
92
                }
96
                }
93
            }
97
            }
94
98
95
            HoverHandler {
99
            HoverHandler {
100
                cursorShape: Qt.PointingHandCursor
96
                enabled: !!tzid
101
                enabled: !!tzid
97
                onHoveredChanged: {
102
                onHoveredChanged: {
98
                    if (hovered) {
103
                    if (hovered) {
Lines 130-136 Link Here
130
135
131
            property bool thisItemSelected: root.selectedTimeZone === tzid
136
            property bool thisItemSelected: root.selectedTimeZone === tzid
132
            onThisItemSelectedChanged: {
137
            onThisItemSelectedChanged: {
133
                if (!thisItemSelected) return;
138
                if (!thisItemSelected || root.selectingZoneOnMap) return;
134
                view.animateCenterTo(delegateChooser.centerOf(rect))
139
                view.animateCenterTo(delegateChooser.centerOf(rect))
135
                delegateChooser.animateZoomLevel(delegateChooser.suggestedZoomOf(rect))
140
                delegateChooser.animateZoomLevel(delegateChooser.suggestedZoomOf(rect))
136
            }
141
            }
Lines 140-146 Link Here
140
    DelegateChoice {
145
    DelegateChoice {
141
        roleValue: "FeatureCollection"
146
        roleValue: "FeatureCollection"
142
        delegate: MapItemView {
147
        delegate: MapItemView {
143
            model: modelData.data
148
            model: modelData.data.filter(feature => !root.excludedTimeZones.includes(feature?.properties?.tzid))
144
            delegate: delegateChooser
149
            delegate: delegateChooser
145
        }
150
        }
146
    }
151
    }
147
-- a/components/timezoneselector/TimezoneSelector.qml
152
++ b/components/timezoneselector/TimezoneSelector.qml
Lines 24-29 Link Here
24
Item {
24
Item {
25
    id: root
25
    id: root
26
26
27
    component TimezoneMarker: MapQuickItem {
28
        id: marker
29
        property string timezoneName
30
        autoFadeIn: false
31
        anchorPoint: Qt.point(sourceItem.width / 2, sourceItem.height)
32
33
        sourceItem: Column {
34
            enabled: false
35
            spacing: Kirigami.Units.smallSpacing / 2
36
37
            QQC2.Label {
38
                text: marker.timezoneName
39
                color: "white"
40
                font.bold: true
41
                padding: Kirigami.Units.smallSpacing
42
43
                background: Rectangle {
44
                    color: "#202124"
45
                    radius: Kirigami.Units.smallSpacing
46
                }
47
            }
48
49
            Rectangle {
50
                anchors.horizontalCenter: parent.horizontalCenter
51
                width: Kirigami.Units.iconSizes.small
52
                height: width
53
                radius: width / 2
54
                color: Kirigami.Theme.highlightColor
55
                border.color: Kirigami.Theme.textColor
56
                border.width: 2
57
            }
58
        }
59
    }
60
61
    property var selectedMapMarker: ({coordinate: QtPositioning.coordinate()})
62
    property bool selectingZoneOnMap: false
63
27
    implicitHeight: Kirigami.Settings.isMobile ? mobileFormCard.implicitHeight : 0
64
    implicitHeight: Kirigami.Settings.isMobile ? mobileFormCard.implicitHeight : 0
28
65
29
//BEGIN properties
66
//BEGIN properties
Lines 45-51 Link Here
45
    property string hoveredTimeZone: ""
82
    property string hoveredTimeZone: ""
46
//END properties
83
//END properties
47
84
48
    property var availableMapTimeZones: geoDatabase.model[0].data.map(zone => zone?.properties?.tzid)
85
    readonly property var excludedTimeZones: [
86
        "Europe/Simferopol"
87
    ]
88
    property var availableMapTimeZones: geoDatabase.model[0].data
89
            .map(zone => zone?.properties?.tzid).filter(tzid => !root.excludedTimeZones.includes(tzid))
49
90
50
    GeoJsonData {
91
    GeoJsonData {
51
        id: geoDatabase
92
        id: geoDatabase
Lines 62-68 Link Here
62
101
63
        availableTimeZones.forEach(str => {
102
        availableTimeZones.forEach(str => {
64
            let tzid = String(str)
103
            let tzid = String(str)
65
            if (tzid.includes('/')) {
104
            if (tzid.includes('/') && !root.excludedTimeZones.includes(tzid)) {
66
105
67
                let [prefix, suffix] = root.split(tzid)
106
                let [prefix, suffix] = root.split(tzid)
68
107
Lines 193-198 Link Here
193
            running: false
232
            running: false
194
        }
233
        }
195
        function animateCenterTo(coordinate) {
234
        function animateCenterTo(coordinate) {
235
            root.selectedMapMarker = {timeZone: root.selectedTimeZone, coordinate}
196
            coordAnimation.to = coordinate
236
            coordAnimation.to = coordinate
197
            coordAnimation.running = true
237
            coordAnimation.running = true
198
        }
238
        }
Lines 233-238 Link Here
233
            delegate: GeoJsonDelegate {}
273
            delegate: GeoJsonDelegate {}
234
        }
274
        }
235
275
276
        HoverHandler {
277
            id: mapHoverHandler
278
        }
279
280
        TimezoneMarker {
281
            parent: view.map
282
            visible: !!root.hoveredTimeZone && mapHoverHandler.hovered && root.hoveredTimeZone !== root.selectedTimeZone
283
            coordinate: view.map.toCoordinate(view.map.mapFromItem(view, mapHoverHandler.point.position))
284
            timezoneName: root.understandable(root.hoveredTimeZone)
285
        }
286
287
        TimezoneMarker {
288
            parent: view.map
289
            visible: root.selectedMapMarker.timeZone === root.selectedTimeZone
290
            coordinate: root.selectedMapMarker.coordinate
291
            timezoneName: root.understandable(root.selectedTimeZone)
292
        }
293
236
        RowLayout {
294
        RowLayout {
237
            spacing: Kirigami.Units.smallSpacing
295
            spacing: Kirigami.Units.smallSpacing
238
            anchors {
296
            anchors {

Return to bug 60555