summaryrefslogtreecommitdiff
path: root/Userland/Games/Chess
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-01-06 16:48:37 +0000
committerAndrew Kaster <andrewdkaster@gmail.com>2023-01-06 13:36:02 -0700
commit0c24522635ec7f07e1fb69d9e1cd350d81e2248f (patch)
tree391782374bada7ee7a986674229551c2ec21f75a /Userland/Games/Chess
parentd223477bc650e271008ccc339fc1e2c0fcc079e7 (diff)
downloadserenity-0c24522635ec7f07e1fb69d9e1cd350d81e2248f.zip
LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)
Rip that bandaid off! This does the following, in one big, awkward jump: - Replace all uses of `set_main_widget<Foo>()` with the `try` version. - Remove `set_main_widget<Foo>()`. - Rename the `try` version to just be `set_main_widget` because it's now the only one. The majority of places that call `set_main_widget<Foo>()` are inside constructors, so this unfortunately gives us a big batch of new `release_value_but_fixme_should_propagate_errors()` calls.
Diffstat (limited to 'Userland/Games/Chess')
-rw-r--r--Userland/Games/Chess/PromotionDialog.cpp10
-rw-r--r--Userland/Games/Chess/main.cpp2
2 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Games/Chess/PromotionDialog.cpp b/Userland/Games/Chess/PromotionDialog.cpp
index f20ab09148..06e742ae24 100644
--- a/Userland/Games/Chess/PromotionDialog.cpp
+++ b/Userland/Games/Chess/PromotionDialog.cpp
@@ -17,13 +17,13 @@ PromotionDialog::PromotionDialog(ChessWidget& chess_widget)
set_icon(chess_widget.window()->icon());
resize(70 * 4, 70);
- auto& main_widget = set_main_widget<GUI::Frame>();
- main_widget.set_frame_shape(Gfx::FrameShape::Container);
- main_widget.set_fill_with_background_color(true);
- main_widget.set_layout<GUI::HorizontalBoxLayout>();
+ auto main_widget = set_main_widget<GUI::Frame>().release_value_but_fixme_should_propagate_errors();
+ main_widget->set_frame_shape(Gfx::FrameShape::Container);
+ main_widget->set_fill_with_background_color(true);
+ main_widget->set_layout<GUI::HorizontalBoxLayout>();
for (auto const& type : { Chess::Type::Queen, Chess::Type::Knight, Chess::Type::Rook, Chess::Type::Bishop }) {
- auto& button = main_widget.add<GUI::Button>("");
+ auto& button = main_widget->add<GUI::Button>("");
button.set_fixed_height(70);
button.set_icon(chess_widget.get_piece_graphic({ chess_widget.board().turn(), type }));
button.on_click = [this, type](auto) {
diff --git a/Userland/Games/Chess/main.cpp b/Userland/Games/Chess/main.cpp
index 5dfa1145fd..8e40931ec3 100644
--- a/Userland/Games/Chess/main.cpp
+++ b/Userland/Games/Chess/main.cpp
@@ -34,7 +34,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-chess"sv));
auto window = TRY(GUI::Window::try_create());
- auto widget = TRY(window->try_set_main_widget<ChessWidget>());
+ auto widget = TRY(window->set_main_widget<ChessWidget>());
TRY(Core::System::unveil("/sys/kernel/processes", "r"));
TRY(Core::System::unveil("/res", "r"));