1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 03:07:35 +00:00

Applications+LibGUI: Convert all GML consumers to use the LibCore finder

Remove Widget::find_child_by_name and Widget::find_descendant_by_name,
and convert all users to using the type-safer version in Core::Object.
This commit is contained in:
Andrew Kaster 2021-01-01 00:57:48 -07:00 committed by Andreas Kling
parent 5b03a0867f
commit 347bf6459d
11 changed files with 58 additions and 88 deletions

View file

@ -90,10 +90,10 @@ Tab::Tab(Type type)
{
load_from_gml(tab_gml);
m_toolbar_container = static_cast<GUI::ToolBarContainer&>(*find_descendant_by_name("toolbar_container"));
auto& toolbar = static_cast<GUI::ToolBar&>(*find_descendant_by_name("toolbar"));
m_toolbar_container = *find_descendant_of_type_named<GUI::ToolBarContainer>("toolbar_container");
auto& toolbar = *find_descendant_of_type_named<GUI::ToolBar>("toolbar");
auto& webview_container = *find_descendant_by_name("webview_container");
auto& webview_container = *find_descendant_of_type_named<GUI::Widget>("webview_container");
if (m_type == Type::InProcessWebView)
m_page_view = webview_container.add<Web::InProcessWebView>();
@ -248,7 +248,7 @@ Tab::Tab(Type type)
},
this);
m_statusbar = static_cast<GUI::StatusBar&>(*find_descendant_by_name("statusbar"));
m_statusbar = *find_descendant_of_type_named<GUI::StatusBar>("statusbar");
hooks().on_link_hover = [this](auto& url) {
if (url.is_valid())

View file

@ -140,7 +140,7 @@ int main(int argc, char** argv)
auto& widget = window->set_main_widget<GUI::Widget>();
widget.load_from_gml(browser_window_gml);
auto& tab_widget = static_cast<GUI::TabWidget&>(*widget.find_descendant_by_name("tab_widget"));
auto& tab_widget = *widget.find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
auto default_favicon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-html.png");
ASSERT(default_favicon);