1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:07:45 +00:00

LibGUI+About: Make AboutDialog creation fallible

This commit is contained in:
Sam Atkins 2023-02-02 17:07:49 +00:00 committed by Sam Atkins
parent 65c8dfe923
commit 89b8d346fe
4 changed files with 37 additions and 28 deletions

View file

@ -13,16 +13,18 @@
namespace GUI {
class AboutDialog final : public Dialog {
C_OBJECT(AboutDialog)
C_OBJECT_ABSTRACT(AboutDialog)
public:
static ErrorOr<NonnullRefPtr<AboutDialog>> try_create(StringView name, StringView version, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr);
virtual ~AboutDialog() override = default;
static void show(StringView name, StringView version, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr, Gfx::Bitmap const* window_icon = nullptr)
static ErrorOr<void> show(StringView name, StringView version, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr, Gfx::Bitmap const* window_icon = nullptr)
{
auto dialog = AboutDialog::construct(name, version, icon, parent_window);
auto dialog = TRY(AboutDialog::try_create(name, version, icon, parent_window));
if (window_icon)
dialog->set_icon(window_icon);
dialog->exec();
return {};
}
private: