mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
FilePickerDialog: Port to GML compilation
This commit is contained in:
parent
ddbed25bb5
commit
3ab05dbbb9
Notes:
sideshowbarker
2024-07-16 21:42:29 +09:00
Author: https://github.com/aryanbaburajan Commit: https://github.com/SerenityOS/serenity/commit/3ab05dbbb9 Pull-request: https://github.com/SerenityOS/serenity/pull/23782 Reviewed-by: https://github.com/timschumi ✅
4 changed files with 30 additions and 7 deletions
|
@ -4,7 +4,7 @@ compile_gml(AboutDialog.gml AboutDialogGML.cpp)
|
|||
stringify_gml(DatePickerDialog.gml DatePickerDialogGML.h date_picker_dialog_gml)
|
||||
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)
|
||||
compile_gml(FilePickerDialog.gml FilePickerDialogGML.cpp)
|
||||
stringify_gml(IncrementalSearchBanner.gml IncrementalSearchBannerGML.h incremental_search_banner_gml)
|
||||
compile_gml(PasswordInputDialog.gml PasswordInputDialogGML.cpp)
|
||||
|
||||
|
@ -50,6 +50,7 @@ set(SOURCES
|
|||
Event.cpp
|
||||
FileIconProvider.cpp
|
||||
FilePicker.cpp
|
||||
FilePickerDialogGML.cpp
|
||||
FileSystemModel.cpp
|
||||
FilteringProxyModel.cpp
|
||||
FontPicker.cpp
|
||||
|
@ -150,7 +151,6 @@ set(GENERATED_SOURCES
|
|||
../../Services/WindowServer/WindowServerEndpoint.h
|
||||
DatePickerDialogGML.h
|
||||
EmojiInputDialogGML.h
|
||||
FilePickerDialogGML.h
|
||||
FontPickerDialogGML.h
|
||||
IncrementalSearchBannerGML.h
|
||||
)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <LibGUI/ConnectionToWindowServer.h>
|
||||
#include <LibGUI/FileIconProvider.h>
|
||||
#include <LibGUI/FilePicker.h>
|
||||
#include <LibGUI/FilePickerDialogGML.h>
|
||||
#include <LibGUI/FilePickerDialogWidget.h>
|
||||
#include <LibGUI/FileSystemModel.h>
|
||||
#include <LibGUI/FileTypeFilter.h>
|
||||
#include <LibGUI/InputBox.h>
|
||||
|
@ -99,8 +99,8 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
|
|||
}
|
||||
resize(560, 320);
|
||||
|
||||
auto widget = set_main_widget<GUI::Widget>();
|
||||
widget->load_from_gml(file_picker_dialog_gml).release_value_but_fixme_should_propagate_errors();
|
||||
auto widget = GUI::FilePickerDialogWidget::try_create().release_value_but_fixme_should_propagate_errors();
|
||||
set_main_widget(widget);
|
||||
|
||||
auto& toolbar = *widget->find_descendant_of_type_named<GUI::Toolbar>("toolbar");
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@GUI::Widget {
|
||||
@GUI::FilePickerDialogWidget {
|
||||
fill_with_background_color: true
|
||||
layout: @GUI::HorizontalBoxLayout {
|
||||
margins: [4]
|
||||
|
@ -83,7 +83,6 @@
|
|||
|
||||
@GUI::ComboBox {
|
||||
name: "allowed_file_type_filters_combo"
|
||||
model_only: true
|
||||
}
|
||||
|
||||
@GUI::DialogButton {
|
||||
|
|
24
Userland/Libraries/LibGUI/FilePickerDialogWidget.h
Normal file
24
Userland/Libraries/LibGUI/FilePickerDialogWidget.h
Normal 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 FilePickerDialogWidget : public GUI::Widget {
|
||||
C_OBJECT_ABSTRACT(FilePickerDialogWidget)
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<FilePickerDialogWidget>> try_create();
|
||||
virtual ~FilePickerDialogWidget() override = default;
|
||||
|
||||
private:
|
||||
FilePickerDialogWidget() = default;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue