mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:17:46 +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
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue