main.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2021, the SerenityOS Developers
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include "WelcomeWidget.h"
  7. #include <LibGUI/Application.h>
  8. #include <LibGUI/Icon.h>
  9. #include <LibGUI/Window.h>
  10. #include <unistd.h>
  11. int main(int argc, char** argv)
  12. {
  13. if (pledge("stdio recvfd sendfd rpath unix proc exec", nullptr) < 0) {
  14. perror("pledge");
  15. return 1;
  16. }
  17. auto app = GUI::Application::construct(argc, argv);
  18. if (unveil("/res", "r") < 0) {
  19. perror("unveil");
  20. return 1;
  21. }
  22. if (unveil("/home", "r") < 0) {
  23. perror("unveil");
  24. return 1;
  25. }
  26. if (unveil("/tmp/portal/webcontent", "rw") < 0) {
  27. perror("unveil");
  28. return 1;
  29. }
  30. if (unveil("/bin/Help", "x") < 0) {
  31. perror("unveil");
  32. return 1;
  33. }
  34. if (unveil(nullptr, nullptr) < 0) {
  35. perror("unveil");
  36. return 1;
  37. }
  38. auto app_icon = GUI::Icon::default_icon("app-welcome");
  39. auto window = GUI::Window::construct();
  40. window->resize(480, 250);
  41. window->center_on_screen();
  42. window->set_title("Welcome");
  43. window->set_minimum_size(480, 250);
  44. window->set_icon(app_icon.bitmap_for_size(16));
  45. window->set_main_widget<WelcomeWidget>();
  46. window->show();
  47. return app->exec();
  48. }