1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

Applications: Add Presenter

This version can already:
- load all of the defined file format except for the image type and the
  frame-specific stuff
- navigate frames and slides (though frames are mostly stubbed out)
- display text with various common settings
- displays text with various fitting and scaling methods
- scale and position objects correctly no matter the window size
This commit is contained in:
kleines Filmröllchen 2022-10-20 22:30:39 +02:00 committed by Andrew Kaster
parent 295f83e54c
commit de44d6c0a6
12 changed files with 828 additions and 0 deletions

View file

@ -0,0 +1,37 @@
/*
* 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"));
String 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();
}