From cdffe556c8fcca034b10cf91f0b05c17d835bc7b Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 13 May 2022 13:10:27 +0100 Subject: LibGUI+Userland: Make Dialog::ExecResult an enum class --- Userland/Libraries/LibGUI/Dialog.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Userland/Libraries/LibGUI/Dialog.cpp') diff --git a/Userland/Libraries/LibGUI/Dialog.cpp b/Userland/Libraries/LibGUI/Dialog.cpp index d4e7e65631..7dcba9cd7f 100644 --- a/Userland/Libraries/LibGUI/Dialog.cpp +++ b/Userland/Libraries/LibGUI/Dialog.cpp @@ -20,7 +20,7 @@ Dialog::Dialog(Window* parent_window, ScreenPosition screen_position) set_minimizable(false); } -int Dialog::exec() +Dialog::ExecResult Dialog::exec() { VERIFY(!m_event_loop); m_event_loop = make(); @@ -87,16 +87,16 @@ int Dialog::exec() m_event_loop = nullptr; dbgln("{}: Event loop returned with result {}", *this, result); remove_from_parent(); - return result; + return static_cast(result); } -void Dialog::done(int result) +void Dialog::done(ExecResult result) { if (!m_event_loop) return; m_result = result; - dbgln("{}: Quit event loop with result {}", *this, result); - m_event_loop->quit(result); + dbgln("{}: Quit event loop with result {}", *this, to_underlying(result)); + m_event_loop->quit(to_underlying(result)); } void Dialog::event(Core::Event& event) @@ -104,7 +104,7 @@ void Dialog::event(Core::Event& event) if (event.type() == Event::KeyUp || event.type() == Event::KeyDown) { auto& key_event = static_cast(event); if (key_event.key() == KeyCode::Key_Escape) { - done(ExecCancel); + done(ExecResult::Cancel); event.accept(); return; } @@ -116,7 +116,7 @@ void Dialog::event(Core::Event& event) void Dialog::close() { Window::close(); - done(ExecCancel); + done(ExecResult::Cancel); } } -- cgit v1.2.3