mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 02:08:12 +03:00
FontEditor: Port to LibMain :^)
This commit is contained in:
parent
973cb0a49e
commit
ba4fd8fa15
Notes:
sideshowbarker
2024-07-18 00:45:49 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ba4fd8fa15e
@ -22,4 +22,4 @@ set(SOURCES
|
||||
)
|
||||
|
||||
serenity_app(FontEditor ICON app-font-editor)
|
||||
target_link_libraries(FontEditor LibGUI LibDesktop LibGfx)
|
||||
target_link_libraries(FontEditor LibGUI LibDesktop LibGfx LibMain)
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "FontEditor.h"
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
@ -15,22 +16,13 @@
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/BitmapFont.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
if (pledge("stdio recvfd sendfd thread rpath unix cpath wpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd thread rpath unix cpath wpath", nullptr));
|
||||
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
|
||||
if (pledge("stdio recvfd sendfd thread rpath unix cpath wpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
|
||||
if (!Desktop::Launcher::add_allowed_handler_with_only_specific_urls(
|
||||
"/bin/Help",
|
||||
@ -40,15 +32,12 @@ int main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pledge("stdio recvfd sendfd thread rpath cpath wpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd thread rpath cpath wpath", nullptr));
|
||||
|
||||
const char* path = nullptr;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(path, "The font file for editing.", "file", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(argc, argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
RefPtr<Gfx::BitmapFont> edited_font;
|
||||
if (path == nullptr) {
|
||||
@ -71,7 +60,7 @@ int main(int argc, char** argv)
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-font-editor");
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
auto window = TRY(GUI::Window::try_create());
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
window->resize(440, 470);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user