diff --git a/Userland/Libraries/LibGUI/CMakeLists.txt b/Userland/Libraries/LibGUI/CMakeLists.txt index 7c1842173b2..8c4fe1d157f 100644 --- a/Userland/Libraries/LibGUI/CMakeLists.txt +++ b/Userland/Libraries/LibGUI/CMakeLists.txt @@ -6,7 +6,7 @@ stringify_gml(EmojiInputDialog.gml EmojiInputDialogGML.h emoji_input_dialog_gml) stringify_gml(FontPickerDialog.gml FontPickerDialogGML.h font_picker_dialog_gml) stringify_gml(FilePickerDialog.gml FilePickerDialogGML.h file_picker_dialog_gml) stringify_gml(IncrementalSearchBanner.gml IncrementalSearchBannerGML.h incremental_search_banner_gml) -stringify_gml(PasswordInputDialog.gml PasswordInputDialogGML.h password_input_dialog_gml) +compile_gml(PasswordInputDialog.gml PasswordInputDialogGML.cpp) set(SOURCES AboutDialog.cpp @@ -92,6 +92,7 @@ set(SOURCES OpacitySlider.cpp Painter.cpp PasswordInputDialog.cpp + PasswordInputDialogGML.cpp PathBreadcrumbbar.cpp PersistentModelIndex.cpp Process.cpp @@ -152,7 +153,6 @@ set(GENERATED_SOURCES FilePickerDialogGML.h FontPickerDialogGML.h IncrementalSearchBannerGML.h - PasswordInputDialogGML.h ) serenity_lib(LibGUI gui) diff --git a/Userland/Libraries/LibGUI/PasswordInputDialog.cpp b/Userland/Libraries/LibGUI/PasswordInputDialog.cpp index 8800869a13c..178a1be89a7 100644 --- a/Userland/Libraries/LibGUI/PasswordInputDialog.cpp +++ b/Userland/Libraries/LibGUI/PasswordInputDialog.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include namespace GUI { @@ -23,8 +23,8 @@ PasswordInputDialog::PasswordInputDialog(Window* parent_window, ByteString title resize(340, 122); set_title(move(title)); - auto widget = set_main_widget(); - widget->load_from_gml(password_input_dialog_gml).release_value_but_fixme_should_propagate_errors(); + auto widget = PasswordInputDialogWidget::try_create().release_value_but_fixme_should_propagate_errors(); + set_main_widget(widget); auto& key_icon = *widget->find_descendant_of_type_named("key_icon"); diff --git a/Userland/Libraries/LibGUI/PasswordInputDialog.gml b/Userland/Libraries/LibGUI/PasswordInputDialog.gml index 9beb266e5da..2e362a8603f 100644 --- a/Userland/Libraries/LibGUI/PasswordInputDialog.gml +++ b/Userland/Libraries/LibGUI/PasswordInputDialog.gml @@ -1,4 +1,4 @@ -@GUI::Widget { +@GUI::PasswordInputDialogWidget { fill_with_background_color: true layout: @GUI::HorizontalBoxLayout { margins: [8] diff --git a/Userland/Libraries/LibGUI/PasswordInputDialog.h b/Userland/Libraries/LibGUI/PasswordInputDialog.h index 474159602aa..036ceca1f4c 100644 --- a/Userland/Libraries/LibGUI/PasswordInputDialog.h +++ b/Userland/Libraries/LibGUI/PasswordInputDialog.h @@ -15,6 +15,8 @@ class PasswordInputDialog : public Dialog { C_OBJECT(PasswordInputDialog); public: + ErrorOr> try_create(); + virtual ~PasswordInputDialog() override = default; static ExecResult show(Window* parent_window, ByteString& text_value, ByteString title, ByteString server, ByteString username); diff --git a/Userland/Libraries/LibGUI/PasswordInputDialogWidget.h b/Userland/Libraries/LibGUI/PasswordInputDialogWidget.h new file mode 100644 index 00000000000..c534865655a --- /dev/null +++ b/Userland/Libraries/LibGUI/PasswordInputDialogWidget.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024, Aryan Baburajan . + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +namespace GUI { + +class PasswordInputDialogWidget : public GUI::Widget { + C_OBJECT_ABSTRACT(PasswordInputDialogWidget) + +public: + static ErrorOr> try_create(); + virtual ~PasswordInputDialogWidget() override = default; + +private: + PasswordInputDialogWidget() = default; +}; + +}