From 9b4aabbcf9229eadd9c971ec5eb1b9c7fcd99c55 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sun, 15 May 2022 13:19:11 +0100 Subject: [PATCH] PixelPaint: Allow configuring 'new image' defaults This allows you to configure the default name, width, and height of the 'new image' dialog. This is done by editing the config in ~/.config/PixelPaint.ini (no GUI at the moment). Fixes #13967 --- .../Applications/PixelPaint/CreateNewImageDialog.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp index 42bb5a3bd2..50601383a9 100644 --- a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp @@ -5,6 +5,7 @@ */ #include "CreateNewImageDialog.h" +#include #include #include #include @@ -33,6 +34,8 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) m_name_textbox->on_change = [this] { m_image_name = m_name_textbox->text(); }; + auto default_name = Config::read_string("PixelPaint", "NewImage", "Name"); + m_name_textbox->set_text(default_name); auto& width_label = main_widget.add("Width:"); width_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); @@ -72,8 +75,10 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) width_spinbox.set_range(1, 16384); height_spinbox.set_range(1, 16384); - width_spinbox.set_value(510); - height_spinbox.set_value(356); + auto default_width = Config::read_i32("PixelPaint", "NewImage", "Width", 510); + auto default_height = Config::read_i32("PixelPaint", "NewImage", "Height", 356); + width_spinbox.set_value(default_width); + height_spinbox.set_value(default_height); } }