diff --git a/data/settings.gd b/data/settings.gd index 3a4aa1e..bc4c7cd 100644 --- a/data/settings.gd +++ b/data/settings.gd @@ -17,6 +17,17 @@ const SERVERS: Array[String] = [ const DEBUG_SERVER: String = "http://localhost:8080" ## The winning score debug builds start with, so a game is quick to win while testing. const DEBUG_WINNING_SCORE: int = 5 +## The quiz settings that are saved to [method quiz_settings_path] and loaded at start. +## Count plays in statistics and Prefer less played soundtracks are left out on purpose. +const QUIZ_SETTINGS: Array[StringName] = [ + &"auto_repeat_song", &"stop_after_current", &"hide_next_track", &"hide_beginning", + &"hide_for_seconds", &"hide_length", &"hide_ticks", &"winning_score", + &"inspiration_list_speed", +] +## When this environment variable is set, the settings file is kept in that folder instead +## of the user's config folder. The tests set it so they never touch the real file. +const CONFIG_DIR_ENV: String = "MUSICPLAYER_CONFIG_DIR" +const QUIZ_SETTINGS_SECTION: String = "quiz" var default_path: String = "https://music.sanplex.xyz" ## Password for getting an API token from the server. Any password works when the @@ -49,13 +60,52 @@ var version: String = ProjectSettings.get_setting("application/config/version", # Autoloads are ready before any scene, so debug builds use the local server and the -# low winning score from the very first request +# low winning score from the very first request. The saved quiz settings come after, so +# the debug winning score is only used until another one is saved. func _ready() -> void: if OS.has_feature("debug"): is_debug = true default_path = DEBUG_SERVER selected_server = SERVERS.find(DEBUG_SERVER) winning_score = DEBUG_WINNING_SCORE + load_quiz_settings() + + +## Where the quiz settings are saved: a MusicPlayer folder in the user's config folder, +## e.g. [code]~/.config[/code] on Linux and [code]%APPDATA%[/code] on Windows. Debug +## builds use a file of their own, so testing never changes the real settings. +func quiz_settings_path() -> String: + var config_dir: String = OS.get_environment(CONFIG_DIR_ENV) + if config_dir.is_empty(): + config_dir = OS.get_config_dir().path_join("MusicPlayer") + var file_name: String = "quiz_settings_debug.cfg" if is_debug else "quiz_settings.cfg" + return config_dir.path_join(file_name) + + +## Loads the saved quiz settings. Settings missing from the file, or saved with the +## wrong type, keep their current value. +func load_quiz_settings() -> void: + var file: ConfigFile = ConfigFile.new() + if file.load(quiz_settings_path()) != OK: + return + for setting: StringName in QUIZ_SETTINGS: + var current: Variant = get(setting) + var saved: Variant = file.get_value(QUIZ_SETTINGS_SECTION, setting, current) + if typeof(saved) == typeof(current): + set(setting, saved) + + +## Saves the quiz settings, so they are the same the next time the game starts. +func save_quiz_settings() -> void: + var path: String = quiz_settings_path() + DirAccess.make_dir_recursive_absolute(path.get_base_dir()) + var file: ConfigFile = ConfigFile.new() + for setting: StringName in QUIZ_SETTINGS: + file.set_value(QUIZ_SETTINGS_SECTION, setting, get(setting)) + var error: Error = file.save(path) + if error != OK: + GameLog.warning("Could not save the quiz settings to %s: %s" + % [path, error_string(error)]) func delete_children(node: Node) -> void: diff --git a/main/MainWindow.tscn b/main/MainWindow.tscn index b3c6ef9..366f148 100644 --- a/main/MainWindow.tscn +++ b/main/MainWindow.tscn @@ -98,9 +98,9 @@ unique_name_in_owner = true visible = false layout_mode = 1 offset_left = 700.0 -offset_top = 454.0 +offset_top = 419.0 offset_right = 700.0 -offset_bottom = 454.0 +offset_bottom = 419.0 [node name="SoundtrackStatsPopup" parent="." unique_id=1213999001 instance=ExtResource("soundtrack_stats_popup_scene")] visible = false diff --git a/popups/SettingsPopup.tscn b/popups/SettingsPopup.tscn index ec1e560..0570563 100644 --- a/popups/SettingsPopup.tscn +++ b/popups/SettingsPopup.tscn @@ -16,7 +16,7 @@ panel = NodePath("SettingsPanel") unique_name_in_owner = true layout_mode = 0 offset_right = 520.0 -offset_bottom = 172.0 +offset_bottom = 242.0 theme_type_variation = &"PopupBackground" [node name="VBoxContainer" type="VBoxContainer" parent="SettingsPanel" unique_id=1796635163] @@ -25,7 +25,7 @@ layout_mode = 0 offset_left = 20.0 offset_top = 12.0 offset_right = 500.0 -offset_bottom = 160.0 +offset_bottom = 230.0 [node name="Label" type="Label" parent="SettingsPanel/VBoxContainer" unique_id=1111531402] layout_mode = 2 @@ -85,6 +85,20 @@ focus_mode = 0 action_mode = 0 text = "+1" +[node name="LowPlayedCheckButton" type="CheckButton" parent="SettingsPanel/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +focus_mode = 0 +action_mode = 0 +text = "Prefer less played soundtracks" + +[node name="AddToDatabaseCheckButton" type="CheckButton" parent="SettingsPanel/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +focus_mode = 0 +action_mode = 0 +text = "Count plays in statistics" + [node name="LocalButton" type="CheckButton" parent="SettingsPanel/VBoxContainer" unique_id=905844805] unique_name_in_owner = true visible = false diff --git a/popups/settings_popup.gd b/popups/settings_popup.gd index c9c0104..5593769 100644 --- a/popups/settings_popup.gd +++ b/popups/settings_popup.gd @@ -1,7 +1,8 @@ class_name SettingsPopup extends BasePopup -## The application settings: which MusicServer to use, fullscreen and how many songs to -## download ahead. Opened from the Settings button in the top bar. +## The application settings: which MusicServer to use, fullscreen, how many songs to +## download ahead, whether to prefer less played soundtracks and whether plays count in +## the statistics. Opened from the Settings button in the top bar. ## ## The quiz settings, such as the winning score, are in [QuizSettingsCard]. @@ -14,6 +15,8 @@ signal server_changed @onready var cache_label: Label = %CacheLabel @onready var lower_cache_button: Button = %LowerCacheButton @onready var increase_cache_button: Button = %IncreaseCacheButton +@onready var low_played_button: CheckButton = %LowPlayedCheckButton +@onready var add_to_database_button: CheckButton = %AddToDatabaseCheckButton @onready var local_button: CheckButton = %LocalButton @@ -29,6 +32,9 @@ func _ready() -> void: lower_cache_button.pressed.connect(lower_cache) increase_cache_button.pressed.connect(increase_cache) select_server_button.item_selected.connect(select_server) + low_played_button.toggled.connect( + func(on: bool) -> void: Settings.use_low_played_mode = on) + add_to_database_button.toggled.connect(func(on: bool) -> void: Settings.add_to_stats = on) visibility_changed.connect(_on_visibility_changed) # Alt+Enter switches fullscreen from the main window, which resizes the window get_window().size_changed.connect(_update_fullscreen_button) @@ -75,9 +81,12 @@ func _use_server(new_server: int) -> void: server_changed.emit() +# Winning a game turns statistics off, so the toggles are refreshed every time this opens func _on_visibility_changed() -> void: if visible: _update_fullscreen_button() + low_played_button.set_pressed_no_signal(Settings.use_low_played_mode) + add_to_database_button.set_pressed_no_signal(Settings.add_to_stats) func _update_fullscreen_button() -> void: diff --git a/quiz/QuizSettingsCard.tscn b/quiz/QuizSettingsCard.tscn index d77c269..d461fad 100644 --- a/quiz/QuizSettingsCard.tscn +++ b/quiz/QuizSettingsCard.tscn @@ -104,20 +104,6 @@ focus_mode = 0 action_mode = 0 text = "Hide ticks in the playbar" -[node name="LowPlayedCheckButton" type="CheckButton" parent="CardPanel/VBox"] -unique_name_in_owner = true -layout_mode = 2 -focus_mode = 0 -action_mode = 0 -text = "Prefer less played soundtracks" - -[node name="AddToDatabaseCheckButton" type="CheckButton" parent="CardPanel/VBox"] -unique_name_in_owner = true -layout_mode = 2 -focus_mode = 0 -action_mode = 0 -text = "Count plays in statistics" - [node name="WinningScoreRow" type="HBoxContainer" parent="CardPanel/VBox"] layout_mode = 2 diff --git a/quiz/quiz_settings_card.gd b/quiz/quiz_settings_card.gd index 3e9f5e4..9df28b2 100644 --- a/quiz/quiz_settings_card.gd +++ b/quiz/quiz_settings_card.gd @@ -1,8 +1,10 @@ class_name QuizSettingsCard extends BasePopup ## The quiz settings, in a small card that opens above the Quiz settings button by the -## music player: how songs are played and hidden, statistics, the winning score and the -## inspiration list. It does not dim the quiz, so it can be changed during a song. +## music player: how songs are played and hidden, the winning score and the inspiration +## list. It does not dim the quiz, so it can be changed during a song. +## +## Every change is saved at once with [method Settings.save_quiz_settings]. ## ## The card's bottom edge is where the card is placed, just above the player bar, and ## it grows upward to fit its rows. @@ -26,8 +28,6 @@ const PADDING: Vector2 = Vector2(16, 12) @onready var increase_hide_for_seconds_button: Button = %IncreaseHideForSecondsButton @onready var hide_length_button: CheckButton = %HideLengthCheckButton @onready var hide_ticks_button: CheckButton = %HideTicksCheckButton -@onready var low_played_button: CheckButton = %LowPlayedCheckButton -@onready var add_to_database_button: CheckButton = %AddToDatabaseCheckButton @onready var score_label: Label = %ScoreLabel @onready var lower_winning_score_button: Button = %LowerButton @onready var increase_winning_score_button: Button = %IncreaseButton @@ -37,17 +37,12 @@ const PADDING: Vector2 = Vector2(16, 12) func _ready() -> void: - auto_repeat_button.toggled.connect(func(on: bool) -> void: Settings.auto_repeat_song = on) - stop_after_current_button.toggled.connect( - func(on: bool) -> void: Settings.stop_after_current = on) - hide_next_track_button.toggled.connect( - func(on: bool) -> void: Settings.hide_next_track = on) + auto_repeat_button.toggled.connect(_save_toggle.bind(&"auto_repeat_song")) + stop_after_current_button.toggled.connect(_save_toggle.bind(&"stop_after_current")) + hide_next_track_button.toggled.connect(_save_toggle.bind(&"hide_next_track")) hide_beginning_button.toggled.connect(_on_hide_beginning_toggled) - hide_length_button.toggled.connect(func(on: bool) -> void: Settings.hide_length = on) - hide_ticks_button.toggled.connect(func(on: bool) -> void: Settings.hide_ticks = on) - low_played_button.toggled.connect( - func(on: bool) -> void: Settings.use_low_played_mode = on) - add_to_database_button.toggled.connect(func(on: bool) -> void: Settings.add_to_stats = on) + hide_length_button.toggled.connect(_save_toggle.bind(&"hide_length")) + hide_ticks_button.toggled.connect(_save_toggle.bind(&"hide_ticks")) lower_winning_score_button.pressed.connect(lower_winning_score) increase_winning_score_button.pressed.connect(increase_winning_score) lower_inspiration_speed_button.pressed.connect(lower_inspiration_speed) @@ -58,8 +53,8 @@ func _ready() -> void: show_settings() -## Shows the current settings. Some change outside this card, e.g. winning turns -## statistics off, so this runs every time the card opens. +## Shows the current settings. This runs every time the card opens, in case a setting +## was changed somewhere else. func show_settings() -> void: auto_repeat_button.set_pressed_no_signal(Settings.auto_repeat_song) stop_after_current_button.set_pressed_no_signal(Settings.stop_after_current) @@ -67,8 +62,6 @@ func show_settings() -> void: hide_beginning_button.set_pressed_no_signal(Settings.hide_beginning) hide_length_button.set_pressed_no_signal(Settings.hide_length) hide_ticks_button.set_pressed_no_signal(Settings.hide_ticks) - low_played_button.set_pressed_no_signal(Settings.use_low_played_mode) - add_to_database_button.set_pressed_no_signal(Settings.add_to_stats) hide_for_seconds_row.visible = Settings.hide_beginning hide_for_seconds_label.text = "%d" % Settings.hide_for_seconds score_label.text = str(Settings.winning_score) @@ -88,30 +81,41 @@ func increase_winning_score() -> void: func set_winning_score(new_score: int) -> void: Settings.winning_score = maxi(new_score, 1) score_label.text = str(Settings.winning_score) + Settings.save_quiz_settings() func lower_inspiration_speed() -> void: Settings.inspiration_list_speed = maxi(Settings.inspiration_list_speed - 1, 1) inspiration_speed_label.text = str(Settings.inspiration_list_speed) + Settings.save_quiz_settings() func increase_inspiration_speed() -> void: Settings.inspiration_list_speed += 1 inspiration_speed_label.text = str(Settings.inspiration_list_speed) + Settings.save_quiz_settings() func lower_hide_for_seconds() -> void: Settings.hide_for_seconds = maxf(Settings.hide_for_seconds - 1.0, 0.0) hide_for_seconds_label.text = "%d" % Settings.hide_for_seconds + Settings.save_quiz_settings() func increase_hide_for_seconds() -> void: Settings.hide_for_seconds = minf(Settings.hide_for_seconds + 1.0, MAX_HIDE_SECONDS) hide_for_seconds_label.text = "%d" % Settings.hide_for_seconds + Settings.save_quiz_settings() + + +# Sets the on/off quiz setting named [param setting] and saves the quiz settings +func _save_toggle(on: bool, setting: StringName) -> void: + Settings.set(setting, on) + Settings.save_quiz_settings() func _on_hide_beginning_toggled(on: bool) -> void: - Settings.hide_beginning = on + _save_toggle(on, &"hide_beginning") hide_for_seconds_row.visible = on _fit_to_rows() diff --git a/run_tests.sh b/run_tests.sh index f4f04d2..3a2f021 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -32,6 +32,11 @@ find_godot() { godot_bin="$(find_godot)" +# Keeps the tests away from the real quiz settings file, see Settings.CONFIG_DIR_ENV +MUSICPLAYER_CONFIG_DIR="$(mktemp -d)" +export MUSICPLAYER_CONFIG_DIR +trap 'rm -rf "$MUSICPLAYER_CONFIG_DIR"' EXIT + paths=("$@") if [[ ${#paths[@]} -eq 0 ]]; then paths=(res://tests/unit res://tests/integration) diff --git a/tests/data/layout_baseline.json b/tests/data/layout_baseline.json index bd254c1..888c950 100644 --- a/tests/data/layout_baseline.json +++ b/tests/data/layout_baseline.json @@ -1317,34 +1317,25 @@ "Quiz/QuizSettingsCard/CardPanel": { "rect": [ 64.0, - 575.0, + 645.0, 440.0, - 409.0 + 339.0 ], "visible": false }, "Quiz/QuizSettingsCard/CardPanel/VBox": { "rect": [ 80.0, - 587.0, + 657.0, 408.0, - 385.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/AddToDatabaseCheckButton": { - "rect": [ - 80.0, - 587.0, - 231.0, - 31.0 + 315.0 ], "visible": false }, "Quiz/QuizSettingsCard/CardPanel/VBox/AutoRepeatCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 140.0, 31.0 ], @@ -1353,7 +1344,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideBeginningCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 263.0, 31.0 ], @@ -1362,7 +1353,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow": { "rect": [ 80.0, - 587.0, + 657.0, 254.0, 31.0 ], @@ -1371,7 +1362,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/HideForSecondsLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -1380,7 +1371,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/IncreaseHideForSecondsButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -1389,7 +1380,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/LowerHideForSecondsButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -1398,7 +1389,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 134.0, 31.0 ], @@ -1407,7 +1398,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideLengthCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 178.0, 31.0 ], @@ -1416,7 +1407,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideNextTrackCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 167.0, 31.0 ], @@ -1425,7 +1416,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideTicksCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 235.0, 31.0 ], @@ -1434,7 +1425,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow": { "rect": [ 80.0, - 587.0, + 657.0, 294.0, 31.0 ], @@ -1443,7 +1434,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/IncreaseInspirationSpeedButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -1452,7 +1443,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/InspirationListSpeedLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -1461,7 +1452,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/LowerInspirationSpeedButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -1470,25 +1461,16 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 174.0, 31.0 ], "visible": false }, - "Quiz/QuizSettingsCard/CardPanel/VBox/LowPlayedCheckButton": { - "rect": [ - 80.0, - 587.0, - 285.0, - 31.0 - ], - "visible": false - }, "Quiz/QuizSettingsCard/CardPanel/VBox/StopAfterCurrentCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 187.0, 31.0 ], @@ -1497,7 +1479,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/TitleLabel": { "rect": [ 80.0, - 587.0, + 657.0, 156.0, 35.0 ], @@ -1506,7 +1488,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow": { "rect": [ 80.0, - 587.0, + 657.0, 242.0, 31.0 ], @@ -1515,7 +1497,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/IncreaseButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -1524,7 +1506,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/LowerButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -1533,7 +1515,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/ScoreLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -1542,7 +1524,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 122.0, 31.0 ], @@ -2091,7 +2073,7 @@ "SettingsPopup": { "rect": [ 700.0, - 454.0, + 419.0, 1920.0, 1080.0 ], @@ -2100,25 +2082,34 @@ "SettingsPopup/SettingsPanel": { "rect": [ 700.0, - 454.0, + 419.0, 520.0, - 172.0 + 242.0 ], "visible": false }, "SettingsPopup/SettingsPanel/VBoxContainer": { "rect": [ 720.0, - 466.0, + 431.0, 480.0, - 148.0 + 218.0 + ], + "visible": false + }, + "SettingsPopup/SettingsPanel/VBoxContainer/AddToDatabaseCheckButton": { + "rect": [ + 720.0, + 431.0, + 231.0, + 31.0 ], "visible": false }, "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow": { "rect": [ 720.0, - 466.0, + 431.0, 331.0, 31.0 ], @@ -2127,7 +2118,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheLabel": { "rect": [ 720.0, - 466.0, + 431.0, 48.0, 23.0 ], @@ -2136,7 +2127,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheTitleLabel": { "rect": [ 720.0, - 466.0, + 431.0, 211.0, 31.0 ], @@ -2145,7 +2136,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/IncreaseCacheButton": { "rect": [ 720.0, - 466.0, + 431.0, 30.0, 31.0 ], @@ -2154,7 +2145,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/LowerCacheButton": { "rect": [ 720.0, - 466.0, + 431.0, 30.0, 31.0 ], @@ -2163,7 +2154,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/FullscreenButton": { "rect": [ 720.0, - 466.0, + 431.0, 127.0, 31.0 ], @@ -2172,7 +2163,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/Label": { "rect": [ 720.0, - 466.0, + 431.0, 97.0, 35.0 ], @@ -2181,16 +2172,25 @@ "SettingsPopup/SettingsPanel/VBoxContainer/LocalButton": { "rect": [ 720.0, - 466.0, + 431.0, 89.0, 31.0 ], "visible": false }, + "SettingsPopup/SettingsPanel/VBoxContainer/LowPlayedCheckButton": { + "rect": [ + 720.0, + 431.0, + 285.0, + 31.0 + ], + "visible": false + }, "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow": { "rect": [ 720.0, - 466.0, + 431.0, 106.0, 31.0 ], @@ -2199,7 +2199,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/SelectServerButton": { "rect": [ 720.0, - 466.0, + 431.0, 40.0, 20.0 ], @@ -2208,7 +2208,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/Title": { "rect": [ 720.0, - 466.0, + 431.0, 62.0, 31.0 ], @@ -4937,34 +4937,25 @@ "Quiz/QuizSettingsCard/CardPanel": { "rect": [ 64.0, - 575.0, + 645.0, 440.0, - 409.0 + 339.0 ], "visible": false }, "Quiz/QuizSettingsCard/CardPanel/VBox": { "rect": [ 80.0, - 587.0, + 657.0, 408.0, - 385.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/AddToDatabaseCheckButton": { - "rect": [ - 80.0, - 587.0, - 231.0, - 31.0 + 315.0 ], "visible": false }, "Quiz/QuizSettingsCard/CardPanel/VBox/AutoRepeatCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 140.0, 31.0 ], @@ -4973,7 +4964,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideBeginningCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 263.0, 31.0 ], @@ -4982,7 +4973,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow": { "rect": [ 80.0, - 587.0, + 657.0, 254.0, 31.0 ], @@ -4991,7 +4982,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/HideForSecondsLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -5000,7 +4991,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/IncreaseHideForSecondsButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -5009,7 +5000,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/LowerHideForSecondsButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -5018,7 +5009,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 134.0, 31.0 ], @@ -5027,7 +5018,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideLengthCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 178.0, 31.0 ], @@ -5036,7 +5027,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideNextTrackCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 167.0, 31.0 ], @@ -5045,7 +5036,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideTicksCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 235.0, 31.0 ], @@ -5054,7 +5045,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow": { "rect": [ 80.0, - 587.0, + 657.0, 294.0, 31.0 ], @@ -5063,7 +5054,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/IncreaseInspirationSpeedButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -5072,7 +5063,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/InspirationListSpeedLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -5081,7 +5072,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/LowerInspirationSpeedButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -5090,25 +5081,16 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 174.0, 31.0 ], "visible": false }, - "Quiz/QuizSettingsCard/CardPanel/VBox/LowPlayedCheckButton": { - "rect": [ - 80.0, - 587.0, - 285.0, - 31.0 - ], - "visible": false - }, "Quiz/QuizSettingsCard/CardPanel/VBox/StopAfterCurrentCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 187.0, 31.0 ], @@ -5117,7 +5099,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/TitleLabel": { "rect": [ 80.0, - 587.0, + 657.0, 156.0, 35.0 ], @@ -5126,7 +5108,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow": { "rect": [ 80.0, - 587.0, + 657.0, 242.0, 31.0 ], @@ -5135,7 +5117,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/IncreaseButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -5144,7 +5126,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/LowerButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -5153,7 +5135,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/ScoreLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -5162,7 +5144,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 122.0, 31.0 ], @@ -5711,7 +5693,7 @@ "SettingsPopup": { "rect": [ 700.0, - 454.0, + 419.0, 1920.0, 1080.0 ], @@ -5720,25 +5702,34 @@ "SettingsPopup/SettingsPanel": { "rect": [ 700.0, - 454.0, + 419.0, 520.0, - 172.0 + 242.0 ], "visible": false }, "SettingsPopup/SettingsPanel/VBoxContainer": { "rect": [ 720.0, - 466.0, + 431.0, 480.0, - 148.0 + 218.0 + ], + "visible": false + }, + "SettingsPopup/SettingsPanel/VBoxContainer/AddToDatabaseCheckButton": { + "rect": [ + 720.0, + 431.0, + 231.0, + 31.0 ], "visible": false }, "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow": { "rect": [ 720.0, - 466.0, + 431.0, 331.0, 31.0 ], @@ -5747,7 +5738,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheLabel": { "rect": [ 720.0, - 466.0, + 431.0, 48.0, 23.0 ], @@ -5756,7 +5747,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheTitleLabel": { "rect": [ 720.0, - 466.0, + 431.0, 211.0, 31.0 ], @@ -5765,7 +5756,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/IncreaseCacheButton": { "rect": [ 720.0, - 466.0, + 431.0, 30.0, 31.0 ], @@ -5774,7 +5765,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/LowerCacheButton": { "rect": [ 720.0, - 466.0, + 431.0, 30.0, 31.0 ], @@ -5783,7 +5774,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/FullscreenButton": { "rect": [ 720.0, - 466.0, + 431.0, 127.0, 31.0 ], @@ -5792,7 +5783,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/Label": { "rect": [ 720.0, - 466.0, + 431.0, 97.0, 35.0 ], @@ -5801,16 +5792,25 @@ "SettingsPopup/SettingsPanel/VBoxContainer/LocalButton": { "rect": [ 720.0, - 466.0, + 431.0, 89.0, 31.0 ], "visible": false }, + "SettingsPopup/SettingsPanel/VBoxContainer/LowPlayedCheckButton": { + "rect": [ + 720.0, + 431.0, + 285.0, + 31.0 + ], + "visible": false + }, "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow": { "rect": [ 720.0, - 466.0, + 431.0, 106.0, 31.0 ], @@ -5819,7 +5819,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/SelectServerButton": { "rect": [ 720.0, - 466.0, + 431.0, 40.0, 20.0 ], @@ -5828,7 +5828,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/Title": { "rect": [ 720.0, - 466.0, + 431.0, 62.0, 31.0 ], @@ -8674,34 +8674,25 @@ "Quiz/QuizSettingsCard/CardPanel": { "rect": [ 64.0, - 575.0, + 645.0, 440.0, - 409.0 + 339.0 ], "visible": false }, "Quiz/QuizSettingsCard/CardPanel/VBox": { "rect": [ 80.0, - 587.0, + 657.0, 408.0, - 385.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/AddToDatabaseCheckButton": { - "rect": [ - 80.0, - 587.0, - 231.0, - 31.0 + 315.0 ], "visible": false }, "Quiz/QuizSettingsCard/CardPanel/VBox/AutoRepeatCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 140.0, 31.0 ], @@ -8710,7 +8701,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideBeginningCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 263.0, 31.0 ], @@ -8719,7 +8710,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow": { "rect": [ 80.0, - 587.0, + 657.0, 254.0, 31.0 ], @@ -8728,7 +8719,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/HideForSecondsLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -8737,7 +8728,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/IncreaseHideForSecondsButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -8746,7 +8737,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/LowerHideForSecondsButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -8755,7 +8746,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 134.0, 31.0 ], @@ -8764,7 +8755,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideLengthCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 178.0, 31.0 ], @@ -8773,7 +8764,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideNextTrackCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 167.0, 31.0 ], @@ -8782,7 +8773,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideTicksCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 235.0, 31.0 ], @@ -8791,7 +8782,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow": { "rect": [ 80.0, - 587.0, + 657.0, 294.0, 31.0 ], @@ -8800,7 +8791,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/IncreaseInspirationSpeedButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -8809,7 +8800,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/InspirationListSpeedLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -8818,7 +8809,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/LowerInspirationSpeedButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -8827,25 +8818,16 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 174.0, 31.0 ], "visible": false }, - "Quiz/QuizSettingsCard/CardPanel/VBox/LowPlayedCheckButton": { - "rect": [ - 80.0, - 587.0, - 285.0, - 31.0 - ], - "visible": false - }, "Quiz/QuizSettingsCard/CardPanel/VBox/StopAfterCurrentCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 187.0, 31.0 ], @@ -8854,7 +8836,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/TitleLabel": { "rect": [ 80.0, - 587.0, + 657.0, 156.0, 35.0 ], @@ -8863,7 +8845,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow": { "rect": [ 80.0, - 587.0, + 657.0, 242.0, 31.0 ], @@ -8872,7 +8854,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/IncreaseButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -8881,7 +8863,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/LowerButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -8890,7 +8872,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/ScoreLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -8899,7 +8881,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 122.0, 31.0 ], @@ -9448,7 +9430,7 @@ "SettingsPopup": { "rect": [ 700.0, - 454.0, + 419.0, 1920.0, 1080.0 ], @@ -9457,25 +9439,34 @@ "SettingsPopup/SettingsPanel": { "rect": [ 700.0, - 454.0, + 419.0, 520.0, - 172.0 + 242.0 ], "visible": false }, "SettingsPopup/SettingsPanel/VBoxContainer": { "rect": [ 720.0, - 466.0, + 431.0, 480.0, - 148.0 + 218.0 + ], + "visible": false + }, + "SettingsPopup/SettingsPanel/VBoxContainer/AddToDatabaseCheckButton": { + "rect": [ + 720.0, + 431.0, + 231.0, + 31.0 ], "visible": false }, "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow": { "rect": [ 720.0, - 466.0, + 431.0, 331.0, 31.0 ], @@ -9484,7 +9475,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheLabel": { "rect": [ 720.0, - 466.0, + 431.0, 48.0, 23.0 ], @@ -9493,7 +9484,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheTitleLabel": { "rect": [ 720.0, - 466.0, + 431.0, 211.0, 31.0 ], @@ -9502,7 +9493,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/IncreaseCacheButton": { "rect": [ 720.0, - 466.0, + 431.0, 30.0, 31.0 ], @@ -9511,7 +9502,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/LowerCacheButton": { "rect": [ 720.0, - 466.0, + 431.0, 30.0, 31.0 ], @@ -9520,7 +9511,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/FullscreenButton": { "rect": [ 720.0, - 466.0, + 431.0, 127.0, 31.0 ], @@ -9529,7 +9520,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/Label": { "rect": [ 720.0, - 466.0, + 431.0, 97.0, 35.0 ], @@ -9538,16 +9529,25 @@ "SettingsPopup/SettingsPanel/VBoxContainer/LocalButton": { "rect": [ 720.0, - 466.0, + 431.0, 89.0, 31.0 ], "visible": false }, + "SettingsPopup/SettingsPanel/VBoxContainer/LowPlayedCheckButton": { + "rect": [ + 720.0, + 431.0, + 285.0, + 31.0 + ], + "visible": false + }, "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow": { "rect": [ 720.0, - 466.0, + 431.0, 106.0, 31.0 ], @@ -9556,7 +9556,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/SelectServerButton": { "rect": [ 720.0, - 466.0, + 431.0, 40.0, 20.0 ], @@ -9565,7 +9565,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/Title": { "rect": [ 720.0, - 466.0, + 431.0, 62.0, 31.0 ], @@ -11591,103 +11591,22 @@ "Quiz/QuizSettingsCard/CardPanel": { "rect": [ 64.0, - 575.0, + 645.0, 440.0, - 409.0 + 339.0 ], "visible": true }, "Quiz/QuizSettingsCard/CardPanel/VBox": { "rect": [ 80.0, - 587.0, + 657.0, 408.0, - 385.0 - ], - "visible": true - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/AddToDatabaseCheckButton": { - "rect": [ - 80.0, - 871.0, - 408.0, - 31.0 + 315.0 ], "visible": true }, "Quiz/QuizSettingsCard/CardPanel/VBox/AutoRepeatCheckButton": { - "rect": [ - 80.0, - 626.0, - 408.0, - 31.0 - ], - "visible": true - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideBeginningCheckButton": { - "rect": [ - 80.0, - 731.0, - 408.0, - 31.0 - ], - "visible": true - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow": { - "rect": [ - 80.0, - 587.0, - 254.0, - 31.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/HideForSecondsLabel": { - "rect": [ - 80.0, - 587.0, - 48.0, - 23.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/IncreaseHideForSecondsButton": { - "rect": [ - 80.0, - 587.0, - 30.0, - 31.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/LowerHideForSecondsButton": { - "rect": [ - 80.0, - 587.0, - 30.0, - 31.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/Title": { - "rect": [ - 80.0, - 587.0, - 134.0, - 31.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideLengthCheckButton": { - "rect": [ - 80.0, - 766.0, - 408.0, - 31.0 - ], - "visible": true - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideNextTrackCheckButton": { "rect": [ 80.0, 696.0, @@ -11696,7 +11615,7 @@ ], "visible": true }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideTicksCheckButton": { + "Quiz/QuizSettingsCard/CardPanel/VBox/HideBeginningCheckButton": { "rect": [ 80.0, 801.0, @@ -11705,6 +11624,78 @@ ], "visible": true }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow": { + "rect": [ + 80.0, + 657.0, + 254.0, + 31.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/HideForSecondsLabel": { + "rect": [ + 80.0, + 657.0, + 48.0, + 23.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/IncreaseHideForSecondsButton": { + "rect": [ + 80.0, + 657.0, + 30.0, + 31.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/LowerHideForSecondsButton": { + "rect": [ + 80.0, + 657.0, + 30.0, + 31.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/Title": { + "rect": [ + 80.0, + 657.0, + 134.0, + 31.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideLengthCheckButton": { + "rect": [ + 80.0, + 836.0, + 408.0, + 31.0 + ], + "visible": true + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideNextTrackCheckButton": { + "rect": [ + 80.0, + 766.0, + 408.0, + 31.0 + ], + "visible": true + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideTicksCheckButton": { + "rect": [ + 80.0, + 871.0, + 408.0, + 31.0 + ], + "visible": true + }, "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow": { "rect": [ 80.0, @@ -11750,19 +11741,10 @@ ], "visible": true }, - "Quiz/QuizSettingsCard/CardPanel/VBox/LowPlayedCheckButton": { - "rect": [ - 80.0, - 836.0, - 408.0, - 31.0 - ], - "visible": true - }, "Quiz/QuizSettingsCard/CardPanel/VBox/StopAfterCurrentCheckButton": { "rect": [ 80.0, - 661.0, + 731.0, 408.0, 31.0 ], @@ -11771,7 +11753,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/TitleLabel": { "rect": [ 80.0, - 587.0, + 657.0, 408.0, 35.0 ], @@ -12353,7 +12335,7 @@ "SettingsPopup": { "rect": [ 700.0, - 454.0, + 419.0, 1920.0, 1080.0 ], @@ -12362,67 +12344,31 @@ "SettingsPopup/SettingsPanel": { "rect": [ 700.0, - 454.0, + 419.0, 520.0, - 172.0 + 242.0 ], "visible": true }, "SettingsPopup/SettingsPanel/VBoxContainer": { "rect": [ 720.0, - 466.0, + 431.0, 480.0, - 148.0 + 218.0 + ], + "visible": true + }, + "SettingsPopup/SettingsPanel/VBoxContainer/AddToDatabaseCheckButton": { + "rect": [ + 720.0, + 610.0, + 480.0, + 31.0 ], "visible": true }, "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow": { - "rect": [ - 720.0, - 575.0, - 480.0, - 31.0 - ], - "visible": true - }, - "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheLabel": { - "rect": [ - 1084.0, - 579.0, - 48.0, - 23.0 - ], - "visible": true - }, - "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheTitleLabel": { - "rect": [ - 720.0, - 575.0, - 360.0, - 31.0 - ], - "visible": true - }, - "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/IncreaseCacheButton": { - "rect": [ - 1170.0, - 575.0, - 30.0, - 31.0 - ], - "visible": true - }, - "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/LowerCacheButton": { - "rect": [ - 1136.0, - 575.0, - 30.0, - 31.0 - ], - "visible": true - }, - "SettingsPopup/SettingsPanel/VBoxContainer/FullscreenButton": { "rect": [ 720.0, 540.0, @@ -12431,10 +12377,55 @@ ], "visible": true }, + "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheLabel": { + "rect": [ + 1084.0, + 544.0, + 48.0, + 23.0 + ], + "visible": true + }, + "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheTitleLabel": { + "rect": [ + 720.0, + 540.0, + 360.0, + 31.0 + ], + "visible": true + }, + "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/IncreaseCacheButton": { + "rect": [ + 1170.0, + 540.0, + 30.0, + 31.0 + ], + "visible": true + }, + "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/LowerCacheButton": { + "rect": [ + 1136.0, + 540.0, + 30.0, + 31.0 + ], + "visible": true + }, + "SettingsPopup/SettingsPanel/VBoxContainer/FullscreenButton": { + "rect": [ + 720.0, + 505.0, + 480.0, + 31.0 + ], + "visible": true + }, "SettingsPopup/SettingsPanel/VBoxContainer/Label": { "rect": [ 720.0, - 466.0, + 431.0, 480.0, 35.0 ], @@ -12443,16 +12434,25 @@ "SettingsPopup/SettingsPanel/VBoxContainer/LocalButton": { "rect": [ 720.0, - 466.0, + 431.0, 89.0, 31.0 ], "visible": false }, + "SettingsPopup/SettingsPanel/VBoxContainer/LowPlayedCheckButton": { + "rect": [ + 720.0, + 575.0, + 480.0, + 31.0 + ], + "visible": true + }, "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow": { "rect": [ 720.0, - 505.0, + 470.0, 480.0, 31.0 ], @@ -12461,7 +12461,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/SelectServerButton": { "rect": [ 786.0, - 505.0, + 470.0, 414.0, 31.0 ], @@ -12470,7 +12470,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/Title": { "rect": [ 720.0, - 505.0, + 470.0, 62.0, 31.0 ], @@ -15515,34 +15515,25 @@ "Quiz/QuizSettingsCard/CardPanel": { "rect": [ 64.0, - 575.0, + 645.0, 440.0, - 409.0 + 339.0 ], "visible": false }, "Quiz/QuizSettingsCard/CardPanel/VBox": { "rect": [ 80.0, - 587.0, + 657.0, 408.0, - 385.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/AddToDatabaseCheckButton": { - "rect": [ - 80.0, - 587.0, - 231.0, - 31.0 + 315.0 ], "visible": false }, "Quiz/QuizSettingsCard/CardPanel/VBox/AutoRepeatCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 140.0, 31.0 ], @@ -15551,7 +15542,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideBeginningCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 263.0, 31.0 ], @@ -15560,7 +15551,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow": { "rect": [ 80.0, - 587.0, + 657.0, 254.0, 31.0 ], @@ -15569,7 +15560,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/HideForSecondsLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -15578,7 +15569,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/IncreaseHideForSecondsButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -15587,7 +15578,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/LowerHideForSecondsButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -15596,7 +15587,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 134.0, 31.0 ], @@ -15605,7 +15596,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideLengthCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 178.0, 31.0 ], @@ -15614,7 +15605,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideNextTrackCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 167.0, 31.0 ], @@ -15623,7 +15614,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/HideTicksCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 235.0, 31.0 ], @@ -15632,7 +15623,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow": { "rect": [ 80.0, - 587.0, + 657.0, 294.0, 31.0 ], @@ -15641,7 +15632,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/IncreaseInspirationSpeedButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -15650,7 +15641,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/InspirationListSpeedLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -15659,7 +15650,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/LowerInspirationSpeedButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -15668,25 +15659,16 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 174.0, 31.0 ], "visible": false }, - "Quiz/QuizSettingsCard/CardPanel/VBox/LowPlayedCheckButton": { - "rect": [ - 80.0, - 587.0, - 285.0, - 31.0 - ], - "visible": false - }, "Quiz/QuizSettingsCard/CardPanel/VBox/StopAfterCurrentCheckButton": { "rect": [ 80.0, - 587.0, + 657.0, 187.0, 31.0 ], @@ -15695,7 +15677,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/TitleLabel": { "rect": [ 80.0, - 587.0, + 657.0, 156.0, 35.0 ], @@ -15704,7 +15686,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow": { "rect": [ 80.0, - 587.0, + 657.0, 242.0, 31.0 ], @@ -15713,7 +15695,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/IncreaseButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -15722,7 +15704,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/LowerButton": { "rect": [ 80.0, - 587.0, + 657.0, 30.0, 31.0 ], @@ -15731,7 +15713,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/ScoreLabel": { "rect": [ 80.0, - 587.0, + 657.0, 48.0, 23.0 ], @@ -15740,7 +15722,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/WinningScoreRow/Title": { "rect": [ 80.0, - 587.0, + 657.0, 122.0, 31.0 ], @@ -16289,7 +16271,7 @@ "SettingsPopup": { "rect": [ 700.0, - 454.0, + 419.0, 1920.0, 1080.0 ], @@ -16298,25 +16280,34 @@ "SettingsPopup/SettingsPanel": { "rect": [ 700.0, - 454.0, + 419.0, 520.0, - 172.0 + 242.0 ], "visible": false }, "SettingsPopup/SettingsPanel/VBoxContainer": { "rect": [ 720.0, - 466.0, + 431.0, 480.0, - 148.0 + 218.0 + ], + "visible": false + }, + "SettingsPopup/SettingsPanel/VBoxContainer/AddToDatabaseCheckButton": { + "rect": [ + 720.0, + 431.0, + 231.0, + 31.0 ], "visible": false }, "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow": { "rect": [ 720.0, - 466.0, + 431.0, 331.0, 31.0 ], @@ -16325,7 +16316,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheLabel": { "rect": [ 720.0, - 466.0, + 431.0, 48.0, 23.0 ], @@ -16334,7 +16325,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheTitleLabel": { "rect": [ 720.0, - 466.0, + 431.0, 211.0, 31.0 ], @@ -16343,7 +16334,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/IncreaseCacheButton": { "rect": [ 720.0, - 466.0, + 431.0, 30.0, 31.0 ], @@ -16352,7 +16343,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/LowerCacheButton": { "rect": [ 720.0, - 466.0, + 431.0, 30.0, 31.0 ], @@ -16361,7 +16352,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/FullscreenButton": { "rect": [ 720.0, - 466.0, + 431.0, 127.0, 31.0 ], @@ -16370,7 +16361,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/Label": { "rect": [ 720.0, - 466.0, + 431.0, 97.0, 35.0 ], @@ -16379,16 +16370,25 @@ "SettingsPopup/SettingsPanel/VBoxContainer/LocalButton": { "rect": [ 720.0, - 466.0, + 431.0, 89.0, 31.0 ], "visible": false }, + "SettingsPopup/SettingsPanel/VBoxContainer/LowPlayedCheckButton": { + "rect": [ + 720.0, + 431.0, + 285.0, + 31.0 + ], + "visible": false + }, "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow": { "rect": [ 720.0, - 466.0, + 431.0, 106.0, 31.0 ], @@ -16397,7 +16397,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/SelectServerButton": { "rect": [ 720.0, - 466.0, + 431.0, 40.0, 20.0 ], @@ -16406,7 +16406,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/Title": { "rect": [ 720.0, - 466.0, + 431.0, 62.0, 31.0 ], @@ -23389,103 +23389,22 @@ "Quiz/QuizSettingsCard/CardPanel": { "rect": [ 64.0, - 575.0, + 645.0, 440.0, - 409.0 + 339.0 ], "visible": false }, "Quiz/QuizSettingsCard/CardPanel/VBox": { "rect": [ 80.0, - 587.0, + 657.0, 408.0, - 385.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/AddToDatabaseCheckButton": { - "rect": [ - 80.0, - 871.0, - 408.0, - 31.0 + 315.0 ], "visible": false }, "Quiz/QuizSettingsCard/CardPanel/VBox/AutoRepeatCheckButton": { - "rect": [ - 80.0, - 626.0, - 408.0, - 31.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideBeginningCheckButton": { - "rect": [ - 80.0, - 731.0, - 408.0, - 31.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow": { - "rect": [ - 80.0, - 587.0, - 254.0, - 31.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/HideForSecondsLabel": { - "rect": [ - 80.0, - 587.0, - 48.0, - 23.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/IncreaseHideForSecondsButton": { - "rect": [ - 80.0, - 587.0, - 30.0, - 31.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/LowerHideForSecondsButton": { - "rect": [ - 80.0, - 587.0, - 30.0, - 31.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/Title": { - "rect": [ - 80.0, - 587.0, - 134.0, - 31.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideLengthCheckButton": { - "rect": [ - 80.0, - 766.0, - 408.0, - 31.0 - ], - "visible": false - }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideNextTrackCheckButton": { "rect": [ 80.0, 696.0, @@ -23494,7 +23413,7 @@ ], "visible": false }, - "Quiz/QuizSettingsCard/CardPanel/VBox/HideTicksCheckButton": { + "Quiz/QuizSettingsCard/CardPanel/VBox/HideBeginningCheckButton": { "rect": [ 80.0, 801.0, @@ -23503,6 +23422,78 @@ ], "visible": false }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow": { + "rect": [ + 80.0, + 657.0, + 254.0, + 31.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/HideForSecondsLabel": { + "rect": [ + 80.0, + 657.0, + 48.0, + 23.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/IncreaseHideForSecondsButton": { + "rect": [ + 80.0, + 657.0, + 30.0, + 31.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/LowerHideForSecondsButton": { + "rect": [ + 80.0, + 657.0, + 30.0, + 31.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideForSecondsRow/Title": { + "rect": [ + 80.0, + 657.0, + 134.0, + 31.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideLengthCheckButton": { + "rect": [ + 80.0, + 836.0, + 408.0, + 31.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideNextTrackCheckButton": { + "rect": [ + 80.0, + 766.0, + 408.0, + 31.0 + ], + "visible": false + }, + "Quiz/QuizSettingsCard/CardPanel/VBox/HideTicksCheckButton": { + "rect": [ + 80.0, + 871.0, + 408.0, + 31.0 + ], + "visible": false + }, "Quiz/QuizSettingsCard/CardPanel/VBox/InspirationRow": { "rect": [ 80.0, @@ -23548,19 +23539,10 @@ ], "visible": false }, - "Quiz/QuizSettingsCard/CardPanel/VBox/LowPlayedCheckButton": { - "rect": [ - 80.0, - 836.0, - 408.0, - 31.0 - ], - "visible": false - }, "Quiz/QuizSettingsCard/CardPanel/VBox/StopAfterCurrentCheckButton": { "rect": [ 80.0, - 661.0, + 731.0, 408.0, 31.0 ], @@ -23569,7 +23551,7 @@ "Quiz/QuizSettingsCard/CardPanel/VBox/TitleLabel": { "rect": [ 80.0, - 587.0, + 657.0, 408.0, 35.0 ], @@ -24226,7 +24208,7 @@ "SettingsPopup": { "rect": [ 700.0, - 454.0, + 419.0, 1920.0, 1080.0 ], @@ -24235,67 +24217,31 @@ "SettingsPopup/SettingsPanel": { "rect": [ 700.0, - 454.0, + 419.0, 520.0, - 172.0 + 242.0 ], "visible": false }, "SettingsPopup/SettingsPanel/VBoxContainer": { "rect": [ 720.0, - 466.0, + 431.0, 480.0, - 148.0 + 218.0 + ], + "visible": false + }, + "SettingsPopup/SettingsPanel/VBoxContainer/AddToDatabaseCheckButton": { + "rect": [ + 720.0, + 610.0, + 480.0, + 31.0 ], "visible": false }, "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow": { - "rect": [ - 720.0, - 575.0, - 480.0, - 31.0 - ], - "visible": false - }, - "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheLabel": { - "rect": [ - 1084.0, - 579.0, - 48.0, - 23.0 - ], - "visible": false - }, - "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheTitleLabel": { - "rect": [ - 720.0, - 575.0, - 360.0, - 31.0 - ], - "visible": false - }, - "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/IncreaseCacheButton": { - "rect": [ - 1170.0, - 575.0, - 30.0, - 31.0 - ], - "visible": false - }, - "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/LowerCacheButton": { - "rect": [ - 1136.0, - 575.0, - 30.0, - 31.0 - ], - "visible": false - }, - "SettingsPopup/SettingsPanel/VBoxContainer/FullscreenButton": { "rect": [ 720.0, 540.0, @@ -24304,10 +24250,55 @@ ], "visible": false }, + "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheLabel": { + "rect": [ + 1084.0, + 544.0, + 48.0, + 23.0 + ], + "visible": false + }, + "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/CacheTitleLabel": { + "rect": [ + 720.0, + 540.0, + 360.0, + 31.0 + ], + "visible": false + }, + "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/IncreaseCacheButton": { + "rect": [ + 1170.0, + 540.0, + 30.0, + 31.0 + ], + "visible": false + }, + "SettingsPopup/SettingsPanel/VBoxContainer/CacheRow/LowerCacheButton": { + "rect": [ + 1136.0, + 540.0, + 30.0, + 31.0 + ], + "visible": false + }, + "SettingsPopup/SettingsPanel/VBoxContainer/FullscreenButton": { + "rect": [ + 720.0, + 505.0, + 480.0, + 31.0 + ], + "visible": false + }, "SettingsPopup/SettingsPanel/VBoxContainer/Label": { "rect": [ 720.0, - 466.0, + 431.0, 480.0, 35.0 ], @@ -24316,16 +24307,25 @@ "SettingsPopup/SettingsPanel/VBoxContainer/LocalButton": { "rect": [ 720.0, - 466.0, + 431.0, 89.0, 31.0 ], "visible": false }, + "SettingsPopup/SettingsPanel/VBoxContainer/LowPlayedCheckButton": { + "rect": [ + 720.0, + 575.0, + 480.0, + 31.0 + ], + "visible": false + }, "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow": { "rect": [ 720.0, - 505.0, + 470.0, 480.0, 31.0 ], @@ -24334,7 +24334,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/SelectServerButton": { "rect": [ 786.0, - 505.0, + 470.0, 414.0, 31.0 ], @@ -24343,7 +24343,7 @@ "SettingsPopup/SettingsPanel/VBoxContainer/ServerRow/Title": { "rect": [ 720.0, - 505.0, + 470.0, 62.0, 31.0 ], diff --git a/tests/integration/test_quiz_settings_card.gd b/tests/integration/test_quiz_settings_card.gd index bf303ed..be5ef68 100644 --- a/tests/integration/test_quiz_settings_card.gd +++ b/tests/integration/test_quiz_settings_card.gd @@ -69,8 +69,6 @@ func test_each_toggle_changes_its_setting() -> void: "hide_beginning_button": "hide_beginning", "hide_length_button": "hide_length", "hide_ticks_button": "hide_ticks", - "low_played_button": "use_low_played_mode", - "add_to_database_button": "add_to_stats", } await _open() for button_name: String in toggles: @@ -89,12 +87,12 @@ func test_each_toggle_changes_its_setting() -> void: func test_card_shows_settings_changed_elsewhere() -> void: await _open() _card.close() - Settings.add_to_stats = false + Settings.hide_next_track = false Settings.auto_repeat_song = false await _open() - assert_bool(_card.add_to_database_button.button_pressed).is_false() + assert_bool(_card.hide_next_track_button.button_pressed).is_false() assert_bool(_card.auto_repeat_button.button_pressed).is_false() @@ -158,3 +156,24 @@ func test_card_grows_upward_for_the_seconds_row() -> void: assert_float(open_row.size.y).is_greater(closed_row.size.y) # Every row stays inside the card assert_bool(open_row.encloses(_card.rows.get_global_rect())).is_true() + + +func test_statistics_settings_are_in_the_settings_popup_instead() -> void: + await _open() + + assert_object(_card.find_child("LowPlayedCheckButton")).is_null() + assert_object(_card.find_child("AddToDatabaseCheckButton")).is_null() + + +func test_changes_are_saved_at_once() -> void: + Settings.hide_next_track = true + Settings.winning_score = 20 + await _open() + + await _click_at(_card.hide_next_track_button.get_global_rect().get_center()) + _card.lower_winning_score_button.pressed.emit() + + var saved: ConfigFile = ConfigFile.new() + assert_int(saved.load(Settings.quiz_settings_path())).is_equal(OK) + assert_bool(saved.get_value("quiz", "hide_next_track")).is_false() + assert_int(saved.get_value("quiz", "winning_score")).is_equal(19) diff --git a/tests/integration/test_settings_popup.gd b/tests/integration/test_settings_popup.gd new file mode 100644 index 0000000..fe9d3d5 --- /dev/null +++ b/tests/integration/test_settings_popup.gd @@ -0,0 +1,55 @@ +extends MainWindowTestSuite +## The statistics settings in the application Settings popup. + +var _popup: SettingsPopup + + +func before_test() -> void: + super() + _popup = _window.get_node("SettingsPopup") + + +func test_less_played_toggle_changes_the_setting() -> void: + Settings.use_low_played_mode = false + _popup.open() + await _runner.simulate_frames(1) + assert_bool(_popup.low_played_button.button_pressed).is_false() + + await _click_at(_popup.low_played_button.get_global_rect().get_center()) + + assert_bool(Settings.use_low_played_mode).is_true() + + +func test_statistics_toggle_changes_the_setting() -> void: + Settings.add_to_stats = true + _popup.open() + await _runner.simulate_frames(1) + assert_bool(_popup.add_to_database_button.button_pressed).is_true() + + await _click_at(_popup.add_to_database_button.get_global_rect().get_center()) + + assert_bool(Settings.add_to_stats).is_false() + + +func test_statistics_settings_are_not_saved_with_the_quiz_settings() -> void: + Settings.add_to_stats = false + Settings.use_low_played_mode = true + + Settings.save_quiz_settings() + + var saved: ConfigFile = ConfigFile.new() + assert_int(saved.load(Settings.quiz_settings_path())).is_equal(OK) + assert_bool(saved.has_section_key("quiz", "add_to_stats")).is_false() + assert_bool(saved.has_section_key("quiz", "use_low_played_mode")).is_false() + + +func test_popup_fits_its_rows_and_is_centred() -> void: + _popup.open() + await _runner.simulate_frames(1) + + var panel: Rect2 = _popup.settings_panel.get_global_rect() + var rows: Control = _popup.settings_panel.get_node("VBoxContainer") + assert_bool(panel.encloses(rows.get_global_rect())).is_true() + # The rows' own height fits, so the last toggle is not squeezed or cut off + assert_float(rows.get_combined_minimum_size().y).is_less_equal(rows.size.y) + assert_vector(panel.get_center()).is_equal(Vector2(960, 540)) diff --git a/tests/integration/test_settings_popup.gd.uid b/tests/integration/test_settings_popup.gd.uid new file mode 100644 index 0000000..a84d06f --- /dev/null +++ b/tests/integration/test_settings_popup.gd.uid @@ -0,0 +1 @@ +uid://cp3f85h44jh3x diff --git a/tests/integration/test_stats_after_win.gd b/tests/integration/test_stats_after_win.gd index 9e5e1bc..e4c5a0e 100644 --- a/tests/integration/test_stats_after_win.gd +++ b/tests/integration/test_stats_after_win.gd @@ -12,7 +12,7 @@ func before_test() -> void: func _stats_checkbox() -> CheckButton: - return _quiz.get_node("QuizSettingsCard").get_node("%AddToDatabaseCheckButton") + return _window.get_node("SettingsPopup").get_node("%AddToDatabaseCheckButton") func test_winning_turns_statistics_off() -> void: @@ -41,7 +41,7 @@ func test_statistics_turned_off_by_hand_stay_off_after_reset() -> void: func test_settings_checkbox_shows_statistics_off_after_win() -> void: await _give_point_with_keybind(1) - _press("QuizSettingsButton") + (_window.get_node("SettingsPopup") as SettingsPopup).open() assert_bool(_stats_checkbox().button_pressed).is_false() diff --git a/tests/unit/test_quiz_settings_file.gd b/tests/unit/test_quiz_settings_file.gd new file mode 100644 index 0000000..b105d62 --- /dev/null +++ b/tests/unit/test_quiz_settings_file.gd @@ -0,0 +1,97 @@ +extends GdUnitTestSuite +## Saving the quiz settings to a file in the config folder and loading them back. + +const SAVED_VALUES: Dictionary = { + &"auto_repeat_song": false, &"stop_after_current": false, &"hide_next_track": false, + &"hide_beginning": true, &"hide_for_seconds": 7.0, &"hide_length": true, + &"hide_ticks": true, &"winning_score": 13, &"inspiration_list_speed": 4, +} + +var _snapshot: AutoloadSnapshot +var _config_dir_before: String +var _config_dir: String + + +func before_test() -> void: + _snapshot = AutoloadSnapshot.take([Settings]) + _config_dir_before = OS.get_environment(Settings.CONFIG_DIR_ENV) + _config_dir = create_temp_dir("quiz_settings_file") + OS.set_environment(Settings.CONFIG_DIR_ENV, _config_dir) + DirAccess.remove_absolute(Settings.quiz_settings_path()) + + +func after_test() -> void: + OS.set_environment(Settings.CONFIG_DIR_ENV, _config_dir_before) + _snapshot.restore() + + +func _set_settings(values: Dictionary) -> void: + for setting: StringName in values: + Settings.set(setting, values[setting]) + + +func test_saved_settings_load_back() -> void: + _set_settings(SAVED_VALUES) + Settings.save_quiz_settings() + _snapshot.restore() + + Settings.load_quiz_settings() + + for setting: StringName in SAVED_VALUES: + assert_that(Settings.get(setting)).override_failure_message(setting) \ + .is_equal(SAVED_VALUES[setting]) + + +func test_every_quiz_setting_is_saved() -> void: + assert_array(Settings.QUIZ_SETTINGS).contains_exactly_in_any_order(SAVED_VALUES.keys()) + + +func test_missing_file_keeps_the_current_settings() -> void: + Settings.winning_score = 9 + + Settings.load_quiz_settings() + + assert_int(Settings.winning_score).is_equal(9) + + +func test_value_of_the_wrong_type_is_ignored() -> void: + var file: ConfigFile = ConfigFile.new() + file.set_value("quiz", "winning_score", "lots") + file.set_value("quiz", "hide_ticks", true) + DirAccess.make_dir_recursive_absolute(Settings.quiz_settings_path().get_base_dir()) + file.save(Settings.quiz_settings_path()) + Settings.winning_score = 9 + Settings.hide_ticks = false + + Settings.load_quiz_settings() + + assert_int(Settings.winning_score).is_equal(9) + assert_bool(Settings.hide_ticks).is_true() + + +func test_statistics_settings_are_not_saved() -> void: + Settings.save_quiz_settings() + + var file: ConfigFile = ConfigFile.new() + file.load(Settings.quiz_settings_path()) + assert_bool(file.has_section_key("quiz", "add_to_stats")).is_false() + assert_bool(file.has_section_key("quiz", "use_low_played_mode")).is_false() + + +func test_file_is_in_the_folder_from_the_environment() -> void: + assert_str(Settings.quiz_settings_path().get_base_dir()).is_equal(_config_dir) + + +func test_file_is_in_the_config_folder_without_the_environment() -> void: + OS.unset_environment(Settings.CONFIG_DIR_ENV) + + assert_str(Settings.quiz_settings_path().get_base_dir()) \ + .is_equal(OS.get_config_dir().path_join("MusicPlayer")) + + +func test_debug_builds_use_a_file_of_their_own() -> void: + Settings.is_debug = true + var debug_path: String = Settings.quiz_settings_path() + Settings.is_debug = false + + assert_str(debug_path).is_not_equal(Settings.quiz_settings_path()) diff --git a/tests/unit/test_quiz_settings_file.gd.uid b/tests/unit/test_quiz_settings_file.gd.uid new file mode 100644 index 0000000..441a662 --- /dev/null +++ b/tests/unit/test_quiz_settings_file.gd.uid @@ -0,0 +1 @@ +uid://5qjw3px3wve6 diff --git a/tools/take_screenshots.gd b/tools/take_screenshots.gd index 1ac2973..7c60034 100644 --- a/tools/take_screenshots.gd +++ b/tools/take_screenshots.gd @@ -2,7 +2,10 @@ extends SceneTree ## Takes a screenshot of the main window in every UiTour state, against a fake server. ## ## Usage: -## godot --path . -s tools/take_screenshots.gd -- +## MUSICPLAYER_CONFIG_DIR=$(mktemp -d) godot --path . -s tools/take_screenshots.gd -- +## +## Setting [code]MUSICPLAYER_CONFIG_DIR[/code] keeps your saved quiz settings out of the +## pictures. ## ## Writes [code].png[/code] for each state and [code]layout.json[/code] with where ## every node is in each state. With [code]--headless[/code] only the layout is written.