2023-09-11 17:15:26 +00:00
|
|
|
#include <luna/String.h>
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
#include <ui/App.h>
|
|
|
|
#include <ui/Button.h>
|
|
|
|
#include <ui/Label.h>
|
|
|
|
#include <ui/Layout.h>
|
|
|
|
|
2023-09-20 17:45:19 +00:00
|
|
|
static constexpr ui::Color BACKGROUND_COLOR = ui::Color::from_rgb(89, 89, 89);
|
|
|
|
|
2023-09-11 17:15:26 +00:00
|
|
|
Result<int> luna_main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
ui::App app;
|
|
|
|
TRY(app.init(argc, argv));
|
|
|
|
|
|
|
|
auto* window = TRY(ui::Window::create(ui::Rect { 300, 300, 400, 300 }));
|
|
|
|
app.set_main_window(window);
|
|
|
|
|
|
|
|
window->set_title("About");
|
2023-09-20 17:45:19 +00:00
|
|
|
window->set_background(BACKGROUND_COLOR);
|
2023-09-11 17:15:26 +00:00
|
|
|
|
|
|
|
utsname info;
|
|
|
|
uname(&info);
|
|
|
|
|
|
|
|
ui::VerticalLayout main_layout;
|
|
|
|
window->set_main_widget(main_layout);
|
|
|
|
|
2023-10-11 20:56:14 +00:00
|
|
|
ui::Label title("About Luna");
|
|
|
|
title.set_font(ui::Font::default_bold_font());
|
|
|
|
|
2023-09-11 17:15:26 +00:00
|
|
|
main_layout.add_widget(title);
|
|
|
|
|
|
|
|
ui::VerticalLayout version_info;
|
|
|
|
main_layout.add_widget(version_info);
|
|
|
|
|
|
|
|
ui::Label license("Licensed under the BSD-2-Clause license.");
|
|
|
|
main_layout.add_widget(license);
|
|
|
|
|
|
|
|
String os_release_text = TRY(String::format("OS release: %s"_sv, info.release));
|
|
|
|
ui::Label os_release(os_release_text.view());
|
|
|
|
version_info.add_widget(os_release);
|
|
|
|
|
|
|
|
String kernel_version_text = TRY(String::format("Kernel version: %s"_sv, info.version));
|
|
|
|
ui::Label kernel_version(kernel_version_text.view());
|
|
|
|
version_info.add_widget(kernel_version);
|
|
|
|
|
|
|
|
return app.run();
|
|
|
|
}
|