From ddff93dee672a3e78259a96f086017ff7b4fea75 Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Sat, 7 Jan 2023 02:49:45 +0000 Subject: add borders to waypoints and make them clickable --- CMakeLists.txt | 1 + src/MainMapView.qml | 6 +++++- src/MapWaypoint.qml | 13 ++++++++++--- waypoint.svg | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 waypoint.svg diff --git a/CMakeLists.txt b/CMakeLists.txt index dc8cba6..e2f3c5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,5 +21,6 @@ add_subdirectory(src) build_translations(i18n) generate_desktop(${CMAKE_SOURCE_DIR} asteroid-map) +install(FILES waypoint.svg DESTINATION /usr/share/icons/asteroid/) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/MainMapView.qml b/src/MainMapView.qml index 00f0ef2..3254611 100644 --- a/src/MainMapView.qml +++ b/src/MainMapView.qml @@ -30,7 +30,10 @@ Item { id: waypointSource key: "/map/waypointList" defaultValue: "" - onValueChanged: mapView.updateWaypoints() + onValueChanged: { + mapView.updateWaypoints() + console.log("value changed") + } Component.onCompleted: mapView.updateWaypoints() } @@ -66,6 +69,7 @@ Item { } property MapQuickItem mapItem function updateWaypoints() { + console.log("waypoints updated") var waypointsList = waypointSource.value.split(">") for(var i = 0, size = waypointsList.length-1; i < size ; i++){ var currWaypointData = waypointsList[i].split(";") diff --git a/src/MapWaypoint.qml b/src/MapWaypoint.qml index 1300cb0..3a56dcc 100644 --- a/src/MapWaypoint.qml +++ b/src/MapWaypoint.qml @@ -11,10 +11,17 @@ MapQuickItem { autoFadeIn: false property string iconName property color iconColor - sourceItem: Asteroid.Icon { + sourceItem: Asteroid.IconButton { width: Asteroid.Dims.w(12) + iconName: "waypoint" height: width - name: root.iconName - color: root.iconColor + iconColor: root.iconColor.hsvValue < 0.5 ? "white" : "black" + Asteroid.Icon { + anchors.centerIn: parent + width: parent.width*0.9 + height: width + name: root.iconName + color: root.iconColor + } } } diff --git a/waypoint.svg b/waypoint.svg new file mode 100644 index 0000000..bc6195e --- /dev/null +++ b/waypoint.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + -- cgit v1.2.3-70-g09d2