Playground: Add help documentation

This commit is contained in:
Brendan Coles 2021-01-04 06:52:57 +00:00 committed by Andreas Kling
parent 1e4b9a9cd9
commit 1f03b6ad57
Notes: sideshowbarker 2024-07-19 00:07:30 +09:00
4 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,28 @@
## Name
Playground - GUI Markup Language (GML) editor
## Synopsis
```**sh
$ Playground
```
## Description
Playground facilitates development of graphical user interfaces (GUI)
for Serenity applications using GUI Markup Language (GML) to compose
a layout for GUI widgets and set widget attributes.
The specified widgets are automatically rendered in a live preview
window, allowing rapid prototyping and development of application GUIs.
## Examples
```sh
$ Playground
```
## See also
* [`gml-format`(1)](../man1/gml-format.md) For automated GML formatting

View File

@ -0,0 +1,23 @@
## Name
gml-format - automated GUI Markup Language (GML) formatter
## Synopsis
```**sh
$ gml-format [--inplace] [path...]
```
## Description
`gml-format` formats GUI Markup Language (GML) files.
## Options
* `-i`, `--inplace`: Write formatted contents back to file rather than standard output
## Examples
```sh
$ gml-format -i /home/anon/example.gml
```

View File

@ -3,4 +3,4 @@ set(SOURCES
)
serenity_app(Playground ICON app-playground)
target_link_libraries(Playground LibGUI)
target_link_libraries(Playground LibDesktop LibGUI)

View File

@ -25,8 +25,10 @@
*/
#include <AK/QuickSort.h>
#include <AK/URL.h>
#include <LibCore/File.h>
#include <LibCore/Property.h>
#include <LibDesktop/Launcher.h>
#include <LibGUI/AboutDialog.h>
#include <LibGUI/Application.h>
#include <LibGUI/AutocompleteProvider.h>
@ -231,6 +233,19 @@ int main(int argc, char** argv)
auto app = GUI::Application::construct(argc, argv);
if (pledge("stdio thread shared_buffer accept rpath 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/Playground.md") })
|| !Desktop::Launcher::seal_allowlist()) {
warnln("Failed to set up allowed launch URLs");
return 1;
}
if (pledge("stdio thread shared_buffer accept rpath cpath wpath", nullptr) < 0) {
perror("pledge");
return 1;
@ -331,6 +346,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/Playground.md"), "/bin/Help");
}));
help_menu.add_action(GUI::Action::create("About", [&](auto&) {
GUI::AboutDialog::show("GML Playground", app_icon.bitmap_for_size(32), window);
}));