diff options
author | Brendan Coles <bcoles@gmail.com> | 2021-02-24 15:40:36 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-24 20:40:00 +0100 |
commit | 0ffc06b795865314009c29b6930cab3603e7bcec (patch) | |
tree | ac05afef52f746eb9f4ce2d443d13f30a4319107 /Userland/DevTools | |
parent | 8f867df31aaa249e100ade75d314a4037a8dfb96 (diff) | |
download | serenity-0ffc06b795865314009c29b6930cab3603e7bcec.zip |
Profiler: Add help documentation
Diffstat (limited to 'Userland/DevTools')
-rw-r--r-- | Userland/DevTools/Profiler/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/DevTools/Profiler/main.cpp | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/Userland/DevTools/Profiler/CMakeLists.txt b/Userland/DevTools/Profiler/CMakeLists.txt index 1cb7b95140..ef0413de0a 100644 --- a/Userland/DevTools/Profiler/CMakeLists.txt +++ b/Userland/DevTools/Profiler/CMakeLists.txt @@ -7,4 +7,4 @@ set(SOURCES ) serenity_app(Profiler ICON app-profiler) -target_link_libraries(Profiler LibGUI LibX86 LibCoreDump) +target_link_libraries(Profiler LibGUI LibDesktop LibX86 LibCoreDump) diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp index 5f801936c0..4c5722200a 100644 --- a/Userland/DevTools/Profiler/main.cpp +++ b/Userland/DevTools/Profiler/main.cpp @@ -31,6 +31,7 @@ #include <LibCore/EventLoop.h> #include <LibCore/ProcessStatisticsReader.h> #include <LibCore/Timer.h> +#include <LibDesktop/Launcher.h> #include <LibGUI/Action.h> #include <LibGUI/Application.h> #include <LibGUI/BoxLayout.h> @@ -80,6 +81,15 @@ int main(int argc, char** argv) auto& profile = profile_or_error.value(); auto window = GUI::Window::construct(); + + if (!Desktop::Launcher::add_allowed_handler_with_only_specific_urls( + "/bin/Help", + { URL::create_with_file_protocol("/usr/share/man/man1/Profiler.md") }) + || !Desktop::Launcher::seal_allowlist()) { + warnln("Failed to set up allowed launch URLs"); + return 1; + } + window->set_title("Profiler"); window->set_icon(app_icon.bitmap_for_size(16)); window->resize(800, 600); @@ -144,6 +154,9 @@ int main(int argc, char** argv) view_menu.add_action(percent_action); auto& help_menu = menubar->add_menu("Help"); + help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) { + Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/Profiler.md"), "/bin/Help"); + })); help_menu.add_action(GUI::CommonActions::make_about_action("Profiler", app_icon, window)); app->set_menubar(move(menubar)); |