mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 09:21:57 -05:00
FileManager: Add GPS location MapWidget to image properties window
This commit is contained in:
parent
6fa29085e5
commit
a24fb249ec
4 changed files with 32 additions and 2 deletions
|
@ -35,4 +35,4 @@ set(GENERATED_SOURCES
|
|||
)
|
||||
|
||||
serenity_app(FileManager ICON app-file-manager)
|
||||
target_link_libraries(FileManager PRIVATE LibArchive LibAudio LibConfig LibCore LibDesktop LibFileSystem LibGfx LibGUI LibMain LibPDF LibThreading LibURL)
|
||||
target_link_libraries(FileManager PRIVATE LibArchive LibAudio LibConfig LibCore LibDesktop LibFileSystem LibGfx LibGUI LibMain LibMaps LibPDF LibThreading LibURL)
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
#include <LibGfx/Font/WOFF/Font.h>
|
||||
#include <LibGfx/ICC/Profile.h>
|
||||
#include <LibGfx/ICC/Tags.h>
|
||||
#include <LibGfx/ImageFormats/ExifGPS.h>
|
||||
#include <LibGfx/ImageFormats/TIFFMetadata.h>
|
||||
#include <LibMaps/MapWidget.h>
|
||||
#include <LibPDF/Document.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
|
@ -475,6 +478,23 @@ ErrorOr<void> PropertiesWindow::create_image_tab(GUI::TabWidget& tab_widget, Non
|
|||
}
|
||||
}
|
||||
|
||||
if (auto const& metadata = image_decoder->metadata(); metadata.has_value() && is<Gfx::ExifMetadata>(*metadata)) {
|
||||
auto const& exif_metadata = static_cast<Gfx::ExifMetadata const&>(*metadata);
|
||||
if (auto gps = Gfx::ExifGPS::from_exif_metadata(exif_metadata); gps.has_value()) {
|
||||
auto& gps_container = *tab.find_descendant_of_type_named<GUI::GroupBox>("image_gps");
|
||||
gps_container.set_visible(true);
|
||||
|
||||
Maps::MapWidget::Options options {};
|
||||
options.center.latitude = gps->latitude();
|
||||
options.center.longitude = gps->longitude();
|
||||
options.zoom = 14;
|
||||
auto& map_widget = gps_container.add<Maps::MapWidget>(options);
|
||||
map_widget.add_marker(Maps::MapWidget::Marker {
|
||||
.latlng = { gps->latitude(), gps->longitude() },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -180,4 +180,14 @@
|
|||
spacing: 2
|
||||
}
|
||||
}
|
||||
|
||||
@GUI::GroupBox {
|
||||
name: "image_gps"
|
||||
title: "GPS Location"
|
||||
preferred_height: 200
|
||||
visible: false
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [8]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd cpath rpath wpath fattr proc exec unix"));
|
||||
|
||||
Config::pledge_domains({ "FileManager", "WindowManager" });
|
||||
Config::pledge_domains({ "FileManager", "WindowManager", "Maps" });
|
||||
Config::monitor_domain("FileManager");
|
||||
Config::monitor_domain("WindowManager");
|
||||
|
||||
|
|
Loading…
Reference in a new issue