Browser: Consolidate StorageWidget tabs into a single gml file

This patch removes the separate CookiesTab.gml file used to define the
layout of the cookies and local storage tabs and moves those defintions
into the StorageWidget.gml file.
This commit is contained in:
networkException 2022-05-01 00:47:01 +02:00 committed by Linus Groh
parent e5196c8e3d
commit f3f19f8321
Notes: sideshowbarker 2024-07-17 11:16:06 +09:00
4 changed files with 36 additions and 27 deletions

View file

@ -6,7 +6,6 @@ serenity_component(
)
compile_gml(BrowserWindow.gml BrowserWindowGML.h browser_window_gml)
compile_gml(CookiesTab.gml CookiesTabGML.h cookies_tab_gml)
compile_gml(EditBookmark.gml EditBookmarkGML.h edit_bookmark_gml)
compile_gml(StorageWidget.gml StorageWidgetGML.h storage_widget_gml)
compile_gml(Tab.gml TabGML.h tab_gml)
@ -18,7 +17,6 @@ set(SOURCES
ConsoleWidget.cpp
CookieJar.cpp
CookiesModel.cpp
CookiesTabGML.h
DownloadWidget.cpp
EditBookmarkGML.h
ElementSizePreviewWidget.cpp

View file

@ -1,16 +0,0 @@
@GUI::Widget {
name: "cookies_tab"
layout: @GUI::VerticalBoxLayout {
margins: [4]
}
@GUI::GroupBox {
layout: @GUI::VerticalBoxLayout {
margins: [6]
}
@GUI::TableView {
name: "cookies_tableview"
}
}
}

View file

@ -8,7 +8,6 @@
#include "CookiesModel.h"
#include "LocalStorageModel.h"
#include <AK/Variant.h>
#include <Applications/Browser/CookiesTabGML.h>
#include <Applications/Browser/StorageWidgetGML.h>
#include <LibGUI/TabWidget.h>
#include <LibGUI/TableView.h>
@ -21,10 +20,7 @@ StorageWidget::StorageWidget()
load_from_gml(storage_widget_gml);
auto& tab_widget = *find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
auto cookies_tab = tab_widget.try_add_tab<GUI::Widget>("Cookies").release_value_but_fixme_should_propagate_errors();
cookies_tab->load_from_gml(cookies_tab_gml);
m_cookies_table_view = cookies_tab->find_descendant_of_type_named<GUI::TableView>("cookies_tableview");
m_cookies_table_view = tab_widget.find_descendant_of_type_named<GUI::TableView>("cookies_tableview");
m_cookies_model = adopt_ref(*new CookiesModel());
m_cookie_sorting_model = MUST(GUI::SortingProxyModel::create(*m_cookies_model));
@ -34,10 +30,7 @@ StorageWidget::StorageWidget()
m_cookies_table_view->set_column_headers_visible(true);
m_cookies_table_view->set_alternating_row_colors(true);
auto local_storage_tab = tab_widget.try_add_tab<GUI::Widget>("Local Storage").release_value_but_fixme_should_propagate_errors();
local_storage_tab->load_from_gml(cookies_tab_gml);
m_local_storage_table_view = local_storage_tab->find_descendant_of_type_named<GUI::TableView>("cookies_tableview");
m_local_storage_table_view = tab_widget.find_descendant_of_type_named<GUI::TableView>("local_storage_tableview");
m_local_storage_model = adopt_ref(*new LocalStorageModel());
m_local_storage_sorting_model = MUST(GUI::SortingProxyModel::create(*m_local_storage_model));

View file

@ -6,5 +6,39 @@
@GUI::TabWidget {
name: "tab_widget"
@GUI::Widget {
title: "Cookies"
layout: @GUI::VerticalBoxLayout {
margins: [4]
}
@GUI::GroupBox {
layout: @GUI::VerticalBoxLayout {
margins: [6]
}
@GUI::TableView {
name: "cookies_tableview"
}
}
}
@GUI::Widget {
title: "Local Storage"
layout: @GUI::VerticalBoxLayout {
margins: [4]
}
@GUI::GroupBox {
layout: @GUI::VerticalBoxLayout {
margins: [6]
}
@GUI::TableView {
name: "local_storage_tableview"
}
}
}
}
}