1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 12:17:45 +00:00

LibGUI+Userland: Add _deprecated suffix to AbstractButton::{set_,}text

This commit is contained in:
Karol Kosek 2023-02-12 11:13:18 +01:00 committed by Linus Groh
parent 61b49daf0a
commit d32b052f22
30 changed files with 83 additions and 83 deletions

View file

@ -57,7 +57,7 @@ class ResultRow final : public GUI::Button {
if (!m_context_menu) {
m_context_menu = GUI::Menu::construct();
if (LexicalPath path { text() }; path.is_absolute()) {
if (LexicalPath path { text_deprecated() }; path.is_absolute()) {
m_context_menu->add_action(GUI::Action::create("&Show in File Manager", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv)), [=](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
}));
@ -65,7 +65,7 @@ class ResultRow final : public GUI::Button {
}
m_context_menu->add_action(GUI::Action::create("&Copy as Text", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv)), [&](auto&) {
GUI::Clipboard::the().set_plain_text(text());
GUI::Clipboard::the().set_plain_text(text_deprecated());
}));
}
m_context_menu->popup(event.screen_position());
@ -256,7 +256,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto& result = app_state.results[i];
auto& match = results_container.add<Assistant::ResultRow>();
match.set_icon(result.bitmap());
match.set_text(move(result.title()));
match.set_text_deprecated(move(result.title()));
match.set_tooltip(move(result.tooltip()));
match.on_click = [&result](auto) {
result.activate();

View file

@ -205,7 +205,7 @@ void BookmarksBarWidget::model_did_update(unsigned)
m_bookmarks.append(button);
button.set_button_style(Gfx::ButtonStyle::Coolbar);
button.set_text(title);
button.set_text_deprecated(title);
button.set_icon(g_icon_bag.filetype_html);
button.set_fixed_size(font().width(title) + 32, 20);
button.set_relative_rect(rect);
@ -264,7 +264,7 @@ void BookmarksBarWidget::update_content_size()
for (size_t i = m_last_visible_index; i < m_bookmarks.size(); ++i) {
auto& bookmark = m_bookmarks.at(i);
bookmark.set_visible(false);
m_additional_menu->add_action(GUI::Action::create(bookmark.text(), g_icon_bag.filetype_html, [&](auto&) { bookmark.on_click(0); }));
m_additional_menu->add_action(GUI::Action::create(bookmark.text_deprecated(), g_icon_bag.filetype_html, [&](auto&) { bookmark.on_click(0); }));
}
}
}

View file

@ -153,7 +153,7 @@ void DownloadWidget::did_finish(bool success)
m_browser_image->load_from_file("/res/graphics/download-finished.gif"sv);
window()->set_title("Download finished!");
m_close_button->set_enabled(true);
m_cancel_button->set_text("Open in Folder");
m_cancel_button->set_text_deprecated("Open in Folder");
m_cancel_button->on_click = [this](auto) {
Desktop::Launcher::open(URL::create_with_file_scheme(Core::StandardPaths::downloads_directory(), m_url.basename()));
window()->close();

View file

@ -112,7 +112,7 @@ FindDialog::FindDialog()
auto action = options[i];
auto& radio = radio_container.add<GUI::RadioButton>();
radio.set_enabled(action.enabled);
radio.set_text(action.title);
radio.set_text_deprecated(action.title);
radio.on_checked = [this, i](auto) {
m_selected_option = options[i].opt;

View file

@ -38,13 +38,13 @@ void KeyButton::paint_event(GUI::PaintEvent& event)
painter.draw_rect(key_cap_face_border_rect, Color::from_rgb(0x8C7272), false);
painter.fill_rect(key_cap_face_rect, face_color);
if (text().is_empty() || text().starts_with('\0'))
if (text_deprecated().is_empty() || text_deprecated().starts_with('\0'))
return;
Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text()))), font.glyph_height() };
Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text_deprecated()))), font.glyph_height() };
text_rect.align_within(key_cap_face_rect, Gfx::TextAlignment::Center);
painter.draw_text(text_rect, text(), font, Gfx::TextAlignment::Center, Color::Black, Gfx::TextElision::Right);
painter.draw_text(text_rect, text_deprecated(), font, Gfx::TextAlignment::Center, Color::Black, Gfx::TextElision::Right);
if (is_focused())
painter.draw_rect(text_rect.inflated(6, 4), palette().focus_outline());
}

View file

@ -52,7 +52,7 @@ void KeyboardMapperWidget::create_frame()
auto& tmp_button = main_widget.add<KeyButton>();
tmp_button.set_relative_rect(rect);
tmp_button.set_text(keys[i].name);
tmp_button.set_text_deprecated(keys[i].name);
tmp_button.set_enabled(keys[i].enabled);
tmp_button.on_click = [this, &tmp_button]() {
@ -64,7 +64,7 @@ void KeyboardMapperWidget::create_frame()
auto index = keys[i].map_index;
VERIFY(index > 0);
tmp_button.set_text(value);
tmp_button.set_text_deprecated(value);
u32* map = map_from_name(m_current_map_name);
if (value.length() == 0)
@ -248,7 +248,7 @@ void KeyboardMapperWidget::set_current_map(const DeprecatedString current_map)
StringBuilder sb;
sb.append_code_point(map[index]);
m_keys.at(k)->set_text(sb.to_deprecated_string());
m_keys.at(k)->set_text_deprecated(sb.to_deprecated_string());
}
this->update();

View file

@ -340,11 +340,11 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar)
toolbar.add_separator();
m_show_clipping_paths = toolbar.add<GUI::CheckBox>();
m_show_clipping_paths->set_text("Show clipping paths");
m_show_clipping_paths->set_text_deprecated("Show clipping paths");
m_show_clipping_paths->set_checked(m_viewer->show_clipping_paths(), GUI::AllowCallback::No);
m_show_clipping_paths->on_checked = [&](auto checked) { m_viewer->set_show_clipping_paths(checked); };
m_show_images = toolbar.add<GUI::CheckBox>();
m_show_images->set_text("Show images");
m_show_images->set_text_deprecated("Show images");
m_show_images->set_checked(m_viewer->show_images(), GUI::AllowCallback::No);
m_show_images->on_checked = [&](auto checked) { m_viewer->set_show_images(checked); };
}

View file

@ -111,7 +111,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
};
auto& set_defaults_checkbox = main_widget->add<GUI::CheckBox>();
set_defaults_checkbox.set_text("Use these settings as default");
set_defaults_checkbox.set_text_deprecated("Use these settings as default");
auto& button_container = main_widget->add<GUI::Widget>();
button_container.set_layout<GUI::HorizontalBoxLayout>();

View file

@ -100,7 +100,7 @@ GUI::Widget* EraseTool::get_properties_widget()
auto& use_secondary_color_checkbox = secondary_color_container.add<GUI::CheckBox>();
use_secondary_color_checkbox.set_checked(m_use_secondary_color);
use_secondary_color_checkbox.set_text("Use secondary color");
use_secondary_color_checkbox.set_text_deprecated("Use secondary color");
use_secondary_color_checkbox.on_checked = [&](bool checked) {
m_use_secondary_color = checked;
};

View file

@ -487,7 +487,7 @@ ErrorOr<void> MainWidget::add_property_tab(PropertyTab const& property_tab)
TRY(row_widget->load_from_gml(flag_property_gml));
auto& checkbox = *row_widget->find_descendant_of_type_named<GUI::CheckBox>("checkbox");
checkbox.set_text(to_string(role));
checkbox.set_text_deprecated(to_string(role));
checkbox.on_checked = [&, role](bool checked) {
set_flag(role, checked);
};