1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 23:58:11 +00:00

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
This commit is contained in:
MacDue 2022-05-15 13:19:11 +01:00 committed by Andreas Kling
parent b7ffb2bde7
commit 9b4aabbcf9

View file

@ -5,6 +5,7 @@
*/
#include "CreateNewImageDialog.h"
#include <LibConfig/Client.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/Label.h>
@ -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<GUI::Label>("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);
}
}