PasswordInputDialog: Port to GML compilation

This commit is contained in:
Aryan Baburajan 2024-03-29 19:23:34 +05:30 committed by Tim Schumacher
parent 24157e4d1b
commit ddbed25bb5
5 changed files with 32 additions and 6 deletions

View file

@ -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)

View file

@ -9,7 +9,7 @@
#include <LibGUI/ImageWidget.h>
#include <LibGUI/Label.h>
#include <LibGUI/PasswordInputDialog.h>
#include <LibGUI/PasswordInputDialogGML.h>
#include <LibGUI/PasswordInputDialogWidget.h>
#include <LibGUI/TextBox.h>
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>();
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<GUI::ImageWidget>("key_icon");

View file

@ -1,4 +1,4 @@
@GUI::Widget {
@GUI::PasswordInputDialogWidget {
fill_with_background_color: true
layout: @GUI::HorizontalBoxLayout {
margins: [8]

View file

@ -15,6 +15,8 @@ class PasswordInputDialog : public Dialog {
C_OBJECT(PasswordInputDialog);
public:
ErrorOr<NonnullRefPtr<GUI::Widget>> try_create();
virtual ~PasswordInputDialog() override = default;
static ExecResult show(Window* parent_window, ByteString& text_value, ByteString title, ByteString server, ByteString username);

View file

@ -0,0 +1,24 @@
/*
* Copyright (c) 2024, Aryan Baburajan <aryanbaburajan2007@gmail.com>.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Frame.h>
namespace GUI {
class PasswordInputDialogWidget : public GUI::Widget {
C_OBJECT_ABSTRACT(PasswordInputDialogWidget)
public:
static ErrorOr<NonnullRefPtr<PasswordInputDialogWidget>> try_create();
virtual ~PasswordInputDialogWidget() override = default;
private:
PasswordInputDialogWidget() = default;
};
}