Split settings into a quiz card and an application Settings popup
Build / test (push) Successful in 44s
Build / build (push) Successful in 1m13s

- A Quiz settings button under the player bar opens a small card above
  it with the quiz settings, including Auto repeat, which moves there
  from under the player bar. The card does not dim the quiz, so it can
  be changed during a song, and grows to fit its rows.
- A Settings button in the top bar opens the application settings:
  server, fullscreen and songs to download ahead. Quick sync is gone,
  as the server no longer has it, and the server list is in Settings.
- Labels use sentence case, and seconds to hide show as whole numbers.
- Debug builds switch to the local server and a low winning score in
  the Settings autoload, before any scene asks the server for anything.
  The DEBUG label moves to the top bar, so it shows on every tab.
- Search moves from the top bar back to the quiz toolbar, as the
  Statistics tab has its own search.
This commit is contained in:
Sansan committed 2026-10-07 16:05:13 +02:00
1 parent 8d21b0617d
commit b510aa47f2
34 files changed
+3074 -2525

No files matched your search

+19
View File
@@ -8,6 +8,15 @@ const MAX_NUMBER_OF_PLAYERS: int = 7
## but apart, e.g. "lttp" for "A Link to the Past". Shorter searches only find names
## that contain the text, since a letter or two in order matches most of the library.
const LETTERS_FOR_LOOSE_SEARCH: int = 3
## The MusicServers that can be picked in the settings.
const SERVERS: Array[String] = [
"https://music.sanplex.xyz", "https://tmusic.sanplex.xyz", "https://rmusic.sanplex.xyz",
"https://old-music.sanplex.xyz", "http://localhost:8080",
]
## The server debug builds use.
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
var default_path: String = "https://music.sanplex.xyz"
## Password for getting an API token from the server. Any password works when the
@@ -39,6 +48,16 @@ var character_select_open: bool = false
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
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
func delete_children(node: Node) -> void:
for n: Node in node.get_children():
node.remove_child(n)
+13
View File
@@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
<g fill="#f9f9f9">
<rect x="11.75" y="2.5" width="4.5" height="5" rx="1"/>
<rect x="11.75" y="2.5" width="4.5" height="5" rx="1" transform="rotate(45 14 14)"/>
<rect x="11.75" y="2.5" width="4.5" height="5" rx="1" transform="rotate(90 14 14)"/>
<rect x="11.75" y="2.5" width="4.5" height="5" rx="1" transform="rotate(135 14 14)"/>
<rect x="11.75" y="2.5" width="4.5" height="5" rx="1" transform="rotate(180 14 14)"/>
<rect x="11.75" y="2.5" width="4.5" height="5" rx="1" transform="rotate(225 14 14)"/>
<rect x="11.75" y="2.5" width="4.5" height="5" rx="1" transform="rotate(270 14 14)"/>
<rect x="11.75" y="2.5" width="4.5" height="5" rx="1" transform="rotate(315 14 14)"/>
</g>
<circle cx="14" cy="14" r="6.5" fill="none" stroke="#f9f9f9" stroke-width="4"/>
</svg>

After

Width:  |  Height:  |  Size: 889 B

