From f35791343e933b87071de935de45b10a730a61c9 Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Wed, 27 Sep 2023 22:03:54 +0200 Subject: [PATCH] Maps: Use name + coordinates in search marker tooltip --- Userland/Applications/Maps/SearchPanel.cpp | 4 ++-- Userland/Applications/Maps/SearchPanel.gml | 2 +- Userland/Applications/Maps/SearchPanel.h | 2 +- Userland/Applications/MapsSettings/main.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Userland/Applications/Maps/SearchPanel.cpp b/Userland/Applications/Maps/SearchPanel.cpp index 338f5a7718..881ebbe799 100644 --- a/Userland/Applications/Maps/SearchPanel.cpp +++ b/Userland/Applications/Maps/SearchPanel.cpp @@ -96,9 +96,9 @@ void SearchPanel::search(StringView query) // FIXME: Handle JSON parsing errors auto const& json_place = json_places.at(i).as_object(); - String name = MUST(String::from_deprecated_string(json_place.get_deprecated_string("display_name"sv).release_value())); MapWidget::LatLng latlng = { json_place.get_deprecated_string("lat"sv).release_value().to_double().release_value(), json_place.get_deprecated_string("lon"sv).release_value().to_double().release_value() }; + String name = MUST(String::formatted("{}\n{:.5}, {:.5}", json_place.get_deprecated_string("display_name"sv).release_value(), latlng.latitude, latlng.longitude)); // Calculate the right zoom level for bounding box auto const& json_boundingbox = json_place.get_array("boundingbox"sv); @@ -110,7 +110,7 @@ void SearchPanel::search(StringView query) }; m_places.append({ name, latlng, bounds.get_zoom() }); - m_places_names.append(MUST(String::formatted("{}\n{:.5}, {:.5}", name, latlng.latitude, latlng.longitude))); + m_places_names.append(name); } on_places_change(m_places); diff --git a/Userland/Applications/Maps/SearchPanel.gml b/Userland/Applications/Maps/SearchPanel.gml index bb6b047189..04744c59e0 100644 --- a/Userland/Applications/Maps/SearchPanel.gml +++ b/Userland/Applications/Maps/SearchPanel.gml @@ -26,7 +26,7 @@ } } - // Start, empty and places are toggled in visibility + // Start, empty and places are toggled in visibility @GUI::Frame { name: "start_container" frame_style: "SunkenPanel" diff --git a/Userland/Applications/Maps/SearchPanel.h b/Userland/Applications/Maps/SearchPanel.h index 1d33d8af05..1e9337f007 100644 --- a/Userland/Applications/Maps/SearchPanel.h +++ b/Userland/Applications/Maps/SearchPanel.h @@ -36,6 +36,7 @@ public: private: SearchPanel() = default; + static ErrorOr> try_create(); ErrorOr setup(); @@ -47,7 +48,6 @@ private: RefPtr m_start_container; RefPtr m_empty_container; RefPtr m_places_list; - RefPtr> m_places_names_model; Vector m_places; Vector m_places_names; }; diff --git a/Userland/Applications/MapsSettings/main.cpp b/Userland/Applications/MapsSettings/main.cpp index 23e36c1911..1fd1aeebaf 100644 --- a/Userland/Applications/MapsSettings/main.cpp +++ b/Userland/Applications/MapsSettings/main.cpp @@ -18,8 +18,8 @@ ErrorOr serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::create(arguments)); - TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil("/home", "r")); + TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil("/tmp/session/%sid/portal/config", "rw")); TRY(Core::System::unveil(nullptr, nullptr));