mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
FontEditor: Add help documentation
This commit is contained in:
parent
3e8050f002
commit
35fe1b39a2
Notes:
sideshowbarker
2024-07-19 00:10:19 +09:00
Author: https://github.com/bcoles Commit: https://github.com/SerenityOS/serenity/commit/35fe1b39a2f Pull-request: https://github.com/SerenityOS/serenity/pull/4766
3 changed files with 39 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}));
|
||||
|
|
19
Base/usr/share/man/man1/FontEditor.md
Normal file
19
Base/usr/share/man/man1/FontEditor.md
Normal 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
|
||||
```
|
Loading…
Add table
Reference in a new issue