+43
View File
@@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bylmore1gmmnr"
path="res://.godot/imported/settings_light_icon.svg-2b0876b2265a32eb81d9266290ab6204.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icons/settings_light_icon.svg"
dest_files=["res://.godot/imported/settings_light_icon.svg-2b0876b2265a32eb81d9266290ab6204.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
+10
View File
@@ -11,6 +11,7 @@
[ext_resource type="PackedScene" uid="uid://bijh5h5yrivm3" path="res://popups/LogPopup.tscn" id="14_26rwn"]
[ext_resource type="PackedScene" path="res://statistics/StatisticsView.tscn" id="statistics_view_scene"]
[ext_resource type="PackedScene" path="res://popups/SoundtrackStatsPopup.tscn" id="soundtrack_stats_popup_scene"]
[ext_resource type="PackedScene" uid="uid://dldpeo5y3l5hq" path="res://popups/SettingsPopup.tscn" id="settings_popup_scene"]
[node name="MainWindow" type="Control" unique_id=407149696]
layout_mode = 3
@@ -92,6 +93,15 @@ offset_top = 190.0
offset_right = 1310.0
offset_bottom = 890.0
[node name="SettingsPopup" parent="." unique_id=1323246978 instance=ExtResource("settings_popup_scene")]
unique_name_in_owner = true
visible = false
layout_mode = 1
offset_left = 700.0
offset_top = 454.0
offset_right = 700.0
offset_bottom = 454.0
[node name="SoundtrackStatsPopup" parent="." unique_id=1213999001 instance=ExtResource("soundtrack_stats_popup_scene")]
visible = false
layout_mode = 1
+21 -19
View File
@@ -2,14 +2,6 @@
[ext_resource type="Script" path="res://main/top_bar.gd" id="top_bar_script"]
[sub_resource type="InputEventKey" id="InputEventKey_ujjlu"]
device = -1
alt_pressed = true
keycode = 83
[sub_resource type="Shortcut" id="Shortcut_fbju4"]
events = [SubResource("InputEventKey_ujjlu")]
[sub_resource type="ButtonGroup" id="ButtonGroup_tabs"]
[node name="TopBar" type="Control" unique_id=1489162753]
@@ -36,17 +28,18 @@ size_flags_horizontal = 0
theme_type_variation = &"Title"
text = "Music Player Randomizer"
[node name="SyncButton" type="Button" parent="." unique_id=1228313556]
[node name="DebugLabel" type="Label" parent="." unique_id=1959221257]
visible = false
layout_mode = 0
offset_left = 1538.0
offset_top = 8.0
offset_right = 1608.0
offset_bottom = 48.0
focus_mode = 0
action_mode = 0
text = "Sync"
offset_left = 384.0
offset_top = 12.0
offset_right = 470.0
offset_bottom = 50.0
theme_type_variation = &"HighlightLarge"
text = "DEBUG"
vertical_alignment = 1
[node name="SearchButton" type="Button" parent="." unique_id=1782453581]
[node name="SyncButton" type="Button" parent="." unique_id=1228313556]
layout_mode = 0
offset_left = 1450.0
offset_top = 8.0
@@ -54,8 +47,17 @@ offset_right = 1520.0
offset_bottom = 48.0
focus_mode = 0
action_mode = 0
shortcut = SubResource("Shortcut_fbju4")
text = "Search"
text = "Sync"
[node name="SettingsButton" type="Button" parent="." unique_id=1228313557]
layout_mode = 0
offset_left = 1538.0
offset_top = 8.0
offset_right = 1608.0
offset_bottom = 48.0
focus_mode = 0
action_mode = 0
text = "Settings"
[node name="ShortcutsButton" type="Button" parent="." unique_id=2066498226]
layout_mode = 0
+13 -2
View File
@@ -16,6 +16,7 @@ var popup_backdrop: PopupBackdrop
@onready var qr_popup: QRPopup = %QRPopup
@onready var about_popup: AboutPopup = %AboutPopup
@onready var log_popup: LogPopup = %LogPopup
@onready var settings_popup: SettingsPopup = %SettingsPopup
@onready var statistics_view: StatisticsView = $StatisticsView
@onready var soundtrack_stats_popup: SoundtrackStatsPopup = $SoundtrackStatsPopup
@@ -24,12 +25,15 @@ func _ready() -> void:
popup_backdrop = PopupBackdrop.add_to(self, _popups())
if OS.has_feature("macos"):
GameLog.debug("is_mac")
top_bar.search_pressed.connect(show_search)
quiz.search_pressed.connect(show_search)
top_bar.sync_pressed.connect(sync_soundtracks)
top_bar.tab_selected.connect(show_tab)
top_bar.shortcuts_pressed.connect(show_shortcuts)
top_bar.about_pressed.connect(show_about)
top_bar.qr_pressed.connect(show_qr)
top_bar.settings_pressed.connect(settings_popup.open)
settings_popup.server_changed.connect(quiz.on_server_changed)
settings_popup.visibility_changed.connect(_on_settings_popup_visibility_changed)
sync_popup.sync_started.connect(_on_sync_started)
sync_popup.sync_finished.connect(_on_sync_finished)
@@ -57,7 +61,14 @@ func _input(event: InputEvent) -> void:
func _popups() -> Array[BasePopup]:
return [search_popup, sync_popup, qr_popup, shortcuts_popup, about_popup, log_popup,
soundtrack_stats_popup]
soundtrack_stats_popup, settings_popup]
# How many songs to download ahead can be changed in the settings. Waiting until the
# settings are closed avoids starting downloads while the number is clicked up and down.
func _on_settings_popup_visibility_changed() -> void:
if !settings_popup.visible:
quiz.song_loader.fill_cache()
func show_search() -> void:
+5 -2
View File
@@ -3,8 +3,8 @@ extends Control
## The bar along the top of the main window, with the title, the Quiz and Statistics tabs
## and the buttons for things that are not part of a quiz.
signal search_pressed
signal sync_pressed
signal settings_pressed
signal shortcuts_pressed
signal about_pressed
signal qr_pressed
@@ -12,13 +12,16 @@ signal qr_pressed
signal tab_selected(tab: StringName)
@onready var sync_button: Button = $SyncButton
@onready var debug_label: Label = $DebugLabel
@onready var quiz_tab: Button = $QuizTab
@onready var statistics_tab: Button = $StatisticsTab
func _ready() -> void:
$SearchButton.pressed.connect(search_pressed.emit)
# Debug builds use the local server, see Settings
debug_label.visible = Settings.is_debug
sync_button.pressed.connect(sync_pressed.emit)
$SettingsButton.pressed.connect(settings_pressed.emit)
$ShortcutsButton.pressed.connect(shortcuts_pressed.emit)
$AboutButton.pressed.connect(about_pressed.emit)
$QRButton.pressed.connect(qr_pressed.emit)
-10
View File
@@ -95,13 +95,3 @@ unique_name_in_owner = true
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
size_flags_vertical = 4
[node name="RepeatSongCheckButton" type="CheckButton" parent="."]
layout_mode = 0
offset_top = 40.0
offset_right = 144.0
offset_bottom = 71.0
focus_mode = 0
button_pressed = true
action_mode = 0
text = "Auto repeat"
+2 -8
View File
@@ -1,7 +1,7 @@
class_name MusicPlayer
extends Control
## The bar that plays the songs, with play, restart, progress and volume, and the
## auto repeat switch under it.
## The bar that plays the songs, with play, restart, progress and volume. Whether a song
## repeats is a quiz setting ([code]Settings.auto_repeat_song[/code]).
signal update_song_list
signal play_next_song
@@ -22,7 +22,6 @@ var song_finished: bool = false
@onready var progress_slider: HSlider = %MusicPlayerSlider
@onready var volume_slider: VolumeSlider = %VolumeSlider
@onready var music_time_label: Label = %MusicTimeLabel
@onready var auto_repeat_button: CheckButton = $RepeatSongCheckButton
func _ready() -> void:
@@ -32,11 +31,6 @@ func _ready() -> void:
progress_slider.drag_ended.connect(_on_drag_ended)
audio_player.finished.connect(_on_finished)
auto_repeat_button.pressed.connect(_on_auto_repeat_pressed)
func _on_auto_repeat_pressed() -> void:
Settings.auto_repeat_song = !Settings.auto_repeat_song
func _process(_delta: float) -> void:
+49 -211
View File
@@ -15,241 +15,79 @@ panel = NodePath("SettingsPanel")
[node name="SettingsPanel" type="Panel" parent="." unique_id=45537159]
unique_name_in_owner = true
layout_mode = 0
offset_right = 500.0
offset_bottom = 640.0
offset_right = 520.0
offset_bottom = 172.0
theme_type_variation = &"PopupBackground"
[node name="ScrollContainer" type="ScrollContainer" parent="SettingsPanel" unique_id=1325795358]
[node name="VBoxContainer" type="VBoxContainer" parent="SettingsPanel" unique_id=1796635163]
unique_name_in_owner = true
layout_mode = 0
offset_left = 20.0
offset_top = 8.0
offset_right = 480.0
offset_bottom = 632.0
horizontal_scroll_mode = 0
offset_top = 12.0
offset_right = 500.0
offset_bottom = 160.0
[node name="VBoxContainer" type="VBoxContainer" parent="SettingsPanel/ScrollContainer" unique_id=1796635163]
clip_contents = true
[node name="Label" type="Label" parent="SettingsPanel/VBoxContainer" unique_id=1111531402]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1111531402]
layout_mode = 2
size_flags_vertical = 0
theme_type_variation = &"Title"
text = "Settings"
horizontal_alignment = 1
[node name="StopAfterCurrentCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=508305575]
[node name="ServerRow" type="HBoxContainer" parent="SettingsPanel/VBoxContainer" unique_id=434350695]
layout_mode = 2
[node name="Title" type="Label" parent="SettingsPanel/VBoxContainer/ServerRow" unique_id=434350696]
layout_mode = 2
theme_type_variation = &"SettingsRowLabel"
text = "Server"
[node name="SelectServerButton" type="OptionButton" parent="SettingsPanel/VBoxContainer/ServerRow" unique_id=434350694]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
button_pressed = true
action_mode = 0
text = "Stop after current"
focus_mode = 0
[node name="HideNextTrackCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1568244599]
[node name="FullscreenButton" type="CheckButton" parent="SettingsPanel/VBoxContainer" unique_id=400304684]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
button_pressed = true
action_mode = 0
text = "Hide next track"
[node name="AddToDatabaseCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1673750542]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
action_mode = 0
text = "Turn on played to database"
[node name="LowPlayedCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1672657048]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
action_mode = 0
text = "Use low played mode"
[node name="HideBeginningCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1370617867]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
action_mode = 0
text = "Hide beginning of songs"
[node name="HideForSecondsHBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1368485120]
unique_name_in_owner = true
layout_mode = 2
[node name="HideForSecondsTitle" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/HideForSecondsHBoxContainer" unique_id=1822369383]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Hide Start Seconds: "
[node name="HideForSecondsLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/HideForSecondsHBoxContainer" unique_id=1580108945]
unique_name_in_owner = true
custom_minimum_size = Vector2(48, 0)
layout_mode = 2
text = "5.0"
horizontal_alignment = 1
[node name="LowerHideForSecondsButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/HideForSecondsHBoxContainer" unique_id=180643442]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "-1"
[node name="IncreaseHideForSecondsButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/HideForSecondsHBoxContainer" unique_id=340681770]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "+1"
[node name="HideLengthCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=67806372]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
action_mode = 0
text = "Hide length of songs"
[node name="HideTicksCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=706322752]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
action_mode = 0
text = "Hide ticks in playbar"
[node name="HBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=2140610992]
layout_mode = 2
[node name="Label2" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/HBoxContainer" unique_id=1892907487]
layout_mode = 2
size_flags_horizontal = 3
text = "Winning Score: "
[node name="ScoreLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/HBoxContainer" unique_id=444542662]
unique_name_in_owner = true
custom_minimum_size = Vector2(48, 0)
layout_mode = 2
text = "20"
horizontal_alignment = 1
[node name="LowerButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/HBoxContainer" unique_id=614806355]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "-1"
[node name="IncreaseButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/HBoxContainer" unique_id=1837169457]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "+1"
[node name="CacheHBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=658210492]
layout_mode = 2
[node name="CacheTitleLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/CacheHBoxContainer" unique_id=365012193]
layout_mode = 2
size_flags_horizontal = 3
text = "Predownload songs: "
[node name="CacheLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/CacheHBoxContainer" unique_id=1558370172]
unique_name_in_owner = true
custom_minimum_size = Vector2(48, 0)
layout_mode = 2
text = "1"
horizontal_alignment = 1
[node name="LowerCacheButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/CacheHBoxContainer" unique_id=1990385038]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "-1"
[node name="IncreaseCacheButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/CacheHBoxContainer" unique_id=1806295533]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "+1"
[node name="InspirationHBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1686756540]
layout_mode = 2
[node name="InspirationListSpeedTitle" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer" unique_id=1397861506]
layout_mode = 2
size_flags_horizontal = 3
text = "Inspiration List Speed: "
[node name="InspirationListSpeedLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer" unique_id=867387668]
unique_name_in_owner = true
custom_minimum_size = Vector2(48, 0)
layout_mode = 2
text = "1"
horizontal_alignment = 1
[node name="LowerInspirationSpeedButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer" unique_id=845209534]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "-1"
[node name="IncreaseInspirationSpeedButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer" unique_id=1122701153]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "+1"
[node name="SelectServerButton" type="OptionButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=434350694]
unique_name_in_owner = true
layout_mode = 2
selected = 0
item_count = 5
popup/item_0/text = "https://music.sanplex.xyz"
popup/item_0/id = 1
popup/item_1/text = "https://tmusic.sanplex.xyz"
popup/item_1/id = 2
popup/item_2/text = "https://rmusic.sanplex.xyz"
popup/item_2/id = 3
popup/item_3/text = "https://old-music.sanplex.xyz"
popup/item_3/id = 4
popup/item_4/text = "http://localhost:8080"
popup/item_4/id = 5
[node name="FullscreenButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=400304684]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Fullscreen"
[node name="QuickSyncButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=49497448]
visible = false
[node name="CacheRow" type="HBoxContainer" parent="SettingsPanel/VBoxContainer" unique_id=658210492]
layout_mode = 2
[node name="CacheTitleLabel" type="Label" parent="SettingsPanel/VBoxContainer/CacheRow" unique_id=365012193]
layout_mode = 2
size_flags_horizontal = 3
button_pressed = true
action_mode = 0
text = "Quick sync"
theme_type_variation = &"SettingsRowLabel"
text = "Songs to download ahead"
[node name="LocalButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=905844805]
[node name="CacheLabel" type="Label" parent="SettingsPanel/VBoxContainer/CacheRow" unique_id=1558370172]
unique_name_in_owner = true
custom_minimum_size = Vector2(48, 0)
layout_mode = 2
text = "1"
horizontal_alignment = 1
[node name="LowerCacheButton" type="Button" parent="SettingsPanel/VBoxContainer/CacheRow" unique_id=1990385038]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "-1"
[node name="IncreaseCacheButton" type="Button" parent="SettingsPanel/VBoxContainer/CacheRow" unique_id=1806295533]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "+1"
[node name="LocalButton" type="CheckButton" parent="SettingsPanel/VBoxContainer" unique_id=905844805]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_horizontal = 3
disabled = true
text = "Local"
+29 -153
View File
@@ -1,89 +1,39 @@
class_name SettingsPopup
extends BasePopup
## The settings: how songs are shown and played, the winning score, the song cache,
## which MusicServer to use and fullscreen.
## 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 quiz settings, such as the winning score, are in [QuizSettingsCard].
## Emitted when another MusicServer is picked.
signal server_changed
@onready var settings_panel: Panel = %SettingsPanel
@onready var stop_after_current_button: CheckButton = %StopAfterCurrentCheckButton
@onready var hide_next_track_button: CheckButton = %HideNextTrackCheckButton
@onready var add_to_database_button: CheckButton = %AddToDatabaseCheckButton
@onready var low_played_button: CheckButton = %LowPlayedCheckButton
@onready var hide_beginning_button: CheckButton = %HideBeginningCheckButton
@onready var hide_length_button: CheckButton = %HideLengthCheckButton
@onready var hide_ticks_button: CheckButton = %HideTicksCheckButton
@onready var score_label: Label = %ScoreLabel
@onready var lower_winning_score_button: Button = %LowerButton
@onready var increase_winning_score_button: Button = %IncreaseButton
@onready var select_server_button: OptionButton = %SelectServerButton
@onready var fullscreen_button: CheckButton = %FullscreenButton
@onready var cache_label: Label = %CacheLabel
@onready var lower_cache_button: Button = %LowerCacheButton
@onready var increase_cache_button: Button = %IncreaseCacheButton
@onready var inspiration_speed_label: Label = %InspirationListSpeedLabel
@onready var lower_inspiration_speed_button: Button = %LowerInspirationSpeedButton
@onready var increase_inspiration_speed_button: Button = %IncreaseInspirationSpeedButton
@onready var hide_for_seconds_label: Label = %HideForSecondsLabel
@onready var lower_hide_for_seconds_button: Button = %LowerHideForSecondsButton
@onready var increase_hide_for_seconds_button: Button = %IncreaseHideForSecondsButton
@onready var select_server_button: OptionButton = %SelectServerButton
@onready var fullscreen_button: CheckButton = %FullscreenButton
@onready var local_button: CheckButton = %LocalButton
func _ready() -> void:
for server: String in Settings.SERVERS:
select_server_button.add_item(server)
fullscreen_button.button_pressed = Settings.fullscreen
select_server_button.selected = Settings.selected_server
select_server_button.select(Settings.selected_server)
cache_label.text = str(Playlist.number_of_tracks_to_preload)
stop_after_current_button.pressed.connect(stop_after_current)
hide_next_track_button.pressed.connect(hide_next_track)
add_to_database_button.pressed.connect(add_to_database)
low_played_button.pressed.connect(low_played)
hide_beginning_button.pressed.connect(hide_beginning)
hide_length_button.pressed.connect(hide_length)
hide_ticks_button.pressed.connect(hide_ticks)
lower_winning_score_button.pressed.connect(lower_winning_score)
increase_winning_score_button.pressed.connect(increase_winning_score)
lower_cache_button.pressed.connect(lower_cache)
increase_cache_button.pressed.connect(increase_cache)
lower_inspiration_speed_button.pressed.connect(lower_inspiration_speed)
increase_inspiration_speed_button.pressed.connect(increase_inspiration_speed)
lower_hide_for_seconds_button.pressed.connect(lower_hide_for_seconds)
increase_hide_for_seconds_button.pressed.connect(increase_hide_for_seconds)
fullscreen_button.pressed.connect(fullscreen)
local_button.pressed.connect(local_play)
stop_after_current_button.button_pressed = Settings.stop_after_current
hide_next_track_button.button_pressed = Settings.hide_next_track
add_to_database_button.button_pressed = Settings.add_to_stats
low_played_button.button_pressed = Settings.use_low_played_mode
hide_beginning_button.button_pressed = Settings.hide_beginning
hide_length_button.button_pressed = Settings.hide_length
hide_ticks_button.button_pressed = Settings.hide_ticks
score_label.text = str(Settings.winning_score)
cache_label.text = str(Playlist.number_of_tracks_to_preload)
inspiration_speed_label.text = str(Settings.inspiration_list_speed)
hide_for_seconds_label.text = str(Settings.hide_for_seconds)
fullscreen_button.button_pressed = Settings.fullscreen
update_hide_for_seconds_enabled()
select_server_button.select(Settings.selected_server)
lower_cache_button.pressed.connect(lower_cache)
increase_cache_button.pressed.connect(increase_cache)
select_server_button.item_selected.connect(select_server)
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)
# Settings can change outside this popup, e.g. winning turns statistics off
func _on_visibility_changed() -> void:
if visible:
add_to_database_button.button_pressed = Settings.add_to_stats
_update_fullscreen_button()
func _update_fullscreen_button() -> void:
fullscreen_button.set_pressed_no_signal(Settings.fullscreen)
func fullscreen() -> void:
Settings.fullscreen = !Settings.fullscreen
if Settings.fullscreen:
@@ -96,59 +46,8 @@ func local_play() -> void:
Settings.play_local = !Settings.play_local
func stop_after_current() -> void:
Settings.stop_after_current = !Settings.stop_after_current
func hide_next_track() -> void:
Settings.hide_next_track = !Settings.hide_next_track
func add_to_database() -> void:
Settings.add_to_stats = !Settings.add_to_stats
func low_played() -> void:
Settings.use_low_played_mode = !Settings.use_low_played_mode
func hide_beginning() -> void:
Settings.hide_beginning = !Settings.hide_beginning
update_hide_for_seconds_enabled()
func update_hide_for_seconds_enabled() -> void:
var enabled: bool = Settings.hide_beginning
%HideForSecondsHBoxContainer.visible = enabled
func hide_length() -> void:
Settings.hide_length = !Settings.hide_length
func hide_ticks() -> void:
Settings.hide_ticks = !Settings.hide_ticks
func lower_winning_score() -> void:
Settings.winning_score = max(Settings.winning_score - 1, 1)
score_label.text = str(Settings.winning_score)
func increase_winning_score() -> void:
Settings.winning_score += 1
score_label.text = str(Settings.winning_score)
func set_winning_score(new_score: int) -> void:
Settings.winning_score = new_score
score_label.text = str(Settings.winning_score)
func lower_cache() -> void:
Playlist.number_of_tracks_to_preload -= 1
if Playlist.number_of_tracks_to_preload < 1:
Playlist.number_of_tracks_to_preload = 1
Playlist.number_of_tracks_to_preload = maxi(Playlist.number_of_tracks_to_preload - 1, 1)
cache_label.text = str(Playlist.number_of_tracks_to_preload)
@@ -157,52 +56,29 @@ func increase_cache() -> void:
cache_label.text = str(Playlist.number_of_tracks_to_preload)
func lower_inspiration_speed() -> void:
Settings.inspiration_list_speed -= 1
if Settings.inspiration_list_speed < 1:
Settings.inspiration_list_speed = 1
inspiration_speed_label.text = str(Settings.inspiration_list_speed)
func increase_inspiration_speed() -> void:
Settings.inspiration_list_speed += 1
inspiration_speed_label.text = str(Settings.inspiration_list_speed )
func lower_hide_for_seconds() -> void:
Settings.hide_for_seconds -= 1.0
if Settings.hide_for_seconds < 0:
Settings.hide_for_seconds = 0
hide_for_seconds_label.text = str(Settings.hide_for_seconds)
func increase_hide_for_seconds() -> void:
Settings.hide_for_seconds += 1.0
if Settings.hide_for_seconds > 10.0:
Settings.hide_for_seconds = 10.0
hide_for_seconds_label.text = str(Settings.hide_for_seconds)
func select_server(new_server: int) -> void:
GameLog.debug("select_server")
Settings.default_path = select_server_button.get_item_text(new_server)
Settings.selected_server = new_server
GameLog.debug("Settings.default_path: " + Settings.default_path)
GameLog.debug("Settings.selected_server: " + str(Settings.selected_server))
GameLog.debug("new_server: " + str(new_server))
GameLog.debug("select_server_button.get_item_text(new_server): ",
select_server_button.get_item_text(new_server))
server_changed.emit()
_use_server(new_server)
## Picks [param new_server] in the list and uses it.
func set_selected_server(new_server: int) -> void:
GameLog.debug("set_selected_server")
select_server_button.select(new_server)
Settings.default_path = select_server_button.get_item_text(new_server)
_use_server(new_server)
func _use_server(new_server: int) -> void:
Settings.default_path = Settings.SERVERS[new_server]
Settings.selected_server = new_server
GameLog.debug("Settings.default_path: " + Settings.default_path)
GameLog.debug("Settings.selected_server: " + str(Settings.selected_server))
GameLog.debug("new_server: " + str(new_server))
GameLog.debug("select_server_button.get_item_text(new_server): ",
select_server_button.get_item_text(new_server))
server_changed.emit()
func _on_visibility_changed() -> void:
if visible:
_update_fullscreen_button()
func _update_fullscreen_button() -> void:
fullscreen_button.set_pressed_no_signal(Settings.fullscreen)
+19 -19
View File
@@ -3,7 +3,8 @@
[ext_resource type="Script" path="res://quiz/quiz.gd" id="quiz_script"]
[ext_resource type="PackedScene" uid="uid://ds15cgsf8vpvc" path="res://player/MusicPlayer.tscn" id="5_emn36"]
[ext_resource type="PackedScene" uid="uid://cdy4kvemwaiom" path="res://popups/CharacterSelectPopup.tscn" id="6_dhrvg"]
[ext_resource type="PackedScene" uid="uid://dldpeo5y3l5hq" path="res://popups/SettingsPopup.tscn" id="11_k62u5"]
[ext_resource type="PackedScene" path="res://quiz/QuizSettingsCard.tscn" id="scene_QuizSettingsCard"]
[ext_resource type="Texture2D" path="res://icons/settings_light_icon.svg" id="settings_icon"]
[ext_resource type="PackedScene" uid="uid://cxlsmxnrp0agh" path="res://popups/WinnerPopup.tscn" id="17_winner_window"]
[ext_resource type="PackedScene" path="res://quiz/MusicListPanel.tscn" id="scene_MusicListPanel"]
[ext_resource type="PackedScene" path="res://quiz/PlayersPanel.tscn" id="scene_PlayersPanel"]
@@ -90,14 +91,6 @@ offset_top = 944.0
offset_right = 368.0
offset_bottom = 975.0
[node name="SettingsPopup" parent="." unique_id=1323246978 instance=ExtResource("11_k62u5")]
visible = false
layout_mode = 1
offset_left = 710.0
offset_top = 220.0
offset_right = 710.0
offset_bottom = 220.0
[node name="CharacterSelectPopup" parent="." unique_id=1679856322 instance=ExtResource("6_dhrvg")]
unique_name_in_owner = true
visible = false
@@ -116,18 +109,25 @@ offset_top = 80.0
offset_right = 160.0
offset_bottom = 80.0
[node name="DebugLabel" type="Label" parent="." unique_id=1959221257]
[node name="QuizSettingsButton" type="Button" parent="." unique_id=1323246979]
layout_mode = 0
offset_left = 64.0
offset_top = 1030.0
offset_right = 224.0
offset_bottom = 1066.0
focus_mode = 0
action_mode = 0
text = "Quiz settings"
icon = ExtResource("settings_icon")
expand_icon = true
[node name="QuizSettingsCard" parent="." unique_id=1323246980 instance=ExtResource("scene_QuizSettingsCard")]
visible = false
layout_mode = 0
offset_left = 974.0
offset_top = 904.0
offset_right = 1014.0
offset_bottom = 927.0
scale = Vector2(3, 3)
text = "DEBUG"
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 2
offset_left = 64.0
offset_top = 984.0
offset_right = 64.0
offset_bottom = 984.0
[node name="SongLoader" type="Node" parent="." unique_id=1520867349]
script = ExtResource("song_loader_script")
+183
View File
@@ -0,0 +1,183 @@
[gd_scene format=3]
[ext_resource type="Script" path="res://quiz/quiz_settings_card.gd" id="1_card_script"]
[node name="QuizSettingsCard" type="Control" node_paths=PackedStringArray("panel")]
layout_mode = 3
anchors_preset = 0
mouse_filter = 2
script = ExtResource("1_card_script")
panel = NodePath("CardPanel")
[node name="CardPanel" type="Panel" parent="."]
unique_name_in_owner = true
layout_mode = 0
offset_top = -470.0
offset_right = 440.0
theme_type_variation = &"PopupBackground"
[node name="VBox" type="VBoxContainer" parent="CardPanel"]
unique_name_in_owner = true
layout_mode = 0
offset_left = 16.0
offset_top = 12.0
offset_right = 424.0
[node name="TitleLabel" type="Label" parent="CardPanel/VBox"]
layout_mode = 2
theme_type_variation = &"Title"
text = "Quiz settings"
horizontal_alignment = 1
[node name="AutoRepeatCheckButton" type="CheckButton" parent="CardPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "Auto repeat"
[node name="StopAfterCurrentCheckButton" type="CheckButton" parent="CardPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "Stop after current"
[node name="HideNextTrackCheckButton" type="CheckButton" parent="CardPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "Hide next track"
[node name="HideBeginningCheckButton" type="CheckButton" parent="CardPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "Hide the beginning of songs"
[node name="HideForSecondsRow" type="HBoxContainer" parent="CardPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
[node name="Title" type="Label" parent="CardPanel/VBox/HideForSecondsRow"]
layout_mode = 2
size_flags_horizontal = 3
theme_type_variation = &"SettingsRowLabel"
text = "Seconds to hide"
[node name="HideForSecondsLabel" type="Label" parent="CardPanel/VBox/HideForSecondsRow"]
unique_name_in_owner = true
custom_minimum_size = Vector2(48, 0)
layout_mode = 2
text = "5"
horizontal_alignment = 1
[node name="LowerHideForSecondsButton" type="Button" parent="CardPanel/VBox/HideForSecondsRow"]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "-1"
[node name="IncreaseHideForSecondsButton" type="Button" parent="CardPanel/VBox/HideForSecondsRow"]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "+1"
[node name="HideLengthCheckButton" type="CheckButton" parent="CardPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "Hide song length"
[node name="HideTicksCheckButton" type="CheckButton" parent="CardPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
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
[node name="Title" type="Label" parent="CardPanel/VBox/WinningScoreRow"]
layout_mode = 2
size_flags_horizontal = 3
theme_type_variation = &"SettingsRowLabel"
text = "Winning score"
[node name="ScoreLabel" type="Label" parent="CardPanel/VBox/WinningScoreRow"]
unique_name_in_owner = true
custom_minimum_size = Vector2(48, 0)
layout_mode = 2
text = "20"
horizontal_alignment = 1
[node name="LowerButton" type="Button" parent="CardPanel/VBox/WinningScoreRow"]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "-1"
[node name="IncreaseButton" type="Button" parent="CardPanel/VBox/WinningScoreRow"]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "+1"
[node name="InspirationRow" type="HBoxContainer" parent="CardPanel/VBox"]
layout_mode = 2
[node name="Title" type="Label" parent="CardPanel/VBox/InspirationRow"]
layout_mode = 2
size_flags_horizontal = 3
theme_type_variation = &"SettingsRowLabel"
text = "Inspiration list speed"
[node name="InspirationListSpeedLabel" type="Label" parent="CardPanel/VBox/InspirationRow"]
unique_name_in_owner = true
custom_minimum_size = Vector2(48, 0)
layout_mode = 2
text = "1"
horizontal_alignment = 1
[node name="LowerInspirationSpeedButton" type="Button" parent="CardPanel/VBox/InspirationRow"]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "-1"
[node name="IncreaseInspirationSpeedButton" type="Button" parent="CardPanel/VBox/InspirationRow"]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "+1"
+20 -11
View File
@@ -2,6 +2,14 @@
[ext_resource type="Script" path="res://quiz/quiz_toolbar.gd" id="part_script"]
[sub_resource type="InputEventKey" id="InputEventKey_search"]
device = -1
alt_pressed = true
keycode = 83
[sub_resource type="Shortcut" id="Shortcut_search"]
events = [SubResource("InputEventKey_search")]
[node name="QuizToolbar" type="Control" unique_id=1873301941]
layout_mode = 3
offset_right = 495.0
@@ -9,31 +17,32 @@ offset_bottom = 31.0
mouse_filter = 2
script = ExtResource("part_script")
[node name="ResetPlaylistButton" type="Button" parent="." unique_id=1754155620]
[node name="SearchButton" type="Button" parent="." unique_id=1782453581]
layout_mode = 0
offset_right = 111.0
offset_bottom = 31.0
focus_mode = 0
action_mode = 0
shortcut = SubResource("Shortcut_search")
text = "Search"
[node name="ResetPlaylistButton" type="Button" parent="." unique_id=1754155620]
layout_mode = 0
offset_left = 128.0
offset_right = 239.0
offset_bottom = 31.0
focus_mode = 0
action_mode = 0
text = "Reset playlist"
[node name="ResetPointsButton" type="Button" parent="." unique_id=942880776]
layout_mode = 0
offset_left = 128.0
offset_right = 239.0
offset_bottom = 31.0
focus_mode = 0
action_mode = 0
text = "Reset points"
[node name="SettingsButton" type="Button" parent="." unique_id=1193400323]
layout_mode = 0
offset_left = 256.0
offset_right = 367.0
offset_bottom = 31.0
focus_mode = 0
action_mode = 0
text = "Settings"
text = "Reset points"
[node name="SoundTestButton" type="Button" parent="." unique_id=1332971879]
layout_mode = 0
+13 -27
View File
@@ -1,7 +1,7 @@
class_name Quiz
extends Control
## The quiz: the song that is playing, the playlist, the players and their points, and
## the popups opened from here (settings, character select, winner and log).
## the popups opened from here (the quiz settings card, character select and winner).
##
## The main window shows the quiz below its top bar. Pictures and buttons keep the
## positions they had in the main window, so the quiz fills the whole window and lets
@@ -12,6 +12,9 @@ extends Control
signal server_changed
## Emitted when Search is pressed. The Search popup is in the main window.
signal search_pressed
## Emitted with a line for the game log, e.g. when a player gets a point.
signal event_logged(text: String)
@@ -30,28 +33,23 @@ var popup_backdrop: PopupBackdrop
@onready var now_playing: NowPlaying = $NowPlaying
@onready var players_panel: PlayersPanel = $PlayersPanel
@onready var toolbar: QuizToolbar = $QuizToolbar
@onready var settings_popup: SettingsPopup = $SettingsPopup
@onready var quiz_settings_card: QuizSettingsCard = $QuizSettingsCard
@onready var quiz_settings_button: Button = $QuizSettingsButton
@onready var winner_popup: WinnerPopup = %WinnerPopup
@onready var song_controls: SongControls = $SongControls
@onready var song_loader: SongLoader = $SongLoader
@onready var music_list_panel: MusicListPanel = $MusicListPanel
@onready var character_select_popup: CharacterSelectPopup = %CharacterSelectPopup
@onready var music_player: MusicPlayer = $MusicPlayer
@onready var debug_label: Label = $DebugLabel
func _ready() -> void:
popup_backdrop = PopupBackdrop.add_to(self, _popups())
if OS.has_feature("debug"):
GameLog.debug("is_debug")
debug_label.visible = true
Settings.is_debug = true
settings_popup.set_winning_score(5)
settings_popup.set_selected_server(4)
song_controls.next_pressed.connect(play_next_song)
song_controls.show_answer_pressed.connect(show_answer_pressed)
toolbar.sound_test_pressed.connect(music_player.get_sound_test_song)
toolbar.settings_pressed.connect(show_settings)
toolbar.search_pressed.connect(search_pressed.emit)
quiz_settings_button.pressed.connect(quiz_settings_card.toggle)
toolbar.reset_playlist_pressed.connect(reset_playlist)
toolbar.reset_points_pressed.connect(reset_points)
song_loader.song_list_loaded.connect(update_song_list)
@@ -64,8 +62,6 @@ func _ready() -> void:
players_panel.change_character_requested.connect(_on_change_character_requested)
music_player.play_next_song.connect(play_next_song)
music_player.update_song_list.connect(update_song_list)
settings_popup.server_changed.connect(_on_server_changed)
settings_popup.visibility_changed.connect(_on_settings_popup_visibility_changed)
open_button.pressed.connect(open)
@@ -115,8 +111,9 @@ func refresh_from_server() -> void:
character_select_popup.load_characters()
func _on_server_changed() -> void:
GameLog.debug("_on_server_changed")
## Reloads everything from the server picked in the settings and starts a new game.
func on_server_changed() -> void:
GameLog.debug("on_server_changed")
refresh_from_server()
reset_points()
server_changed.emit()
@@ -139,15 +136,9 @@ func play_next_song() -> void:
song_loader.fetch_song_if_idle()
# The quiz settings card is left out: it does not dim the quiz
func _popups() -> Array[BasePopup]:
return [settings_popup, character_select_popup, winner_popup]
# The cache size can be changed in the settings. Waiting until the settings are closed
# avoids starting downloads while the user is still clicking the number up and down.
func _on_settings_popup_visibility_changed() -> void:
if !settings_popup.visible:
song_loader.fill_cache()
return [character_select_popup, winner_popup]
func _on_song_added() -> void:
@@ -204,11 +195,6 @@ func reset_points() -> void:
stats_paused_by_win = false
func show_settings() -> void:
GameLog.debug("show_settings")
settings_popup.open()
# Each new player's points reach the music player, the log and the winner popup.
func _on_player_added(new_player_object: PlayerObject) -> void:
new_player_object.first_point_triggered.connect(music_player._on_point_triggered.bind("first"))
+130
View File
@@ -0,0 +1,130 @@
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.
##
## The card's bottom edge is where the card is placed, just above the player bar, and
## it grows upward to fit its rows.
##
## The application settings, such as the server, are in [SettingsPopup].
## The most seconds of a song's beginning that can be hidden.
const MAX_HIDE_SECONDS: float = 10.0
## Space between the rows and the card's edges.
const PADDING: Vector2 = Vector2(16, 12)
@onready var card_panel: Panel = %CardPanel
@onready var rows: VBoxContainer = %VBox
@onready var auto_repeat_button: CheckButton = %AutoRepeatCheckButton
@onready var stop_after_current_button: CheckButton = %StopAfterCurrentCheckButton
@onready var hide_next_track_button: CheckButton = %HideNextTrackCheckButton
@onready var hide_beginning_button: CheckButton = %HideBeginningCheckButton
@onready var hide_for_seconds_row: HBoxContainer = %HideForSecondsRow
@onready var hide_for_seconds_label: Label = %HideForSecondsLabel
@onready var lower_hide_for_seconds_button: Button = %LowerHideForSecondsButton
@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
@onready var inspiration_speed_label: Label = %InspirationListSpeedLabel
@onready var lower_inspiration_speed_button: Button = %LowerInspirationSpeedButton
@onready var increase_inspiration_speed_button: Button = %IncreaseInspirationSpeedButton
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)
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)
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)
increase_inspiration_speed_button.pressed.connect(increase_inspiration_speed)
lower_hide_for_seconds_button.pressed.connect(lower_hide_for_seconds)
increase_hide_for_seconds_button.pressed.connect(increase_hide_for_seconds)
visibility_changed.connect(_on_visibility_changed)
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.
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)
hide_next_track_button.set_pressed_no_signal(Settings.hide_next_track)
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)
inspiration_speed_label.text = str(Settings.inspiration_list_speed)
_fit_to_rows()
func lower_winning_score() -> void:
set_winning_score(Settings.winning_score - 1)
func increase_winning_score() -> void:
set_winning_score(Settings.winning_score + 1)
## Sets the winning score, never below 1.
func set_winning_score(new_score: int) -> void:
Settings.winning_score = maxi(new_score, 1)
score_label.text = str(Settings.winning_score)
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)
func increase_inspiration_speed() -> void:
Settings.inspiration_list_speed += 1
inspiration_speed_label.text = str(Settings.inspiration_list_speed)
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
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
func _on_hide_beginning_toggled(on: bool) -> void:
Settings.hide_beginning = on
hide_for_seconds_row.visible = on
_fit_to_rows()
# Grows or shrinks the card upward, keeping its bottom edge in place
func _fit_to_rows() -> void:
var height: float = rows.get_combined_minimum_size().y + PADDING.y * 2
card_panel.position.y = -height
card_panel.size.y = height
rows.position = PADDING
rows.size = Vector2(card_panel.size.x - PADDING.x * 2, height - PADDING.y * 2)
func _on_visibility_changed() -> void:
if visible:
show_settings()
+1
View File
@@ -0,0 +1 @@
uid://dsap67d5cdg34
+4 -4
View File
@@ -1,11 +1,11 @@
class_name QuizToolbar
extends Control
## The row of quiz buttons under the top bar: reset playlist, reset points, settings
## and sound test.
## The row of quiz buttons under the top bar: search, reset playlist, reset points and
## sound test.
signal search_pressed
signal reset_playlist_pressed
signal reset_points_pressed
signal settings_pressed
signal sound_test_pressed
@onready var reset_playlist_button: Button = $ResetPlaylistButton
@@ -13,9 +13,9 @@ signal sound_test_pressed
func _ready() -> void:
$SearchButton.pressed.connect(search_pressed.emit)
reset_playlist_button.pressed.connect(reset_playlist_pressed.emit)
$ResetPointsButton.pressed.connect(reset_points_pressed.emit)
$SettingsButton.pressed.connect(settings_pressed.emit)
sound_test_button.pressed.connect(sound_test_pressed.emit)
File diff suppressed because it is too large. Load diff
-2
View File
@@ -41,8 +41,6 @@ func before_test() -> void:
_runner = scene_runner("res://main/MainWindow.tscn")
_window = _runner.scene()
_quiz = _window.get_node("Quiz")
# The debug build lowers the winning score on startup; keep it out of reach
Settings.winning_score = 20
## Override to change the fake server before the window starts and sends its first
+1 -2
View File
@@ -57,6 +57,7 @@ const POPUPS: Array[Array] = [
["SettingsWindow", "SettingsPopup"], ["QRWindow", "QRPopup"],
["NewCharacterSelect", "CharacterSelectPopup"], ["ShortcutsWindow", "ShortcutsPopup"],
["AboutWindow", "AboutPopup"], ["WinnerWindow", "WinnerPopup"], ["Log", "LogPopup"],
["QuizSettings", "QuizSettingsCard"],
]
var _main: Control
@@ -175,8 +176,6 @@ static func prepare_autoloads() -> void:
## Runs the tour. [param on_state] is called (and awaited) with the name of each state
## and the popup that is open in it, or [code]null[/code] when no popup is open.
func run(on_state: Callable) -> void:
# The debug build lowers the winning score on startup; keep it out of reach
Settings.winning_score = 20
_stop_caret_blink(_main)
await _settle()
await on_state.call("startup", null)
+3 -3
View File
@@ -63,9 +63,9 @@ func test_qr_popup_has_a_title_and_the_search_address() -> void:
func test_qr_code_follows_the_server_picked_in_the_settings() -> void:
_qr.open()
_qr.close()
Settings.default_path = "http://localhost:8080"
Settings.default_path = "http://another-server:8080"
_qr.open()
assert_str(_qr.url_label.text).is_equal("http://localhost:8080/search")
assert_str(_qr.qr_code_rect.data).is_equal("http://localhost:8080/search")
assert_str(_qr.url_label.text).is_equal("http://another-server:8080/search")
assert_str(_qr.qr_code_rect.data).is_equal("http://another-server:8080/search")
+3 -3
View File
@@ -161,15 +161,15 @@ func test_cache_keeps_filling_after_a_failed_download() -> void:
func _open_settings() -> void:
_press("QuizToolbar/SettingsButton")
(_window.get_node("TopBar/SettingsButton") as Button).pressed.emit()
func _close_settings() -> void:
(_quiz.get_node("SettingsPopup") as Control).visible = false
(_window.get_node("SettingsPopup") as Control).visible = false
func _press_settings_button(unique_name: String) -> void:
(_quiz.get_node("SettingsPopup").get_node("%" + unique_name) as Button).pressed.emit()
(_window.get_node("SettingsPopup").get_node("%" + unique_name) as Button).pressed.emit()
func test_raising_cache_size_does_not_download_while_settings_are_open() -> void:
+1 -23
View File
@@ -1,5 +1,5 @@
extends GdUnitTestSuite
## The music player scene: the player bar and the auto repeat switch under it.
## The music player scene: the player bar. Auto repeat is in the quiz settings card.
var _snapshot: AutoloadSnapshot
var _runner: GdUnitSceneRunner
@@ -24,27 +24,5 @@ func _click(control: Control) -> void:
await _runner.await_input_processed()
func test_auto_repeat_starts_on() -> void:
assert_bool(_player.auto_repeat_button.button_pressed).is_true()
func test_clicking_auto_repeat_turns_it_off_and_on() -> void:
await _click(_player.auto_repeat_button)
assert_bool(Settings.auto_repeat_song).is_false()
assert_bool(_player.auto_repeat_button.button_pressed).is_false()
await _click(_player.auto_repeat_button)
assert_bool(Settings.auto_repeat_song).is_true()
func test_auto_repeat_is_under_the_player_bar() -> void:
await _runner.simulate_frames(1)
var bar: Rect2 = (_player.get_node("PlayerBar") as Control).get_global_rect()
var repeat: Rect2 = _player.auto_repeat_button.get_global_rect()
assert_float(repeat.position.y).is_greater_equal(bar.end.y)
assert_bool(_player.get_global_rect().encloses(repeat)).is_true()
func test_empty_space_lets_clicks_through() -> void:
assert_int(_player.mouse_filter).is_equal(Control.MOUSE_FILTER_IGNORE)
+5 -4
View File
@@ -6,11 +6,12 @@ extends MainWindowTestSuite
## Popups in the main window: the ones opened from the top bar, and the log.
const MAIN_POPUPS: Array[String] = [
"SearchPopup", "SyncPopup", "QRPopup", "ShortcutsPopup", "AboutPopup", "LogPopup",
"SettingsPopup",
]
## Popups opened from the quiz, in the Quiz scene.
const QUIZ_POPUPS: Array[String] = [
"SettingsPopup", "CharacterSelectPopup", "WinnerPopup",
"CharacterSelectPopup", "WinnerPopup",
]
@@ -20,7 +21,7 @@ func _popup(node_name: String) -> BasePopup:
## The backdrop that shows behind [param popup].
func _backdrop(popup: BasePopup = _popup("SettingsPopup")) -> ColorRect:
func _backdrop(popup: BasePopup = _popup("CharacterSelectPopup")) -> ColorRect:
return popup.get_parent().get_node("PopupBackdrop")
@@ -32,12 +33,12 @@ func _outside(popup: BasePopup) -> Vector2:
func test_backdrops_are_hidden_without_popups() -> void:
assert_bool(_backdrop(_popup("SettingsPopup")).visible).is_false()
assert_bool(_backdrop(_popup("CharacterSelectPopup")).visible).is_false()
assert_bool(_backdrop(_popup("AboutPopup")).visible).is_false()
func test_backdrops_cover_the_whole_window() -> void:
for node_name: String in ["SettingsPopup", "AboutPopup"]:
for node_name: String in ["CharacterSelectPopup", "AboutPopup"]:
var popup: BasePopup = _popup(node_name)
popup.open()
@@ -0,0 +1,160 @@
extends MainWindowTestSuite
## The quiz settings card: opened from the button under the player bar, it changes the
## quiz settings without dimming or stopping the quiz.
var _card: QuizSettingsCard
var _button: Button
func before_test() -> void:
super()
_card = _quiz.get_node("QuizSettingsCard")
_button = _quiz.get_node("QuizSettingsButton")
func _open() -> void:
await _click_at(_button.get_global_rect().get_center())
await _runner.simulate_frames(1)
func test_button_opens_the_card_above_it_without_dimming() -> void:
await _open()
assert_bool(_card.visible).is_true()
var card: Rect2 = _card.card_panel.get_global_rect()
var button: Rect2 = _button.get_global_rect()
assert_float(card.end.y).is_less_equal(button.position.y)
var bar: Rect2 = (_quiz.get_node("MusicPlayer/PlayerBar") as Control).get_global_rect()
assert_float(card.end.y).override_failure_message("The card covers the player bar") \
.is_less_equal(bar.position.y)
assert_float(card.position.x).is_equal(button.position.x)
assert_bool(Rect2(Vector2.ZERO, Vector2(1920, 1080)).encloses(card)).is_true()
assert_bool((_quiz.get_node("PopupBackdrop") as Control).visible).is_false()
assert_bool((_window.get_node("PopupBackdrop") as Control).visible).is_false()
func test_song_keeps_playing_while_the_card_is_open() -> void:
await _play_first_song()
await _open()
assert_int(Playlist.currently_playing_song).is_equal(0)
assert_bool((_quiz.get_node("MusicPlayer") as MusicPlayer).audio_player.stream_paused) \
.is_false()
func test_clicking_outside_closes_it_without_pressing_what_is_behind() -> void:
await _open()
var reset_button: Button = _quiz.get_node("QuizToolbar/ResetPlaylistButton")
await _click_at(reset_button.get_global_rect().get_center())
assert_bool(_card.visible).is_false()
assert_int(_server.count("/music/reset")).is_equal(0)
func test_button_closes_an_open_card() -> void:
await _open()
await _click_at(_button.get_global_rect().get_center())
assert_bool(_card.visible).is_false()
func test_each_toggle_changes_its_setting() -> void:
var toggles: Dictionary = {
"auto_repeat_button": "auto_repeat_song",
"stop_after_current_button": "stop_after_current",
"hide_next_track_button": "hide_next_track",
"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:
var toggle: CheckButton = _card.get(button_name)
var before: bool = Settings.get(toggles[button_name])
assert_bool(toggle.button_pressed).override_failure_message(button_name) \
.is_equal(before)
await _click_at(toggle.get_global_rect().get_center())
assert_bool(Settings.get(toggles[button_name])).override_failure_message(
button_name + " did not change its setting").is_equal(!before)
assert_bool(toggle.button_pressed).is_equal(!before)
func test_card_shows_settings_changed_elsewhere() -> void:
await _open()
_card.close()
Settings.add_to_stats = false
Settings.auto_repeat_song = false
await _open()
assert_bool(_card.add_to_database_button.button_pressed).is_false()
assert_bool(_card.auto_repeat_button.button_pressed).is_false()
func test_seconds_to_hide_only_show_while_hiding_the_beginning() -> void:
Settings.hide_beginning = false
await _open()
assert_bool(_card.hide_for_seconds_row.visible).is_false()
_card.hide_beginning_button.button_pressed = true
assert_bool(_card.hide_for_seconds_row.visible).is_true()
assert_str(_card.hide_for_seconds_label.text).is_equal("%d" % Settings.hide_for_seconds)
func test_seconds_to_hide_are_whole_numbers_between_0_and_10() -> void:
Settings.hide_for_seconds = 9.0
await _open()
_card.increase_hide_for_seconds_button.pressed.emit()
_card.increase_hide_for_seconds_button.pressed.emit()
assert_float(Settings.hide_for_seconds).is_equal(10.0)
assert_str(_card.hide_for_seconds_label.text).is_equal("10")
for i: int in 12:
_card.lower_hide_for_seconds_button.pressed.emit()
assert_float(Settings.hide_for_seconds).is_equal(0.0)
assert_str(_card.hide_for_seconds_label.text).is_equal("0")
func test_winning_score_goes_up_and_down_but_not_below_one() -> void:
Settings.winning_score = 2
await _open()
_card.increase_winning_score_button.pressed.emit()
assert_int(Settings.winning_score).is_equal(3)
for i: int in 5:
_card.lower_winning_score_button.pressed.emit()
assert_int(Settings.winning_score).is_equal(1)
assert_str(_card.score_label.text).is_equal("1")
func test_auto_repeat_in_the_card_is_what_the_player_uses() -> void:
Settings.auto_repeat_song = true
await _open()
await _click_at(_card.auto_repeat_button.get_global_rect().get_center())
assert_bool(Settings.auto_repeat_song).is_false()
assert_object(_quiz.get_node("MusicPlayer").get_node_or_null("RepeatSongCheckButton")) \
.is_null()
func test_card_grows_upward_for_the_seconds_row() -> void:
Settings.hide_beginning = false
await _open()
var closed_row: Rect2 = _card.card_panel.get_global_rect()
_card.hide_beginning_button.button_pressed = true
var open_row: Rect2 = _card.card_panel.get_global_rect()
assert_float(open_row.end.y).is_equal(closed_row.end.y)
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()
@@ -0,0 +1 @@
uid://idy30j6v07pe
+4 -4
View File
@@ -3,9 +3,9 @@ extends GdUnitTestSuite
## buttons that use the song list.
const BUTTON_SIGNALS: Dictionary = {
"SearchButton": "search_pressed",
"ResetPlaylistButton": "reset_playlist_pressed",
"ResetPointsButton": "reset_points_pressed",
"SettingsButton": "settings_pressed",
"SoundTestButton": "sound_test_pressed",
}
@@ -40,8 +40,9 @@ func test_clicking_each_button_reports_it() -> void:
func test_buttons_are_in_order_left_to_right() -> void:
var lefts: Array = ["ResetPlaylistButton", "ResetPointsButton", "SettingsButton",
"SoundTestButton"].map(func(n: String) -> float: return _button(n).position.x)
var lefts: Array = ["SearchButton", "ResetPlaylistButton", "ResetPointsButton",
"SoundTestButton"] \
.map(func(n: String) -> float: return _button(n).position.x)
for i: int in lefts.size() - 1:
assert_float(lefts[i]).is_less(lefts[i + 1])
@@ -53,7 +54,6 @@ func test_locking_disables_only_buttons_that_use_the_song_list() -> void:
assert_bool(_button("ResetPlaylistButton").disabled).is_true()
assert_bool(_button("SoundTestButton").disabled).is_true()
assert_bool(_button("ResetPointsButton").disabled).is_false()
assert_bool(_button("SettingsButton").disabled).is_false()
func test_unlocking_enables_them_again() -> void:
+44 -15
View File
@@ -7,6 +7,7 @@ extends MainWindowTestSuite
const MAIN_WINDOW_CHILDREN: Array[String] = [
"Background", "TopBar", "Quiz", "PopupBackdrop", "SearchPopup", "SyncPopup", "QRPopup",
"ShortcutsPopup", "StatisticsView", "AboutPopup", "LogPopup", "SoundtrackStatsPopup",
"SettingsPopup",
]
## The parts of the quiz and the scene each one comes from.
@@ -27,14 +28,15 @@ const LOCKED_BY_SYNC: Array[String] = [
]
const TOP_BAR_CHILDREN: Array[String] = [
"TopPanelContainer", "Title", "SyncButton", "SearchButton", "ShortcutsButton",
"TopPanelContainer", "Title", "SyncButton", "SettingsButton", "ShortcutsButton",
"DebugLabel",
"AboutButton", "QRButton", "QuizTab", "StatisticsTab",
]
## Each top bar button and the popup it opens in the main window.
const TOP_BAR_POPUPS: Dictionary = {
"SearchButton": "SearchPopup",
"SyncButton": "SyncPopup",
"SettingsButton": "SettingsPopup",
"ShortcutsButton": "ShortcutsPopup",
"AboutButton": "AboutPopup",
"QRButton": "QRPopup",
@@ -76,9 +78,13 @@ func test_quiz_downloads_songs_with_a_song_loader() -> void:
assert_object(_quiz.song_loader).is_instanceof(SongLoader)
func test_auto_repeat_is_part_of_the_music_player() -> void:
assert_object(_quiz.get_node("MusicPlayer/RepeatSongCheckButton")).is_instanceof(CheckButton)
assert_object(_quiz.get_node_or_null("RepeatSongCheckButton")).is_null()
func test_quiz_settings_button_sits_under_the_player_bar() -> void:
var player: Control = _quiz.get_node("MusicPlayer")
var bar: Rect2 = (player.get_node("PlayerBar") as Control).get_global_rect()
var button: Rect2 = (_quiz.get_node("QuizSettingsButton") as Control).get_global_rect()
assert_float(button.position.y).is_greater_equal(bar.end.y)
assert_float(button.position.x).is_equal(player.get_global_rect().position.x)
func test_top_bar_holds_only_title_and_buttons() -> void:
@@ -190,8 +196,8 @@ func test_loaded_song_list_shows_in_the_music_list() -> void:
func test_quiz_popup_backdrop_covers_the_top_bar() -> void:
var settings: BasePopup = _quiz.get_node("SettingsPopup")
settings.open()
var character_select: CharacterSelectPopup = _quiz.get_node("CharacterSelectPopup")
character_select.show_grid("Crono")
await _runner.simulate_frames(1)
var backdrop: Control = _quiz.get_node("PopupBackdrop")
@@ -202,15 +208,15 @@ func test_quiz_popup_backdrop_covers_the_top_bar() -> void:
func test_click_on_top_bar_while_quiz_popup_is_open_only_closes_it() -> void:
var settings: BasePopup = _quiz.get_node("SettingsPopup")
var search: BasePopup = _window.get_node("SearchPopup")
settings.open()
var character_select: CharacterSelectPopup = _quiz.get_node("CharacterSelectPopup")
var about: BasePopup = _window.get_node("AboutPopup")
character_select.show_grid("Crono")
await _runner.simulate_frames(1)
await _click_at(_center(_top_bar_button("SearchButton")))
await _click_at(_center(_top_bar_button("AboutButton")))
assert_bool(settings.visible).is_false()
assert_bool(search.visible).is_false()
assert_bool(character_select.visible).is_false()
assert_bool(about.visible).is_false()
func test_sync_disables_quiz_buttons_until_finished() -> void:
@@ -245,7 +251,7 @@ func test_changing_server_reloads_search_and_quiz() -> void:
var player: PlayerObject = _add_player("Crono")
player.add_point()
_quiz.get_node("SettingsPopup").server_changed.emit()
_window.get_node("SettingsPopup").server_changed.emit()
assert_int(_server.count("/music/all/order")).is_equal(search_loads + 1)
assert_int(_server.count("/music/all")).is_equal(inspiration_loads + 1)
@@ -274,7 +280,7 @@ func test_alt_down_lowers_the_volume() -> void:
func test_alt_enter_switches_fullscreen_and_settings_shows_it() -> void:
var settings: BasePopup = _quiz.get_node("SettingsPopup")
var settings: BasePopup = _window.get_node("SettingsPopup")
var was_fullscreen: bool = Settings.fullscreen
await _press_keys([KEY_ALT, KEY_ENTER])
@@ -284,3 +290,26 @@ func test_alt_enter_switches_fullscreen_and_settings_shows_it() -> void:
assert_bool(settings.fullscreen_button.button_pressed).is_equal(!was_fullscreen)
await _press_keys([KEY_ALT, KEY_ENTER])
assert_bool(Settings.fullscreen).is_equal(was_fullscreen)
func test_debug_label_is_in_the_top_bar_and_stays_on_the_statistics_tab() -> void:
var label: Label = _window.get_node("TopBar/DebugLabel")
assert_bool(label.visible).is_equal(Settings.is_debug)
_top_bar_button("StatisticsTab").pressed.emit()
assert_bool(label.is_visible_in_tree()).is_equal(Settings.is_debug)
func test_search_is_in_the_quiz_toolbar_and_opens_the_search_popup() -> void:
assert_object(_window.get_node_or_null("TopBar/SearchButton")).is_null()
await _click_at(_center(_quiz.get_node("QuizToolbar/SearchButton")))
assert_bool((_window.get_node("SearchPopup") as Control).visible).is_true()
func test_alt_s_opens_search() -> void:
await _press_keys([KEY_ALT, KEY_S])
assert_bool((_window.get_node("SearchPopup") as Control).visible).is_true()
+1 -1
View File
@@ -20,7 +20,7 @@ func before_test() -> void:
func _open() -> void:
await _click_at(_window.get_node("TopBar/SearchButton").get_global_rect().get_center())
await _click_at(_quiz.get_node("QuizToolbar/SearchButton").get_global_rect().get_center())
await _runner.simulate_frames(1)
+4 -4
View File
@@ -12,7 +12,7 @@ func before_test() -> void:
func _stats_checkbox() -> CheckButton:
return _quiz.get_node("SettingsPopup").get_node("%AddToDatabaseCheckButton")
return _quiz.get_node("QuizSettingsCard").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("QuizToolbar/SettingsButton")
_press("QuizSettingsButton")
assert_bool(_stats_checkbox().button_pressed).is_false()
@@ -56,8 +56,8 @@ func test_songs_after_a_win_are_not_counted() -> void:
func test_winning_score_cannot_go_below_one() -> void:
_press("QuizToolbar/SettingsButton")
var lower_button: Button = _quiz.get_node("SettingsPopup").get_node("%LowerButton")
_press("QuizSettingsButton")
var lower_button: Button = _quiz.get_node("QuizSettingsCard").get_node("%LowerButton")
for i: int in 3:
lower_button.pressed.emit()
+1
View File
@@ -17,6 +17,7 @@ const STYLES: Dictionary = {
"DarkSpacer": "Panel",
"CharacterCard": "Panel",
"CharacterCardHover": "Panel",
"SettingsRowLabel": "Label",
"MusicList": "PanelContainer",
"SongRow": "PanelContainer",
"ShortcutRowDark": "PanelContainer",
+1 -1
View File
@@ -324,7 +324,7 @@ func test_changing_server_gets_a_new_token() -> void:
_server.respond_json("/music/info", {})
MusicServerClient.fetch_song_info(func(_data: SongInfo) -> void: pass)
Settings.default_path = "http://localhost:8080"
Settings.default_path = "http://another-server:8080"
MusicServerClient.fetch_song_info(func(_data: SongInfo) -> void: pass)
Settings.default_path = previous_path
+2
View File
@@ -930,6 +930,8 @@ SearchField/base_type = &"LineEdit"
SearchField/font_sizes/font_size = 28
SearchResult/base_type = &"RichTextLabel"
SearchResult/font_sizes/normal_font_size = 22
SettingsRowLabel/base_type = &"Label"
SettingsRowLabel/styles/normal = SubResource("StyleBoxEmpty_s5e0q")
ShortcutRowDark/base_type = &"PanelContainer"
ShortcutRowDark/styles/panel = SubResource("StyleBoxFlat_anjdx")
SongRow/base_type = &"PanelContainer"