more options yippeee!!

This commit is contained in:
Tabby 2026-06-01 17:10:16 +10:00
parent 960c0277ae
commit 278cddcf22
5 changed files with 120 additions and 20 deletions

View file

@ -13,6 +13,15 @@ signal options_changed
@export var warning_color: ColorPickerButton
@export var trans_label: Label
@export var trans_slider: HSlider
@export var warning_h: SpinBox
@export var warning_m: SpinBox
@export var flash_check: CheckButton
@export var before_h: SpinBox
@export var before_m: SpinBox
@export var after_h: SpinBox
@export var after_m: SpinBox
@export var style_dropdown: OptionButton
@export var position_dropdown: OptionButton
func _init() -> void:
@ -57,32 +66,38 @@ func _on_save_button_pressed() -> void:
func _on_visibility_changed() -> void:
#populate form
#print(Data.save.end_time)
sleep_h.value = int(Data.save.end_time/(60*60))
sleep_m.value = int((Data.save.end_time-sleep_h.value*60*60)/60)
duration_h.value = int(Data.save.duration/(60*60))
duration_m.value = int((Data.save.duration-duration_h.value*60*60)/60)
var sleep_dict : Dictionary = Tools.seconds_to_time(int(Data.save.end_time))
sleep_h.value = sleep_dict.get("h")
sleep_m.value = sleep_dict.get("m")
var duration_dict : Dictionary = Tools.seconds_to_time(int(Data.save.duration))
duration_h.value = duration_dict.get("h")
duration_m.value = duration_dict.get("m")
var warning_time_dict : Dictionary = Tools.seconds_to_time(int(Data.save.warning_time))
warning_h.value = warning_time_dict.get("h")
warning_m.value = warning_time_dict.get("m")
var before_time_dict : Dictionary = Tools.seconds_to_time(int(Data.save.before_time))
before_h.value = before_time_dict.get("h")
before_m.value = before_time_dict.get("m")
var after_time_dict : Dictionary = Tools.seconds_to_time(int(Data.save.after_time))
after_h.value = after_time_dict.get("h")
after_m.value = after_time_dict.get("m")
size_slider.value = Data.save.size
bar_color.color = Data.save.bar_color
background_color.color = Data.save.background_color
warning_color.color = Data.save.warning_color
trans_slider.value = Data.save.bar_transparency
flash_check.button_pressed = Data.save.flashing
position_dropdown.select(Data.save.position)
style_dropdown.select(Data.save.progress_style)
pass # Replace with function body.
func _on_duration_value_changed(value: float) -> void:
var duration_seconds : float = 0
duration_seconds += duration_h.value * 60 * 60
duration_seconds += duration_m.value * 60
Data.save.duration = duration_seconds
pass # Replace with function body.
Data.save.duration = Tools.time_to_seconds(int(duration_h.value),int(duration_m.value))
func _on_sleep_value_changed(value: float) -> void:
var end_seconds : float = 0
end_seconds += sleep_h.value * 60 * 60
end_seconds += sleep_m.value * 60
Data.save.end_time = end_seconds
pass # Replace with function body.
Data.save.end_time = Tools.time_to_seconds(int(sleep_h.value),int(sleep_m.value))
func _on_size_slider_value_changed(value: float) -> void:
@ -116,3 +131,31 @@ func _on_warning_color_color_changed(color: Color) -> void:
func _on_trans_slider_value_changed(value: float) -> void:
Data.save.bar_transparency = value
options_changed.emit()
func _on_warning_value_changed(value: float) -> void:
Data.save.warning_time = Tools.time_to_seconds(int(warning_h.value),int(warning_m.value))
func _on_flash_check_toggled(toggled_on: bool) -> void:
Data.save.flashing = toggled_on
func _on_before_value_changed(value: float) -> void:
Data.save.before_time = Tools.time_to_seconds(int(before_h.value),int(before_m.value))
func _on_after_value_changed(value: float) -> void:
Data.save.after_time = Tools.time_to_seconds(int(after_h.value),int(after_m.value))
func _on_style_dropdown_item_selected(index: int) -> void:
if index == 0:
Data.save.progress_style = Data.Styles.Filling
elif index == 1:
Data.save.progress_style = Data.Styles.Filling_Reversed
elif index == 2:
Data.save.progress_style = Data.Styles.Emptying
elif index == 3:
Data.save.progress_style = Data.Styles.Emptying_Reversed
options_changed.emit()