diff options
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/Action.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Breadcrumbbar.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ColorPicker.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/FilePicker.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/FilePicker.h | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/InputBox.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/MessageBox.cpp | 23 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ProcessChooser.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ProcessChooser.h | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/SettingsWindow.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Toolbar.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp | 13 |
13 files changed, 48 insertions, 41 deletions
diff --git a/Userland/Libraries/LibGUI/Action.cpp b/Userland/Libraries/LibGUI/Action.cpp index 95d56aabba..07fbdb41f7 100644 --- a/Userland/Libraries/LibGUI/Action.cpp +++ b/Userland/Libraries/LibGUI/Action.cpp @@ -289,7 +289,7 @@ void Action::set_text(DeprecatedString text) return; m_text = move(text); for_each_toolbar_button([&](auto& button) { - button.set_text_deprecated(m_text); + button.set_text(String::from_deprecated_string(m_text).release_value_but_fixme_should_propagate_errors()); }); for_each_menu_item([&](auto& menu_item) { menu_item.update_from_action({}); diff --git a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp index bbb274afc3..79b83b3d43 100644 --- a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp +++ b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp @@ -75,7 +75,7 @@ void Breadcrumbbar::append_segment(DeprecatedString text, Gfx::Bitmap const* ico { auto& button = add<BreadcrumbButton>(); button.set_button_style(Gfx::ButtonStyle::Coolbar); - button.set_text_deprecated(text); + button.set_text(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors()); button.set_icon(icon); button.set_tooltip(move(tooltip)); button.set_focus_policy(FocusPolicy::TabFocus); diff --git a/Userland/Libraries/LibGUI/ColorPicker.cpp b/Userland/Libraries/LibGUI/ColorPicker.cpp index 68d1dbe01d..0fae2fcb0d 100644 --- a/Userland/Libraries/LibGUI/ColorPicker.cpp +++ b/Userland/Libraries/LibGUI/ColorPicker.cpp @@ -234,14 +234,14 @@ void ColorPicker::build_ui() button_container.layout()->add_spacer(); auto& ok_button = button_container.add<DialogButton>(); - ok_button.set_text_deprecated("OK"); + ok_button.set_text(String::from_utf8_short_string("OK"sv)); ok_button.on_click = [this](auto) { done(ExecResult::OK); }; ok_button.set_default(true); auto& cancel_button = button_container.add<DialogButton>(); - cancel_button.set_text_deprecated("Cancel"); + cancel_button.set_text(String::from_utf8_short_string("Cancel"sv)); cancel_button.on_click = [this](auto) { done(ExecResult::Cancel); }; @@ -416,7 +416,7 @@ void ColorPicker::build_ui_custom(Widget& root_container) make_spinbox(Blue, m_color.blue()); make_spinbox(Alpha, m_color.alpha()); - m_selector_button = vertical_container.add<GUI::Button>("Select on screen"); + m_selector_button = vertical_container.add<GUI::Button>(String::from_utf8("Select on screen"sv).release_value_but_fixme_should_propagate_errors()); m_selector_button->on_click = [this](auto) { auto selector = ColorSelectOverlay::construct(); auto original_color = m_color; diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index ee4203659f..97fb785394 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -217,14 +217,14 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St }; auto& ok_button = *widget->find_descendant_of_type_named<GUI::Button>("ok_button"); - ok_button.set_text_deprecated(ok_button_name(m_mode)); + ok_button.set_text(ok_button_name(m_mode)); ok_button.on_click = [this](auto) { on_file_return(); }; ok_button.set_enabled(m_mode == Mode::OpenFolder || !m_filename_textbox->text().is_empty()); auto& cancel_button = *widget->find_descendant_of_type_named<GUI::Button>("cancel_button"); - cancel_button.set_text_deprecated("Cancel"); + cancel_button.set_text(String::from_utf8_short_string("Cancel"sv)); cancel_button.on_click = [this](auto) { done(ExecResult::Cancel); }; diff --git a/Userland/Libraries/LibGUI/FilePicker.h b/Userland/Libraries/LibGUI/FilePicker.h index 8611aac51b..ad0d8277f1 100644 --- a/Userland/Libraries/LibGUI/FilePicker.h +++ b/Userland/Libraries/LibGUI/FilePicker.h @@ -48,17 +48,17 @@ private: FilePicker(Window* parent_window, Mode type = Mode::Open, StringView filename = "Untitled"sv, StringView path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent, Optional<Vector<FileTypeFilter>> allowed_file_types = {}); - static DeprecatedString ok_button_name(Mode mode) + static String ok_button_name(Mode mode) { switch (mode) { case Mode::Open: case Mode::OpenMultiple: case Mode::OpenFolder: - return "Open"; + return String::from_utf8_short_string("Open"sv); case Mode::Save: - return "Save"; + return String::from_utf8_short_string("Save"sv); default: - return "OK"; + return String::from_utf8_short_string("OK"sv); } } diff --git a/Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp b/Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp index cbdc5b3d18..c4580352b7 100644 --- a/Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp +++ b/Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp @@ -37,7 +37,7 @@ IncrementalSearchBanner::IncrementalSearchBanner(TextEditor& editor) }; m_close_button = find_descendant_of_type_named<Button>("incremental_search_banner_close_button"); - m_close_button->set_text_deprecated("\xE2\x9D\x8C"); + m_close_button->set_text(String::from_utf8_short_string("\xE2\x9D\x8C"sv)); m_close_button->on_click = [this](auto) { hide(); }; diff --git a/Userland/Libraries/LibGUI/InputBox.cpp b/Userland/Libraries/LibGUI/InputBox.cpp index b1948c35ef..e9c690099f 100644 --- a/Userland/Libraries/LibGUI/InputBox.cpp +++ b/Userland/Libraries/LibGUI/InputBox.cpp @@ -107,7 +107,7 @@ void InputBox::build() button_container_inner.layout()->add_spacer(); m_ok_button = button_container_inner.add<DialogButton>(); - m_ok_button->set_text_deprecated("OK"); + m_ok_button->set_text(String::from_utf8_short_string("OK"sv)); m_ok_button->on_click = [this](auto) { dbgln("GUI::InputBox: OK button clicked"); done(ExecResult::OK); @@ -115,7 +115,7 @@ void InputBox::build() m_ok_button->set_default(true); m_cancel_button = button_container_inner.add<DialogButton>(); - m_cancel_button->set_text_deprecated("Cancel"); + m_cancel_button->set_text(String::from_utf8_short_string("Cancel"sv)); m_cancel_button->on_click = [this](auto) { dbgln("GUI::InputBox: Cancel button clicked"); done(ExecResult::Cancel); diff --git a/Userland/Libraries/LibGUI/MessageBox.cpp b/Userland/Libraries/LibGUI/MessageBox.cpp index 1017d540da..53b83eca27 100644 --- a/Userland/Libraries/LibGUI/MessageBox.cpp +++ b/Userland/Libraries/LibGUI/MessageBox.cpp @@ -49,9 +49,12 @@ Dialog::ExecResult MessageBox::ask_about_unsaved_changes(Window* parent_window, if (parent_window) box->set_icon(parent_window->icon()); - box->m_yes_button->set_text_deprecated(path.is_empty() ? "Save As..." : "Save"); - box->m_no_button->set_text_deprecated("Discard"); - box->m_cancel_button->set_text_deprecated("Cancel"); + if (path.is_empty()) + box->m_yes_button->set_text(String::from_utf8("Save As..."sv).release_value_but_fixme_should_propagate_errors()); + else + box->m_yes_button->set_text(String::from_utf8_short_string("Save"sv)); + box->m_no_button->set_text(String::from_utf8_short_string("Discard"sv)); + box->m_cancel_button->set_text(String::from_utf8_short_string("Cancel"sv)); return box->exec(); } @@ -151,11 +154,11 @@ void MessageBox::build() constexpr int button_width = 80; int button_count = 0; - auto add_button = [&](DeprecatedString label, ExecResult result) -> GUI::Button& { + auto add_button = [&](String label, ExecResult result) -> GUI::Button& { auto& button = button_container.add<Button>(); button.set_fixed_width(button_width); - button.set_text_deprecated(label); - button.on_click = [this, label, result](auto) { + button.set_text(move(label)); + button.on_click = [this, result](auto) { done(result); }; ++button_count; @@ -164,13 +167,13 @@ void MessageBox::build() button_container.layout()->add_spacer(); if (should_include_ok_button()) - m_ok_button = add_button("OK", ExecResult::OK); + m_ok_button = add_button(String::from_utf8_short_string("OK"sv), ExecResult::OK); if (should_include_yes_button()) - m_yes_button = add_button("Yes", ExecResult::Yes); + m_yes_button = add_button(String::from_utf8_short_string("Yes"sv), ExecResult::Yes); if (should_include_no_button()) - m_no_button = add_button("No", ExecResult::No); + m_no_button = add_button(String::from_utf8_short_string("No"sv), ExecResult::No); if (should_include_cancel_button()) - m_cancel_button = add_button("Cancel", ExecResult::Cancel); + m_cancel_button = add_button(String::from_utf8_short_string("Cancel"sv), ExecResult::Cancel); button_container.layout()->add_spacer(); int width = (button_count * button_width) + ((button_count - 1) * button_container.layout()->spacing()) + 32; diff --git a/Userland/Libraries/LibGUI/ProcessChooser.cpp b/Userland/Libraries/LibGUI/ProcessChooser.cpp index 82922fb9d9..9368ec3cc2 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.cpp +++ b/Userland/Libraries/LibGUI/ProcessChooser.cpp @@ -15,10 +15,10 @@ namespace GUI { -ProcessChooser::ProcessChooser(StringView window_title, StringView button_label, Gfx::Bitmap const* window_icon, GUI::Window* parent_window) +ProcessChooser::ProcessChooser(StringView window_title, String button_label, Gfx::Bitmap const* window_icon, GUI::Window* parent_window) : Dialog(parent_window) , m_window_title(window_title) - , m_button_label(button_label) + , m_button_label(move(button_label)) , m_window_icon(window_icon) { set_title(m_window_title); @@ -62,7 +62,7 @@ ProcessChooser::ProcessChooser(StringView window_title, StringView button_label, auto index = m_table_view->selection().first(); set_pid_from_index_and_close(index); }; - auto& cancel_button = button_container.add<GUI::Button>("Cancel"); + auto& cancel_button = button_container.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv)); cancel_button.set_fixed_width(80); cancel_button.on_click = [this](auto) { done(ExecResult::Cancel); diff --git a/Userland/Libraries/LibGUI/ProcessChooser.h b/Userland/Libraries/LibGUI/ProcessChooser.h index d684103b03..5c7e79eef3 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.h +++ b/Userland/Libraries/LibGUI/ProcessChooser.h @@ -7,6 +7,7 @@ #pragma once +#include <AK/String.h> #include <LibCore/Timer.h> #include <LibGUI/Dialog.h> #include <LibGUI/RunningProcessesModel.h> @@ -22,14 +23,14 @@ public: pid_t pid() const { return m_pid; } private: - ProcessChooser(StringView window_title = "Process Chooser"sv, StringView button_label = "Select"sv, Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr); + ProcessChooser(StringView window_title = "Process Chooser"sv, String button_label = String::from_utf8_short_string("Select"sv), Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr); void set_pid_from_index_and_close(ModelIndex const&); pid_t m_pid { 0 }; DeprecatedString m_window_title; - DeprecatedString m_button_label; + String m_button_label; RefPtr<Gfx::Bitmap> m_window_icon; RefPtr<TableView> m_table_view; RefPtr<RunningProcessesModel> m_process_model; diff --git a/Userland/Libraries/LibGUI/SettingsWindow.cpp b/Userland/Libraries/LibGUI/SettingsWindow.cpp index 55d827f24c..c121fe6462 100644 --- a/Userland/Libraries/LibGUI/SettingsWindow.cpp +++ b/Userland/Libraries/LibGUI/SettingsWindow.cpp @@ -46,7 +46,7 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(DeprecatedString t button_container->layout()->set_spacing(6); if (show_defaults_button == ShowDefaultsButton::Yes) { - window->m_reset_button = TRY(button_container->try_add<GUI::DialogButton>("Defaults")); + window->m_reset_button = TRY(button_container->try_add<GUI::DialogButton>(TRY(String::from_utf8("Defaults"sv)))); window->m_reset_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) { window->reset_default_values(); }; @@ -54,19 +54,19 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(DeprecatedString t TRY(button_container->layout()->try_add_spacer()); - window->m_ok_button = TRY(button_container->try_add<GUI::DialogButton>("OK")); + window->m_ok_button = TRY(button_container->try_add<GUI::DialogButton>(String::from_utf8_short_string("OK"sv))); window->m_ok_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) { window->apply_settings(); GUI::Application::the()->quit(); }; - window->m_cancel_button = TRY(button_container->try_add<GUI::DialogButton>("Cancel")); + window->m_cancel_button = TRY(button_container->try_add<GUI::DialogButton>(String::from_utf8_short_string("Cancel"sv))); window->m_cancel_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) { window->cancel_settings(); GUI::Application::the()->quit(); }; - window->m_apply_button = TRY(button_container->try_add<GUI::DialogButton>("Apply")); + window->m_apply_button = TRY(button_container->try_add<GUI::DialogButton>(String::from_utf8_short_string("Apply"sv))); window->m_apply_button->set_enabled(false); window->m_apply_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) { window->apply_settings(); diff --git a/Userland/Libraries/LibGUI/Toolbar.cpp b/Userland/Libraries/LibGUI/Toolbar.cpp index 360632c756..b69ca90e57 100644 --- a/Userland/Libraries/LibGUI/Toolbar.cpp +++ b/Userland/Libraries/LibGUI/Toolbar.cpp @@ -56,18 +56,18 @@ private: if (action.icon()) set_icon(action.icon()); else - set_text_deprecated(action.text()); + set_text(String::from_deprecated_string(action.text()).release_value_but_fixme_should_propagate_errors()); set_button_style(Gfx::ButtonStyle::Coolbar); } - virtual void set_text_deprecated(DeprecatedString text) override + virtual void set_text(String text) override { auto const* action = this->action(); VERIFY(action); set_tooltip(tooltip(*action)); if (!action->icon()) - Button::set_text_deprecated(move(text)); + Button::set_text(move(text)); } DeprecatedString tooltip(Action const& action) const diff --git a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp index bd27698c3b..060518ad26 100644 --- a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp +++ b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp @@ -46,12 +46,12 @@ WizardDialog::WizardDialog(Window* parent_window) nav_container_widget.layout()->set_spacing(0); nav_container_widget.layout()->add_spacer(); - m_back_button = nav_container_widget.add<DialogButton>("< Back"); + m_back_button = nav_container_widget.add<DialogButton>(String::from_utf8_short_string("< Back"sv)); m_back_button->on_click = [&](auto) { pop_page(); }; - m_next_button = nav_container_widget.add<DialogButton>("Next >"); + m_next_button = nav_container_widget.add<DialogButton>(String::from_utf8_short_string("Next >"sv)); m_next_button->on_click = [&](auto) { VERIFY(has_pages()); @@ -68,7 +68,7 @@ WizardDialog::WizardDialog(Window* parent_window) auto& button_spacer = nav_container_widget.add<Widget>(); button_spacer.set_fixed_width(10); - m_cancel_button = nav_container_widget.add<DialogButton>("Cancel"); + m_cancel_button = nav_container_widget.add<DialogButton>(String::from_utf8_short_string("Cancel"sv)); m_cancel_button->on_click = [&](auto) { handle_cancel(); }; @@ -122,9 +122,12 @@ void WizardDialog::update_navigation() m_back_button->set_enabled(m_page_stack.size() > 1); if (has_pages()) { m_next_button->set_enabled(current_page().is_final_page() || current_page().can_go_next()); - m_next_button->set_text_deprecated(current_page().is_final_page() ? "Finish" : "Next >"); + if (current_page().is_final_page()) + m_next_button->set_text(String::from_utf8_short_string("Finish"sv)); + else + m_next_button->set_text(String::from_utf8_short_string("Next >"sv)); } else { - m_next_button->set_text_deprecated("Next >"); + m_next_button->set_text(String::from_utf8_short_string("Next >"sv)); m_next_button->set_enabled(false); } } |