LibGUI+Userland: Make TabWidget::*add_tab() take title using new string

This commit is contained in:
Karol Kosek 2023-03-10 18:55:52 +01:00 committed by Andreas Kling
parent 5fed25ca9a
commit 797968c310
Notes: sideshowbarker 2024-07-16 22:51:25 +09:00
18 changed files with 59 additions and 59 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -24,7 +24,7 @@ GalleryWidget::GalleryWidget()
ErrorOr<void> GalleryWidget::load_basic_model_tab()
{
auto tab = TRY(m_tab_widget->try_add_tab<GUI::Widget>("Basic Model"));
auto tab = TRY(m_tab_widget->try_add_tab<GUI::Widget>(TRY("Basic Model"_string)));
TRY(tab->load_from_gml(basic_model_tab_gml));
m_basic_model = BasicModel::create();

View file

@ -36,7 +36,7 @@ GalleryWidget::GalleryWidget()
auto& tab_widget = *find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
auto basics_tab = tab_widget.try_add_tab<GUI::Widget>("Basics").release_value_but_fixme_should_propagate_errors();
auto basics_tab = tab_widget.try_add_tab<GUI::Widget>("Basics"_short_string).release_value_but_fixme_should_propagate_errors();
basics_tab->load_from_gml(basics_tab_gml).release_value_but_fixme_should_propagate_errors();
m_enabled_label = basics_tab->find_descendant_of_type_named<GUI::Label>("enabled_label");
@ -169,7 +169,7 @@ GalleryWidget::GalleryWidget()
GUI::MessageBox::show(window(), m_text_editor->text(), "Message"sv, m_msgbox_type, m_msgbox_input_type);
};
auto sliders_tab = tab_widget.try_add_tab<GUI::Widget>("Sliders").release_value_but_fixme_should_propagate_errors();
auto sliders_tab = tab_widget.try_add_tab<GUI::Widget>("Sliders"_short_string).release_value_but_fixme_should_propagate_errors();
sliders_tab->load_from_gml(sliders_tab_gml).release_value_but_fixme_should_propagate_errors();
m_vertical_progressbar_left = sliders_tab->find_descendant_of_type_named<GUI::VerticalProgressbar>("vertical_progressbar_left");
@ -230,7 +230,7 @@ GalleryWidget::GalleryWidget()
m_opacity_slider->set_value(percent);
};
auto wizards_tab = tab_widget.try_add_tab<GUI::Widget>("Wizards").release_value_but_fixme_should_propagate_errors();
auto wizards_tab = tab_widget.try_add_tab<GUI::Widget>("Wizards"_short_string).release_value_but_fixme_should_propagate_errors();
wizards_tab->load_from_gml(wizards_tab_gml).release_value_but_fixme_should_propagate_errors();
m_wizard_button = wizards_tab->find_descendant_of_type_named<GUI::Button>("wizard_button");
@ -286,7 +286,7 @@ GalleryWidget::GalleryWidget()
m_wizard_output->set_text(sb.string_view());
};
auto cursors_tab = tab_widget.try_add_tab<GUI::Widget>("Cursors").release_value_but_fixme_should_propagate_errors();
auto cursors_tab = tab_widget.try_add_tab<GUI::Widget>("Cursors"_short_string).release_value_but_fixme_should_propagate_errors();
cursors_tab->load_from_gml(cursors_tab_gml).release_value_but_fixme_should_propagate_errors();
m_cursors_tableview = cursors_tab->find_descendant_of_type_named<GUI::TableView>("cursors_tableview");
@ -309,7 +309,7 @@ GalleryWidget::GalleryWidget()
m_cursors_tableview->set_override_cursor(NonnullRefPtr<Gfx::Bitmap const>(icon_index.data().as_bitmap()));
};
auto icons_tab = tab_widget.try_add_tab<GUI::Widget>("Icons").release_value_but_fixme_should_propagate_errors();
auto icons_tab = tab_widget.try_add_tab<GUI::Widget>("Icons"_short_string).release_value_but_fixme_should_propagate_errors();
icons_tab->load_from_gml(icons_tab_gml).release_value_but_fixme_should_propagate_errors();
m_icons_tableview = icons_tab->find_descendant_of_type_named<GUI::TableView>("icons_tableview");

View file

@ -778,7 +778,7 @@ void HackStudioWidget::add_new_editor_tab_widget(GUI::Widget& parent)
void HackStudioWidget::add_new_editor(GUI::TabWidget& parent)
{
auto& wrapper = parent.add_tab<EditorWrapper>("(Untitled)");
auto& wrapper = parent.add_tab<EditorWrapper>("(Untitled)"_string.release_value_but_fixme_should_propagate_errors());
parent.set_active_widget(&wrapper);
if (parent.children().size() > 1 || m_all_editor_tab_widgets.size() > 1)
parent.set_close_button_enabled(true);
@ -978,7 +978,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_add_terminal_action
return GUI::Action::create("Add New &Terminal", { Mod_Ctrl | Mod_Alt, Key_T },
icon,
[this](auto&) {
auto& terminal_wrapper = m_action_tab_widget->add_tab<TerminalWrapper>("Terminal");
auto& terminal_wrapper = m_action_tab_widget->add_tab<TerminalWrapper>("Terminal"_string.release_value_but_fixme_should_propagate_errors());
terminal_wrapper.on_command_exit = [&]() {
deferred_invoke([this]() {
m_action_tab_widget->remove_tab(*m_action_tab_widget->active_widget());
@ -1335,24 +1335,24 @@ ErrorOr<void> HackStudioWidget::create_action_tab(GUI::Widget& parent)
first_time = false;
};
m_find_in_files_widget = m_action_tab_widget->add_tab<FindInFilesWidget>("Find in files");
m_todo_entries_widget = m_action_tab_widget->add_tab<ToDoEntriesWidget>("TODO");
m_terminal_wrapper = m_action_tab_widget->add_tab<TerminalWrapper>("Console", false);
m_find_in_files_widget = m_action_tab_widget->add_tab<FindInFilesWidget>(TRY("Find in files"_string));
m_todo_entries_widget = m_action_tab_widget->add_tab<ToDoEntriesWidget>("TODO"_short_string);
m_terminal_wrapper = m_action_tab_widget->add_tab<TerminalWrapper>("Console"_short_string, false);
auto debug_info_widget = TRY(DebugInfoWidget::create());
TRY(m_action_tab_widget->add_tab(debug_info_widget, "Debug"));
TRY(m_action_tab_widget->add_tab(debug_info_widget, "Debug"_short_string));
m_debug_info_widget = debug_info_widget;
m_debug_info_widget->on_backtrace_frame_selection = [this](Debug::DebugInfo::SourcePosition const& source_position) {
open_file(get_absolute_path(source_position.file_path), source_position.line_number - 1);
};
m_disassembly_widget = m_action_tab_widget->add_tab<DisassemblyWidget>("Disassembly");
m_git_widget = m_action_tab_widget->add_tab<GitWidget>("Git");
m_disassembly_widget = m_action_tab_widget->add_tab<DisassemblyWidget>(TRY("Disassembly"_string));
m_git_widget = m_action_tab_widget->add_tab<GitWidget>("Git"_short_string);
m_git_widget->set_view_diff_callback([this](auto const& original_content, auto const& diff) {
m_diff_viewer->set_content(original_content, diff);
set_edit_mode(EditMode::Diff);
});
m_gml_preview_widget = m_action_tab_widget->add_tab<GMLPreviewWidget>("GML Preview", "");
m_gml_preview_widget = m_action_tab_widget->add_tab<GMLPreviewWidget>(TRY("GML Preview"_string), "");
ToDoEntries::the().on_update = [this]() {
m_todo_entries_widget->refresh();
@ -1366,13 +1366,13 @@ void HackStudioWidget::create_project_tab(GUI::Widget& parent)
m_project_tab = parent.add<GUI::TabWidget>();
m_project_tab->set_tab_position(GUI::TabWidget::TabPosition::Bottom);
auto& tree_view_container = m_project_tab->add_tab<GUI::Widget>("Files");
auto& tree_view_container = m_project_tab->add_tab<GUI::Widget>("Files"_short_string);
tree_view_container.set_layout<GUI::VerticalBoxLayout>(GUI::Margins {}, 2);
m_project_tree_view = tree_view_container.add<GUI::TreeView>();
configure_project_tree_view();
auto& class_view_container = m_project_tab->add_tab<GUI::Widget>("Classes");
auto& class_view_container = m_project_tab->add_tab<GUI::Widget>("Classes"_short_string);
class_view_container.set_layout<GUI::VerticalBoxLayout>(2);
m_class_view = class_view_container.add<ClassViewWidget>();

View file

@ -131,7 +131,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto tab_widget = TRY(main_splitter->try_add<GUI::TabWidget>());
auto tree_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("Call Tree"));
auto tree_tab = TRY(tab_widget->try_add_tab<GUI::Widget>(TRY("Call Tree"_string)));
TRY(tree_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto bottom_splitter = TRY(tree_tab->try_add<GUI::VerticalSplitter>());
@ -180,7 +180,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
update_source_model();
});
auto samples_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("Samples"));
auto samples_tab = TRY(tab_widget->try_add_tab<GUI::Widget>(TRY("Samples"_string)));
TRY(samples_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto samples_splitter = TRY(samples_tab->try_add<GUI::HorizontalSplitter>());
@ -194,7 +194,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
individual_sample_view->set_model(move(model));
};
auto signposts_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("Signposts"));
auto signposts_tab = TRY(tab_widget->try_add_tab<GUI::Widget>(TRY("Signposts"_string)));
TRY(signposts_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto signposts_splitter = TRY(signposts_tab->try_add<GUI::HorizontalSplitter>());
@ -208,7 +208,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
individual_signpost_view->set_model(move(model));
};
auto flamegraph_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("Flame Graph"));
auto flamegraph_tab = TRY(tab_widget->try_add_tab<GUI::Widget>(TRY("Flame Graph"_string)));
TRY(flamegraph_tab->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 4, 4, 4 }));
auto flamegraph_view = TRY(flamegraph_tab->try_add<FlameGraphView>(profile->model(), ProfileModel::Column::StackFrame, ProfileModel::Column::SampleCount));
@ -256,7 +256,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
timeline_view->on_selection_change = [&] { statusbar_update(); };
flamegraph_view->on_hover_change = [&] { statusbar_update(); };
auto filesystem_events_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("Filesystem events"));
auto filesystem_events_tab = TRY(tab_widget->try_add_tab<GUI::Widget>(TRY("Filesystem events"_string)));
TRY(filesystem_events_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto filesystem_events_tree_view = TRY(filesystem_events_tab->try_add<GUI::TreeView>());

View file

@ -226,7 +226,7 @@ MainWidget::MainWidget()
m_action_tab_widget = find_descendant_of_type_named<GUI::TabWidget>("action_tab_widget"sv);
m_query_results_widget = m_action_tab_widget->add_tab<GUI::Widget>("Results");
m_query_results_widget = m_action_tab_widget->add_tab<GUI::Widget>("Results"_short_string);
m_query_results_widget->set_layout<GUI::VerticalBoxLayout>(6);
m_query_results_table_view = m_query_results_widget->add<GUI::TableView>();
@ -327,7 +327,7 @@ void MainWidget::open_new_script()
auto new_script_name = DeprecatedString::formatted("New Script - {}", m_new_script_counter);
++m_new_script_counter;
auto& editor = m_tab_widget->add_tab<ScriptEditor>(new_script_name);
auto& editor = m_tab_widget->add_tab<ScriptEditor>(String::from_deprecated_string(new_script_name).release_value_but_fixme_should_propagate_errors());
editor.new_script_with_temp_name(new_script_name);
editor.on_cursor_change = [this] { on_editor_change(); };
@ -339,7 +339,7 @@ void MainWidget::open_new_script()
void MainWidget::open_script_from_file(LexicalPath const& file_path)
{
auto& editor = m_tab_widget->add_tab<ScriptEditor>(file_path.title());
auto& editor = m_tab_widget->add_tab<ScriptEditor>(String::from_deprecated_string(file_path.title()).release_value_but_fixme_should_propagate_errors());
if (auto result = editor.open_script_from_file(file_path); result.is_error()) {
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to open {}\n{}", file_path, result.error()));

View file

@ -212,12 +212,12 @@ void ColorPicker::build_ui()
auto& tab_widget = root_container->add<GUI::TabWidget>();
auto& tab_palette = tab_widget.add_tab<Widget>("Palette");
auto& tab_palette = tab_widget.add_tab<Widget>("Palette"_short_string);
tab_palette.set_layout<VerticalBoxLayout>(4, 4);
build_ui_palette(tab_palette);
auto& tab_custom_color = tab_widget.add_tab<Widget>("Custom Color");
auto& tab_custom_color = tab_widget.add_tab<Widget>("Custom Color"_string.release_value_but_fixme_should_propagate_errors());
tab_custom_color.set_layout<VerticalBoxLayout>(4, 4);
build_ui_custom(tab_custom_color);

View file

@ -49,7 +49,7 @@ public:
template<class T, class... Args>
ErrorOr<NonnullRefPtr<T>> add_tab(DeprecatedString title, StringView id, Args&&... args)
{
auto tab = TRY(m_tab_widget->try_add_tab<T>(move(title), forward<Args>(args)...));
auto tab = TRY(m_tab_widget->try_add_tab<T>(TRY(String::from_deprecated_string(title)), forward<Args>(args)...));
TRY(m_tabs.try_set(id, tab));
tab->set_settings_window(*this);
return tab;

View file

@ -56,26 +56,26 @@ public:
void remove_widget(Widget&);
template<class T, class... Args>
ErrorOr<NonnullRefPtr<T>> try_add_tab(DeprecatedString title, Args&&... args)
ErrorOr<NonnullRefPtr<T>> try_add_tab(String title, Args&&... args)
{
auto t = TRY(T::try_create(forward<Args>(args)...));
t->set_title(TRY(String::from_deprecated_string(title)));
t->set_title(move(title));
TRY(try_add_widget(*t));
return *t;
}
template<class T, class... Args>
T& add_tab(DeprecatedString title, Args&&... args)
T& add_tab(String title, Args&&... args)
{
auto t = T::construct(forward<Args>(args)...);
t->set_title(String::from_deprecated_string(title).release_value_but_fixme_should_propagate_errors());
t->set_title(move(title));
add_widget(*t);
return *t;
}
ErrorOr<void> add_tab(NonnullRefPtr<Widget> const& tab, DeprecatedString title)
ErrorOr<void> add_tab(NonnullRefPtr<Widget> const& tab, String title)
{
tab->set_title(TRY(String::from_deprecated_string(title)));
tab->set_title(move(title));
TRY(try_add_widget(*tab));
return {};
}