mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:57:44 +00:00
Applications: Fix undefined behavior capturing non-static constexpr
This commit is contained in:
parent
7a538c1e39
commit
064cfd6cb7
2 changed files with 19 additions and 19 deletions
|
@ -43,6 +43,17 @@
|
||||||
#include <LibGfx/TextDirection.h>
|
#include <LibGfx/TextDirection.h>
|
||||||
#include <LibUnicode/CharacterTypes.h>
|
#include <LibUnicode/CharacterTypes.h>
|
||||||
|
|
||||||
|
static constexpr Array pangrams = {
|
||||||
|
"quick fox jumps nightly above wizard",
|
||||||
|
"five quacking zephyrs jolt my wax bed",
|
||||||
|
"pack my box with five dozen liquor jugs",
|
||||||
|
"quick brown fox jumps over the lazy dog",
|
||||||
|
"waxy and quivering jocks fumble the pizza",
|
||||||
|
"~#:[@_1%]*{$2.3}/4^(5'6\")-&|7+8!=<9,0\\>?;",
|
||||||
|
"byxfjärmat föl gick på duvshowen",
|
||||||
|
" "
|
||||||
|
};
|
||||||
|
|
||||||
static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor)
|
static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor)
|
||||||
{
|
{
|
||||||
auto window = GUI::Window::construct(&editor);
|
auto window = GUI::Window::construct(&editor);
|
||||||
|
@ -73,17 +84,6 @@ static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor)
|
||||||
textbox_button_container.set_layout<GUI::HorizontalBoxLayout>();
|
textbox_button_container.set_layout<GUI::HorizontalBoxLayout>();
|
||||||
textbox_button_container.set_fixed_height(22);
|
textbox_button_container.set_fixed_height(22);
|
||||||
|
|
||||||
constexpr Array pangrams = {
|
|
||||||
"quick fox jumps nightly above wizard",
|
|
||||||
"five quacking zephyrs jolt my wax bed",
|
|
||||||
"pack my box with five dozen liquor jugs",
|
|
||||||
"quick brown fox jumps over the lazy dog",
|
|
||||||
"waxy and quivering jocks fumble the pizza",
|
|
||||||
"~#:[@_1%]*{$2.3}/4^(5'6\")-&|7+8!=<9,0\\>?;",
|
|
||||||
"byxfjärmat föl gick på duvshowen",
|
|
||||||
" "
|
|
||||||
};
|
|
||||||
|
|
||||||
auto& preview_textbox = textbox_button_container.add<GUI::TextBox>();
|
auto& preview_textbox = textbox_button_container.add<GUI::TextBox>();
|
||||||
preview_textbox.set_text(pangrams[0]);
|
preview_textbox.set_text(pangrams[0]);
|
||||||
preview_textbox.set_placeholder("Preview text");
|
preview_textbox.set_placeholder("Preview text");
|
||||||
|
|
|
@ -24,6 +24,13 @@ struct Option {
|
||||||
bool default_action;
|
bool default_action;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static constexpr Array<Option, 2> options = {
|
||||||
|
{
|
||||||
|
{ "ASCII String", OPTION_ASCII_STRING, true, true },
|
||||||
|
{ "Hex value", OPTION_HEX_VALUE, true, false },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer, bool& find_all)
|
int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer, bool& find_all)
|
||||||
{
|
{
|
||||||
auto dialog = FindDialog::construct();
|
auto dialog = FindDialog::construct();
|
||||||
|
@ -101,13 +108,6 @@ FindDialog::FindDialog()
|
||||||
m_find_all_button = *main_widget.find_descendant_of_type_named<GUI::Button>("find_all_button");
|
m_find_all_button = *main_widget.find_descendant_of_type_named<GUI::Button>("find_all_button");
|
||||||
m_cancel_button = *main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
|
m_cancel_button = *main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
|
||||||
|
|
||||||
constexpr Array<Option, 2> options = {
|
|
||||||
{
|
|
||||||
{ "ASCII String", OPTION_ASCII_STRING, true, true },
|
|
||||||
{ "Hex value", OPTION_HEX_VALUE, true, false },
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
auto& radio_container = *main_widget.find_descendant_of_type_named<GUI::Widget>("radio_container");
|
auto& radio_container = *main_widget.find_descendant_of_type_named<GUI::Widget>("radio_container");
|
||||||
for (size_t i = 0; i < options.size(); i++) {
|
for (size_t i = 0; i < options.size(); i++) {
|
||||||
auto action = options[i];
|
auto action = options[i];
|
||||||
|
@ -115,7 +115,7 @@ FindDialog::FindDialog()
|
||||||
radio.set_enabled(action.enabled);
|
radio.set_enabled(action.enabled);
|
||||||
radio.set_text(action.title);
|
radio.set_text(action.title);
|
||||||
|
|
||||||
radio.on_checked = [this, i, &options](auto) {
|
radio.on_checked = [this, i](auto) {
|
||||||
m_selected_option = options[i].opt;
|
m_selected_option = options[i].opt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue