FontEditor: Add help documentation

This commit is contained in:
Brendan Coles 2021-01-03 12:16:37 +00:00 committed by Andreas Kling
parent 3e8050f002
commit 35fe1b39a2
Notes: sideshowbarker 2024-07-19 00:10:19 +09:00
3 changed files with 39 additions and 2 deletions

View file

@ -8,4 +8,4 @@ set(SOURCES
)
serenity_app(FontEditor ICON app-font-editor)
target_link_libraries(FontEditor LibGUI LibGfx)
target_link_libraries(FontEditor LibGUI LibDesktop LibGfx)

View file

@ -25,7 +25,9 @@
*/
#include "FontEditor.h"
#include <AK/URL.h>
#include <LibCore/ArgsParser.h>
#include <LibDesktop/Launcher.h>
#include <LibGUI/AboutDialog.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
@ -43,13 +45,26 @@
int main(int argc, char** argv)
{
if (pledge("stdio shared_buffer thread rpath accept unix cpath wpath fattr", nullptr) < 0) {
if (pledge("stdio shared_buffer thread rpath accept unix cpath wpath fattr unix", nullptr) < 0) {
perror("pledge");
return 1;
}
auto app = GUI::Application::construct(argc, argv);
if (pledge("stdio shared_buffer thread rpath accept cpath wpath unix", nullptr) < 0) {
perror("pledge");
return 1;
}
if (!Desktop::Launcher::add_allowed_handler_with_only_specific_urls(
"/bin/Help",
{ URL::create_with_file_protocol("/usr/share/man/man1/FontEditor.md") })
|| !Desktop::Launcher::seal_allowlist()) {
warnln("Failed to set up allowed launch URLs");
return 1;
}
if (pledge("stdio shared_buffer thread rpath accept cpath wpath", nullptr) < 0) {
perror("pledge");
return 1;
@ -127,6 +142,9 @@ int main(int argc, char** argv)
}));
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/FontEditor.md"), "/bin/Help");
}));
help_menu.add_action(GUI::Action::create("About", [&](const GUI::Action&) {
GUI::AboutDialog::show("Font Editor", app_icon.bitmap_for_size(32), window);
}));

View file

@ -0,0 +1,19 @@
## Name
FontEditor - Serenity font editor
## Synopsis
```**sh
$ FontEditor [file]
```
## Description
FontEditor is a font editing application for Serenity.
## Examples
```sh
$ FontEditor /res/fonts/CsillaRegular10.font
```