Redesign study navigation and light theme
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
extends VBoxContainer
|
||||
|
||||
const Brand := preload("res://scripts/ui/medmind_style.gd")
|
||||
|
||||
var main: Control
|
||||
var theme_toggle: CheckButton
|
||||
var sound_toggle: CheckButton
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
add_theme_constant_override("separation", 18)
|
||||
|
||||
var eyebrow := Label.new()
|
||||
eyebrow.text = "PREFERENCES"
|
||||
eyebrow.add_theme_font_override("font", Brand.font)
|
||||
eyebrow.add_theme_font_size_override("font_size", 14)
|
||||
eyebrow.add_theme_color_override("font_color", Brand.SKY_BLUE)
|
||||
add_child(eyebrow)
|
||||
|
||||
var title := Label.new()
|
||||
title.text = "Settings"
|
||||
title.add_theme_font_override("font", Brand.font)
|
||||
title.add_theme_font_size_override("font_size", 34)
|
||||
add_child(title)
|
||||
|
||||
var subtitle := Label.new()
|
||||
subtitle.text = "Adjust MedMind's appearance and interface sounds."
|
||||
subtitle.add_theme_font_override("font", Brand.font)
|
||||
subtitle.add_theme_font_size_override("font_size", 17)
|
||||
subtitle.add_theme_color_override("font_color", Brand.SLATE)
|
||||
add_child(subtitle)
|
||||
|
||||
var panel := PanelContainer.new()
|
||||
panel.custom_minimum_size = Vector2(520, 0)
|
||||
panel.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
|
||||
panel.add_theme_stylebox_override("panel", Brand.panel_box(UIThemeService.is_dark_mode()))
|
||||
add_child(panel)
|
||||
var content := VBoxContainer.new()
|
||||
content.add_theme_constant_override("separation", 18)
|
||||
panel.add_child(content)
|
||||
|
||||
theme_toggle = CheckButton.new()
|
||||
theme_toggle.text = "Dark mode"
|
||||
theme_toggle.custom_minimum_size = Vector2(0, 52)
|
||||
theme_toggle.toggled.connect(_on_theme_toggled)
|
||||
content.add_child(theme_toggle)
|
||||
|
||||
sound_toggle = CheckButton.new()
|
||||
sound_toggle.text = "Interface sounds"
|
||||
sound_toggle.custom_minimum_size = Vector2(0, 52)
|
||||
sound_toggle.toggled.connect(UISoundService.set_sounds_enabled)
|
||||
content.add_child(sound_toggle)
|
||||
|
||||
UIThemeService.theme_changed.connect(_on_theme_changed)
|
||||
|
||||
|
||||
func on_show(_payload: Variant = null) -> void:
|
||||
theme_toggle.set_pressed_no_signal(UIThemeService.is_dark_mode())
|
||||
sound_toggle.set_pressed_no_signal(UISoundService.are_sounds_enabled())
|
||||
|
||||
|
||||
func _on_theme_toggled(enabled: bool) -> void:
|
||||
UIThemeService.set_dark_mode(enabled)
|
||||
|
||||
|
||||
func _on_theme_changed(is_dark: bool) -> void:
|
||||
theme_toggle.set_pressed_no_signal(is_dark)
|
||||
var panel := theme_toggle.get_parent().get_parent() as PanelContainer
|
||||
if panel != null:
|
||||
panel.add_theme_stylebox_override("panel", Brand.panel_box(is_dark))
|
||||
Reference in New Issue
Block a user