diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-09-09 09:13:09 -0400 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-09-11 20:33:57 +0100 |
commit | 8190120f9531693176ca499c12e32f00ac1d76f2 (patch) | |
tree | 37b920bcc3051a3ba78422b20e1c7a31db2e61b1 | |
parent | a2eb42a9c0d3edaebfaaf9a587c5fded825d58f7 (diff) | |
download | serenity-8190120f9531693176ca499c12e32f00ac1d76f2.zip |
LibGUI: Use discovered emoji files as the EmojiInputDialog button icons
Rather than rendering the emoji as text, use the emoji icons themselves.
-rw-r--r-- | Userland/Libraries/LibGUI/EmojiInputDialog.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp index 37eb764ca4..b848f560cd 100644 --- a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp +++ b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp @@ -129,7 +129,7 @@ auto EmojiInputDialog::supported_emoji() -> Vector<Emoji> Vector<Emoji> code_points; Core::DirIterator dt("/res/emoji", Core::DirIterator::SkipDots); while (dt.has_next()) { - auto filename = dt.next_path(); + auto filename = dt.next_full_path(); auto lexical_path = LexicalPath(filename); if (lexical_path.extension() != "png") continue; @@ -157,13 +157,16 @@ auto EmojiInputDialog::supported_emoji() -> Vector<Emoji> // which is a key event with a single code point. StringBuilder builder; builder.append(Utf32View(&code_point, 1)); - auto emoji_text = builder.to_string(); - auto button = Button::construct(move(emoji_text)); + auto bitmap = Gfx::Bitmap::try_load_from_file(filename).release_value_but_fixme_should_propagate_errors(); + resize_bitmap_if_needed(bitmap); + + auto button = Button::construct(); + button->set_icon(bitmap); button->set_fixed_size(button_size, button_size); button->set_button_style(Gfx::ButtonStyle::Coolbar); - button->on_click = [this, button = button](auto) { - m_selected_emoji_text = button->text(); + button->on_click = [this, text = builder.to_string()](auto) { + m_selected_emoji_text = move(text); done(ExecResult::OK); }; |