From e0fd5beb36701a73d5dfdc6db7c4398798a79e84 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Sat, 13 Jan 2024 16:38:59 +0000 Subject: [PATCH] LibGUI+Applications: Default the SpinBox min/max to the full int range By default, a SpinBox's value should be unlimited, (or as close as we can get to that,) and then the GML or code can impose a limit if needed. This saves the developer from entering an arbitrary "big" max value when they want the value to have no maximum. I've audited the use of SpinBox and added `min: 0`, and removed a `max`, where appropriate. All existing SpinBoxes constructed in code have a range set explicitly as far as I can tell. --- Userland/Applications/Calendar/AddEventDialog.gml | 1 - Userland/Applications/FontEditor/FontEditorWindow.gml | 1 + Userland/Libraries/LibGUI/FontPickerDialog.gml | 1 + Userland/Libraries/LibGUI/SpinBox.h | 4 ++-- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Userland/Applications/Calendar/AddEventDialog.gml b/Userland/Applications/Calendar/AddEventDialog.gml index 13670d9cac..a0b11f2c9c 100644 --- a/Userland/Applications/Calendar/AddEventDialog.gml +++ b/Userland/Applications/Calendar/AddEventDialog.gml @@ -120,7 +120,6 @@ name: "duration_hour" fixed_size: [50, 20] min: 0 - max: 999999 } @GUI::SpinBox { diff --git a/Userland/Applications/FontEditor/FontEditorWindow.gml b/Userland/Applications/FontEditor/FontEditorWindow.gml index 0909c1ae84..b33efd0992 100644 --- a/Userland/Applications/FontEditor/FontEditorWindow.gml +++ b/Userland/Applications/FontEditor/FontEditorWindow.gml @@ -35,6 +35,7 @@ @GUI::SpinBox { name: "glyph_editor_width_spinbox" preferred_width: "fit" + min: 0 } @GUI::CheckBox { diff --git a/Userland/Libraries/LibGUI/FontPickerDialog.gml b/Userland/Libraries/LibGUI/FontPickerDialog.gml index ddf0fe0afb..854c5381c6 100644 --- a/Userland/Libraries/LibGUI/FontPickerDialog.gml +++ b/Userland/Libraries/LibGUI/FontPickerDialog.gml @@ -48,6 +48,7 @@ @GUI::SpinBox { name: "size_spin_box" + min: 0 } @GUI::ListView { diff --git a/Userland/Libraries/LibGUI/SpinBox.h b/Userland/Libraries/LibGUI/SpinBox.h index c79ed42b35..d288a83975 100644 --- a/Userland/Libraries/LibGUI/SpinBox.h +++ b/Userland/Libraries/LibGUI/SpinBox.h @@ -42,8 +42,8 @@ private: RefPtr