From 256030da4e7e954e048839771cbc0cbcf1618bbd Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Sun, 26 Mar 2023 00:51:21 +0100 Subject: [PATCH] PixelPaint: Correctly set default layer name Previously, if you confirmed the "new layer" dialog without any change to the layer name, the layer would end up with an empty string for its name. --- Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp | 2 +- Userland/Applications/PixelPaint/CreateNewLayerDialog.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp index a39da30d04..51cbeb6645 100644 --- a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp @@ -28,7 +28,7 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize suggested_size, GUI::Win name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); m_name_textbox = main_widget->add(); - m_name_textbox->set_text("Layer"sv); + m_name_textbox->set_text(default_layer_name); m_name_textbox->select_all(); m_name_textbox->on_change = [this] { m_layer_name = m_name_textbox->text(); diff --git a/Userland/Applications/PixelPaint/CreateNewLayerDialog.h b/Userland/Applications/PixelPaint/CreateNewLayerDialog.h index b28d6a37f6..1c600e2407 100644 --- a/Userland/Applications/PixelPaint/CreateNewLayerDialog.h +++ b/Userland/Applications/PixelPaint/CreateNewLayerDialog.h @@ -18,10 +18,12 @@ public: DeprecatedString const& layer_name() const { return m_layer_name; } private: + static constexpr StringView default_layer_name = "Layer"sv; + CreateNewLayerDialog(Gfx::IntSize suggested_size, GUI::Window* parent_window); Gfx::IntSize m_layer_size; - DeprecatedString m_layer_name; + DeprecatedString m_layer_name { default_layer_name }; RefPtr m_name_textbox; };