mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:27:43 +00:00
Maps: Use name + coordinates in search marker tooltip
This commit is contained in:
parent
54ec744398
commit
f35791343e
4 changed files with 5 additions and 5 deletions
|
@ -96,9 +96,9 @@ void SearchPanel::search(StringView query)
|
||||||
// FIXME: Handle JSON parsing errors
|
// FIXME: Handle JSON parsing errors
|
||||||
auto const& json_place = json_places.at(i).as_object();
|
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(),
|
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() };
|
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
|
// Calculate the right zoom level for bounding box
|
||||||
auto const& json_boundingbox = json_place.get_array("boundingbox"sv);
|
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.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);
|
on_places_change(m_places);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start, empty and places are toggled in visibility
|
// Start, empty and places are toggled in visibility
|
||||||
@GUI::Frame {
|
@GUI::Frame {
|
||||||
name: "start_container"
|
name: "start_container"
|
||||||
frame_style: "SunkenPanel"
|
frame_style: "SunkenPanel"
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SearchPanel() = default;
|
SearchPanel() = default;
|
||||||
|
|
||||||
static ErrorOr<NonnullRefPtr<SearchPanel>> try_create();
|
static ErrorOr<NonnullRefPtr<SearchPanel>> try_create();
|
||||||
|
|
||||||
ErrorOr<void> setup();
|
ErrorOr<void> setup();
|
||||||
|
@ -47,7 +48,6 @@ private:
|
||||||
RefPtr<GUI::Frame> m_start_container;
|
RefPtr<GUI::Frame> m_start_container;
|
||||||
RefPtr<GUI::Frame> m_empty_container;
|
RefPtr<GUI::Frame> m_empty_container;
|
||||||
RefPtr<GUI::ListView> m_places_list;
|
RefPtr<GUI::ListView> m_places_list;
|
||||||
RefPtr<GUI::ItemListModel<String>> m_places_names_model;
|
|
||||||
Vector<Place> m_places;
|
Vector<Place> m_places;
|
||||||
Vector<String> m_places_names;
|
Vector<String> m_places_names;
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,8 +18,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
auto app = TRY(GUI::Application::create(arguments));
|
auto app = TRY(GUI::Application::create(arguments));
|
||||||
|
|
||||||
TRY(Core::System::unveil("/res", "r"));
|
|
||||||
TRY(Core::System::unveil("/home", "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("/tmp/session/%sid/portal/config", "rw"));
|
||||||
TRY(Core::System::unveil(nullptr, nullptr));
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue