ladybird/Userland/Applications/Presenter/main.cpp
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00

38 lines
1.3 KiB
C++

/*
* Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "PresenterWidget.h"
#include <LibCore/ArgsParser.h>
#include <LibCore/System.h>
#include <LibGUI/Application.h>
#include <LibGUI/Icon.h>
#include <LibGUI/Window.h>
#include <LibMain/Main.h>
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
// rpath is required to load .presenter files, unix, sendfd and recvfd are required to talk to ImageDecoder and WindowServer.
TRY(Core::System::pledge("stdio rpath unix sendfd recvfd"));
DeprecatedString file_to_load;
Core::ArgsParser argument_parser;
argument_parser.add_positional_argument(file_to_load, "Presentation to load", "file", Core::ArgsParser::Required::No);
argument_parser.parse(arguments);
auto app = TRY(GUI::Application::try_create(arguments));
auto window = TRY(GUI::Window::try_create());
window->set_title("Presenter");
window->set_icon(GUI::Icon::default_icon("app-display-settings"sv).bitmap_for_size(16));
auto main_widget = TRY(window->try_set_main_widget<PresenterWidget>());
TRY(main_widget->initialize_menubar());
window->show();
if (!file_to_load.is_empty())
main_widget->set_file(file_to_load);
return app->exec();
}