main.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) 2019-2020, Jesse Buhagiar <jooster669@gmail.com>
  3. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include "DisplaySettings.h"
  8. #include <LibGUI/Action.h>
  9. #include <LibGUI/Application.h>
  10. #include <LibGUI/BoxLayout.h>
  11. #include <LibGUI/Icon.h>
  12. #include <LibGUI/Menu.h>
  13. #include <LibGUI/Menubar.h>
  14. #include <LibGUI/TabWidget.h>
  15. #include <LibGUI/Window.h>
  16. #include <LibGfx/Bitmap.h>
  17. #include <stdio.h>
  18. #include <unistd.h>
  19. int main(int argc, char** argv)
  20. {
  21. if (pledge("stdio thread recvfd sendfd rpath cpath wpath unix", nullptr) < 0) {
  22. perror("pledge");
  23. return 1;
  24. }
  25. auto app = GUI::Application::construct(argc, argv);
  26. if (pledge("stdio thread recvfd sendfd rpath cpath wpath", nullptr) < 0) {
  27. perror("pledge");
  28. return 1;
  29. }
  30. auto app_icon = GUI::Icon::default_icon("app-display-settings");
  31. auto window = GUI::Window::construct();
  32. window->set_title("Display Settings");
  33. window->resize(360, 410);
  34. window->set_resizable(false);
  35. auto& main_widget = window->set_main_widget<GUI::Widget>();
  36. main_widget.set_fill_with_background_color(true);
  37. main_widget.set_layout<GUI::VerticalBoxLayout>();
  38. main_widget.layout()->set_margins({ 4, 4, 4, 4 });
  39. auto& tab_widget = main_widget.add<GUI::TabWidget>();
  40. tab_widget.add_tab<DisplaySettingsWidget>("Display Settings");
  41. window->set_icon(app_icon.bitmap_for_size(16));
  42. window->show();
  43. return app->exec();
  44. }