Skip to content

Commit a0e6605

Browse files
committed
FileManager: Add GPS location MapWidget to properties window
1 parent 91de379 commit a0e6605

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

Userland/Applications/FileManager/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ set(GENERATED_SOURCES
3535
)
3636

3737
serenity_app(FileManager ICON app-file-manager)
38-
target_link_libraries(FileManager PRIVATE LibArchive LibAudio LibConfig LibCore LibDesktop LibFileSystem LibGfx LibGUI LibMain LibPDF LibThreading LibURL)
38+
target_link_libraries(FileManager PRIVATE LibArchive LibAudio LibConfig LibCore LibDesktop LibFileSystem LibGfx LibGUI LibMain LibMaps LibPDF LibThreading LibURL)

Userland/Applications/FileManager/PropertiesWindow.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <LibGfx/Font/WOFF/Font.h>
4242
#include <LibGfx/ICC/Profile.h>
4343
#include <LibGfx/ICC/Tags.h>
44+
#include <LibMaps/MapWidget.h>
4445
#include <LibPDF/Document.h>
4546
#include <grp.h>
4647
#include <pwd.h>
@@ -475,6 +476,20 @@ ErrorOr<void> PropertiesWindow::create_image_tab(GUI::TabWidget& tab_widget, Non
475476
}
476477
}
477478

479+
if (auto const& gps = image_decoder->gps(); gps.has_value()) {
480+
auto& gps_container = *tab.find_descendant_of_type_named<GUI::GroupBox>("image_gps");
481+
gps_container.set_visible(true);
482+
483+
Maps::MapWidget::Options options {};
484+
options.center.latitude = gps->latitude;
485+
options.center.longitude = gps->longitude;
486+
options.zoom = 14;
487+
auto& map_widget = gps_container.add<Maps::MapWidget>(options);
488+
map_widget.add_marker(Maps::MapWidget::Marker {
489+
.latlng = { gps->latitude, gps->longitude },
490+
});
491+
}
492+
478493
return {};
479494
}
480495

Userland/Applications/FileManager/PropertiesWindowImageTab.gml

+10
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,14 @@
180180
spacing: 2
181181
}
182182
}
183+
184+
@GUI::GroupBox {
185+
name: "image_gps"
186+
title: "GPS Location"
187+
preferred_height: 200
188+
visible: false
189+
layout: @GUI::VerticalBoxLayout {
190+
margins: [8]
191+
}
192+
}
183193
}

Userland/Applications/FileManager/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
9393

9494
TRY(Core::System::pledge("stdio thread recvfd sendfd cpath rpath wpath fattr proc exec unix"));
9595

96-
Config::pledge_domains({ "FileManager", "WindowManager" });
96+
Config::pledge_domains({ "FileManager", "WindowManager", "Maps" });
9797
Config::monitor_domain("FileManager");
9898
Config::monitor_domain("WindowManager");
9999

0 commit comments

Comments
 (0)