mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:07:35 +00:00
LibGUI+Userland: Make TabWidget::*add_tab() take title using new string
This commit is contained in:
parent
5fed25ca9a
commit
797968c310
18 changed files with 59 additions and 59 deletions
|
@ -567,7 +567,7 @@ void BrowserWindow::set_window_title_for_tab(Tab const& tab)
|
|||
|
||||
void BrowserWindow::create_new_tab(URL url, bool activate)
|
||||
{
|
||||
auto& new_tab = m_tab_widget->add_tab<Browser::Tab>("New tab", *this);
|
||||
auto& new_tab = m_tab_widget->add_tab<Browser::Tab>("New tab"_short_string, *this);
|
||||
|
||||
m_tab_widget->set_bar_visible(!is_fullscreen() && m_tab_widget->children().size() > 1);
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ InspectorWidget::InspectorWidget()
|
|||
|
||||
auto& top_tab_widget = splitter.add<GUI::TabWidget>();
|
||||
|
||||
auto& dom_tree_container = top_tab_widget.add_tab<GUI::Widget>("DOM");
|
||||
auto& dom_tree_container = top_tab_widget.add_tab<GUI::Widget>("DOM"_short_string);
|
||||
dom_tree_container.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
m_dom_tree_view = dom_tree_container.add<GUI::TreeView>();
|
||||
m_dom_tree_view->on_selection_change = [this] {
|
||||
|
@ -90,25 +90,25 @@ InspectorWidget::InspectorWidget()
|
|||
set_selection(index);
|
||||
};
|
||||
|
||||
auto& accessibility_tree_container = top_tab_widget.add_tab<GUI::Widget>("Accessibility");
|
||||
auto& accessibility_tree_container = top_tab_widget.add_tab<GUI::Widget>("Accessibility"_string.release_value_but_fixme_should_propagate_errors());
|
||||
accessibility_tree_container.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
m_accessibility_tree_view = accessibility_tree_container.add<GUI::TreeView>();
|
||||
|
||||
auto& bottom_tab_widget = splitter.add<GUI::TabWidget>();
|
||||
|
||||
auto& computed_style_table_container = bottom_tab_widget.add_tab<GUI::Widget>("Computed");
|
||||
auto& computed_style_table_container = bottom_tab_widget.add_tab<GUI::Widget>("Computed"_string.release_value_but_fixme_should_propagate_errors());
|
||||
computed_style_table_container.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
m_computed_style_table_view = computed_style_table_container.add<GUI::TableView>();
|
||||
|
||||
auto& resolved_style_table_container = bottom_tab_widget.add_tab<GUI::Widget>("Resolved");
|
||||
auto& resolved_style_table_container = bottom_tab_widget.add_tab<GUI::Widget>("Resolved"_string.release_value_but_fixme_should_propagate_errors());
|
||||
resolved_style_table_container.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
m_resolved_style_table_view = resolved_style_table_container.add<GUI::TableView>();
|
||||
|
||||
auto& custom_properties_table_container = bottom_tab_widget.add_tab<GUI::Widget>("Variables");
|
||||
auto& custom_properties_table_container = bottom_tab_widget.add_tab<GUI::Widget>("Variables"_string.release_value_but_fixme_should_propagate_errors());
|
||||
custom_properties_table_container.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
m_custom_properties_table_view = custom_properties_table_container.add<GUI::TableView>();
|
||||
|
||||
auto& box_model_widget = bottom_tab_widget.add_tab<GUI::Widget>("Box Model");
|
||||
auto& box_model_widget = bottom_tab_widget.add_tab<GUI::Widget>("Box Model"_string.release_value_but_fixme_should_propagate_errors());
|
||||
box_model_widget.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
m_element_size_view = box_model_widget.add<ElementSizePreviewWidget>();
|
||||
m_element_size_view->set_should_hide_unnecessary_scrollbars(true);
|
||||
|
|
|
@ -215,7 +215,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto& progressbar = *widget->find_descendant_of_type_named<GUI::Progressbar>("progressbar");
|
||||
auto& tab_widget = *widget->find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
|
||||
|
||||
auto backtrace_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Backtrace"));
|
||||
auto backtrace_tab = TRY(tab_widget.try_add_tab<GUI::Widget>(TRY("Backtrace"_string)));
|
||||
TRY(backtrace_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
|
||||
auto backtrace_label = TRY(backtrace_tab->try_add<GUI::Label>("A backtrace for each thread alive during the crash is listed below:"));
|
||||
|
@ -225,7 +225,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto backtrace_tab_widget = TRY(backtrace_tab->try_add<GUI::TabWidget>());
|
||||
backtrace_tab_widget->set_tab_position(GUI::TabWidget::TabPosition::Bottom);
|
||||
|
||||
auto cpu_registers_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("CPU Registers"));
|
||||
auto cpu_registers_tab = TRY(tab_widget.try_add_tab<GUI::Widget>(TRY("CPU Registers"_string)));
|
||||
cpu_registers_tab->set_layout<GUI::VerticalBoxLayout>(4);
|
||||
|
||||
auto cpu_registers_label = TRY(cpu_registers_tab->try_add<GUI::Label>("The CPU register state for each thread alive during the crash is listed below:"));
|
||||
|
@ -235,7 +235,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto cpu_registers_tab_widget = TRY(cpu_registers_tab->try_add<GUI::TabWidget>());
|
||||
cpu_registers_tab_widget->set_tab_position(GUI::TabWidget::TabPosition::Bottom);
|
||||
|
||||
auto environment_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Environment"));
|
||||
auto environment_tab = TRY(tab_widget.try_add_tab<GUI::Widget>(TRY("Environment"_string)));
|
||||
TRY(environment_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
|
||||
auto environment_text_editor = TRY(environment_tab->try_add<GUI::TextEditor>());
|
||||
|
@ -244,7 +244,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
environment_text_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::NoWrap);
|
||||
environment_text_editor->set_should_hide_unnecessary_scrollbars(true);
|
||||
|
||||
auto memory_regions_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Memory Regions"));
|
||||
auto memory_regions_tab = TRY(tab_widget.try_add_tab<GUI::Widget>(TRY("Memory Regions"_string)));
|
||||
TRY(memory_regions_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
|
||||
auto memory_regions_text_editor = TRY(memory_regions_tab->try_add<GUI::TextEditor>());
|
||||
|
@ -309,7 +309,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
},
|
||||
[&](auto results) -> ErrorOr<void> {
|
||||
for (auto& backtrace : results.thread_backtraces) {
|
||||
auto container = TRY(backtrace_tab_widget->try_add_tab<GUI::Widget>(backtrace.title));
|
||||
auto container = TRY(backtrace_tab_widget->try_add_tab<GUI::Widget>(TRY(String::from_deprecated_string(backtrace.title))));
|
||||
TRY(container->template try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
auto backtrace_text_editor = TRY(container->template try_add<GUI::TextEditor>());
|
||||
backtrace_text_editor->set_text(backtrace.text);
|
||||
|
@ -320,7 +320,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
for (auto& cpu_registers : results.thread_cpu_registers) {
|
||||
auto container = TRY(cpu_registers_tab_widget->try_add_tab<GUI::Widget>(cpu_registers.title));
|
||||
auto container = TRY(cpu_registers_tab_widget->try_add_tab<GUI::Widget>(TRY(String::from_deprecated_string(cpu_registers.title))));
|
||||
TRY(container->template try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
auto cpu_registers_text_editor = TRY(container->template try_add<GUI::TextEditor>());
|
||||
cpu_registers_text_editor->set_text(cpu_registers.text);
|
||||
|
|
|
@ -58,7 +58,7 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
|
|||
|
||||
auto tab_widget = TRY(main_widget->try_add<GUI::TabWidget>());
|
||||
|
||||
auto general_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("General"));
|
||||
auto general_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("General"_short_string));
|
||||
TRY(general_tab->load_from_gml(properties_window_general_tab_gml));
|
||||
|
||||
m_icon = general_tab->find_descendant_of_type_named<GUI::ImageWidget>("icon");
|
||||
|
|
|
@ -17,7 +17,7 @@ SidebarWidget::SidebarWidget()
|
|||
|
||||
auto& tab_bar = add<GUI::TabWidget>();
|
||||
|
||||
auto& outline_container = tab_bar.add_tab<GUI::Widget>("Outline");
|
||||
auto& outline_container = tab_bar.add_tab<GUI::Widget>("Outline"_short_string);
|
||||
outline_container.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
|
||||
m_outline_tree_view = outline_container.add<GUI::TreeView>();
|
||||
|
@ -32,7 +32,7 @@ SidebarWidget::SidebarWidget()
|
|||
on_destination_selected(destination);
|
||||
};
|
||||
|
||||
auto& thumbnails_container = tab_bar.add_tab<GUI::Widget>("Thumbnails");
|
||||
auto& thumbnails_container = tab_bar.add_tab<GUI::Widget>("Thumbnails"_string.release_value_but_fixme_should_propagate_errors());
|
||||
thumbnails_container.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
|
||||
// FIXME: Add thumbnail previews
|
||||
|
|
|
@ -42,11 +42,11 @@ ErrorOr<void> MainWidget::initialize()
|
|||
m_wave_widget->set_fixed_height(100);
|
||||
|
||||
m_tab_widget = TRY(try_add<GUI::TabWidget>());
|
||||
m_roll_widget = TRY(m_tab_widget->try_add_tab<RollWidget>("Piano Roll", m_track_manager));
|
||||
m_roll_widget = TRY(m_tab_widget->try_add_tab<RollWidget>(TRY("Piano Roll"_string), m_track_manager));
|
||||
|
||||
m_roll_widget->set_fixed_height(300);
|
||||
|
||||
(void)TRY(m_tab_widget->try_add_tab<SamplerWidget>("Sampler", m_track_manager));
|
||||
(void)TRY(m_tab_widget->try_add_tab<SamplerWidget>("Sampler"_short_string, m_track_manager));
|
||||
m_player_widget = TRY(try_add<PlayerWidget>(m_track_manager, m_audio_loop));
|
||||
|
||||
m_keys_and_knobs_container = TRY(try_add<GUI::Widget>());
|
||||
|
|
|
@ -1244,7 +1244,7 @@ ImageEditor* MainWidget::current_image_editor()
|
|||
|
||||
ImageEditor& MainWidget::create_new_editor(NonnullRefPtr<Image> image)
|
||||
{
|
||||
auto& image_editor = m_tab_widget->add_tab<PixelPaint::ImageEditor>("Untitled", image);
|
||||
auto& image_editor = m_tab_widget->add_tab<PixelPaint::ImageEditor>("Untitled"_string.release_value_but_fixme_should_propagate_errors(), image);
|
||||
|
||||
image_editor.on_active_layer_change = [&](auto* layer) {
|
||||
if (current_image_editor() != &image_editor)
|
||||
|
|
|
@ -132,7 +132,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
|
|||
m_conditional_formats = cell.conditional_formats();
|
||||
}
|
||||
|
||||
auto& type_tab = tabs.add_tab<GUI::Widget>("Type");
|
||||
auto& type_tab = tabs.add_tab<GUI::Widget>("Type"_short_string);
|
||||
type_tab.set_layout<GUI::HorizontalBoxLayout>(4);
|
||||
{
|
||||
auto& left_side = type_tab.add<GUI::Widget>();
|
||||
|
@ -197,7 +197,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
|
|||
}
|
||||
}
|
||||
|
||||
auto& alignment_tab = tabs.add_tab<GUI::Widget>("Alignment");
|
||||
auto& alignment_tab = tabs.add_tab<GUI::Widget>("Alignment"_string.release_value_but_fixme_should_propagate_errors());
|
||||
alignment_tab.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
{
|
||||
// FIXME: Frame?
|
||||
|
@ -264,7 +264,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
|
|||
}
|
||||
}
|
||||
|
||||
auto& colors_tab = tabs.add_tab<GUI::Widget>("Color");
|
||||
auto& colors_tab = tabs.add_tab<GUI::Widget>("Color"_short_string);
|
||||
colors_tab.set_layout<GUI::VerticalBoxLayout>(4);
|
||||
{
|
||||
// Static formatting
|
||||
|
@ -312,7 +312,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
|
|||
}
|
||||
}
|
||||
|
||||
auto& conditional_fmt_tab = tabs.add_tab<GUI::Widget>("Conditional format");
|
||||
auto& conditional_fmt_tab = tabs.add_tab<GUI::Widget>("Conditional format"_string.release_value_but_fixme_should_propagate_errors());
|
||||
conditional_fmt_tab.load_from_gml(cond_fmt_gml).release_value_but_fixme_should_propagate_errors();
|
||||
{
|
||||
auto& view = *conditional_fmt_tab.find_descendant_of_type_named<Spreadsheet::ConditionsView>("conditions_view");
|
||||
|
|
|
@ -333,7 +333,7 @@ void SpreadsheetWidget::clipboard_content_did_change(DeprecatedString const& mim
|
|||
void SpreadsheetWidget::setup_tabs(Vector<NonnullRefPtr<Sheet>> new_sheets)
|
||||
{
|
||||
for (auto& sheet : new_sheets) {
|
||||
auto& new_view = m_tab_widget->add_tab<SpreadsheetView>(sheet->name(), sheet);
|
||||
auto& new_view = m_tab_widget->add_tab<SpreadsheetView>(String::from_deprecated_string(sheet->name()).release_value_but_fixme_should_propagate_errors(), sheet);
|
||||
new_view.model()->on_cell_data_change = [&](auto& cell, auto& previous_data) {
|
||||
undo_stack().push(make<CellsUndoCommand>(cell, previous_data));
|
||||
window()->set_modified(true);
|
||||
|
|
|
@ -435,7 +435,7 @@ void MainWidget::build_override_controls()
|
|||
|
||||
ErrorOr<void> MainWidget::add_property_tab(PropertyTab const& property_tab)
|
||||
{
|
||||
auto scrollable_container = TRY(m_property_tabs->try_add_tab<GUI::ScrollableContainerWidget>(property_tab.title));
|
||||
auto scrollable_container = TRY(m_property_tabs->try_add_tab<GUI::ScrollableContainerWidget>(TRY(String::from_deprecated_string(property_tab.title))));
|
||||
scrollable_container->set_should_hide_unnecessary_scrollbars(true);
|
||||
|
||||
auto properties_list = TRY(GUI::Widget::try_create());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue