Name popups *Popup and give scripts, scenes and classes matching names

Every popup is now called *Popup instead of *Window in its file, root node,
node name, class and variable, and PopupWindow becomes BasePopup. Player is
PlayerRow, SongListObject is SongRow and Character is CharacterCard. Script
files are snake_case and scene files PascalCase, each matching its class or
root node, and LightGrayTheme.tres is light_gray_theme.tres.
This commit is contained in:
Sansan committed 2026-10-06 11:22:39 +02:00
1 parent b7d67b573e
commit 390da577d7
78 files changed
+281 -258

No files matched your search

+2 -2
View File
@@ -1,9 +1,9 @@
[gd_scene format=3 uid="uid://cp54idaudb8dp"]
[ext_resource type="Script" uid="uid://b7bh0of7olbcb" path="res://AboutWindow.gd" id="1_about_script"]
[ext_resource type="Script" uid="uid://b7bh0of7olbcb" path="res://about_popup.gd" id="1_about_script"]
[ext_resource type="Theme" path="res://popup_theme.tres" id="popup_theme"]
[node name="AboutControl" type="Control" unique_id=1626010355 node_paths=PackedStringArray("panel")]
[node name="AboutPopup" type="Control" unique_id=1626010355 node_paths=PackedStringArray("panel")]
theme = ExtResource("popup_theme")
layout_mode = 3
anchors_preset = 15
+2 -2
View File
@@ -1,12 +1,12 @@
[gd_scene load_steps=4 format=3 uid="uid://c7ecjj2af6usf"]
[ext_resource type="Script" uid="uid://i35b3scbpwpu" path="res://character.gd" id="1_pjt0s"]
[ext_resource type="Script" uid="uid://i35b3scbpwpu" path="res://character_card.gd" id="1_pjt0s"]
[ext_resource type="Texture2D" uid="uid://cv3hdd6bsruau" path="res://icon.svg" id="2_pjt0s"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_pjt0s"]
bg_color = Color(0.302, 0.302, 0.302, 1)
[node name="Control" type="Control"]
[node name="CharacterCard" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_pjt0s")
@@ -1,12 +1,12 @@
[gd_scene load_steps=3 format=3 uid="uid://cdy4kvemwaiom"]
[ext_resource type="Script" uid="uid://cvffg87wr6r3y" path="res://new_character_select.gd" id="1_h4tdp"]
[ext_resource type="Script" uid="uid://cvffg87wr6r3y" path="res://character_select_popup.gd" id="1_h4tdp"]
[ext_resource type="Theme" path="res://popup_theme.tres" id="popup_theme"]
[sub_resource type="LabelSettings" id="LabelSettings_p4iny"]
font_size = 25
[node name="Control" type="Control" node_paths=PackedStringArray("panel")]
[node name="CharacterSelectPopup" type="Control" node_paths=PackedStringArray("panel")]
theme = ExtResource("popup_theme")
layout_mode = 3
anchors_preset = 0
+2 -2
View File
@@ -1,9 +1,9 @@
[gd_scene load_steps=2 format=3 uid="uid://bijh5h5yrivm3"]
[ext_resource type="Script" uid="uid://cw41y87l64qo7" path="res://log.gd" id="1_q72ua"]
[ext_resource type="Script" uid="uid://cw41y87l64qo7" path="res://log_popup.gd" id="1_q72ua"]
[ext_resource type="Theme" path="res://popup_theme.tres" id="popup_theme"]
[node name="Control" type="Control" node_paths=PackedStringArray("panel")]
[node name="LogPopup" type="Control" node_paths=PackedStringArray("panel")]
theme = ExtResource("popup_theme")
custom_minimum_size = Vector2(700, 700)
layout_mode = 3
+14 -14
View File
@@ -2,16 +2,16 @@
[ext_resource type="PackedScene" path="res://TopBar.tscn" id="top_bar_scene"]
[ext_resource type="PackedScene" path="res://Quiz.tscn" id="quiz_scene"]
[ext_resource type="Script" uid="uid://b8f4g15cas2j2" path="res://MainWindow.gd" id="1_eu0t5"]
[ext_resource type="PackedScene" uid="uid://bxydgil1yifps" path="res://SearchWindow.tscn" id="9_5ijvr"]
[ext_resource type="PackedScene" uid="uid://dpdem7pdxweb5" path="res://SyncWindow.tscn" id="10_yxw0b"]
[ext_resource type="PackedScene" uid="uid://bd1by80q1v27e" path="res://shortcutsWindow.tscn" id="13_8eebo"]
[ext_resource type="PackedScene" uid="uid://btupbowehiyyu" path="res://QRWindow.tscn" id="15_qr_window"]
[ext_resource type="PackedScene" uid="uid://cp54idaudb8dp" path="res://AboutWindow.tscn" id="16_about_window"]
[ext_resource type="Script" uid="uid://b8f4g15cas2j2" path="res://main_window.gd" id="1_eu0t5"]
[ext_resource type="PackedScene" uid="uid://bxydgil1yifps" path="res://SearchPopup.tscn" id="9_5ijvr"]
[ext_resource type="PackedScene" uid="uid://dpdem7pdxweb5" path="res://SyncPopup.tscn" id="10_yxw0b"]
[ext_resource type="PackedScene" uid="uid://bd1by80q1v27e" path="res://ShortcutsPopup.tscn" id="13_8eebo"]
[ext_resource type="PackedScene" uid="uid://btupbowehiyyu" path="res://QRPopup.tscn" id="15_qr_window"]
[ext_resource type="PackedScene" uid="uid://cp54idaudb8dp" path="res://AboutPopup.tscn" id="16_about_window"]
[ext_resource type="Theme" path="res://popup_theme.tres" id="popup_theme"]
[ext_resource type="PackedScene" uid="uid://bijh5h5yrivm3" path="res://Log.tscn" id="14_26rwn"]
[ext_resource type="PackedScene" uid="uid://bijh5h5yrivm3" path="res://LogPopup.tscn" id="14_26rwn"]
[node name="Control" type="Control" unique_id=407149696]
[node name="MainWindow" type="Control" unique_id=407149696]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
@@ -24,7 +24,7 @@ script = ExtResource("1_eu0t5")
[node name="Quiz" parent="." unique_id=1357908642 instance=ExtResource("quiz_scene")]
[node name="Search" parent="." unique_id=1661250375 instance=ExtResource("9_5ijvr")]
[node name="SearchPopup" parent="." unique_id=1661250375 instance=ExtResource("9_5ijvr")]
visible = false
layout_mode = 1
offset_left = 56.0
@@ -32,7 +32,7 @@ offset_top = 96.0
offset_right = 56.0
offset_bottom = 96.0
[node name="SyncWindow" parent="." unique_id=182499699 instance=ExtResource("10_yxw0b")]
[node name="SyncPopup" parent="." unique_id=182499699 instance=ExtResource("10_yxw0b")]
unique_name_in_owner = true
visible = false
layout_mode = 1
@@ -41,7 +41,7 @@ offset_top = 153.0
offset_right = 210.0
offset_bottom = 153.0
[node name="QRWindow" parent="." unique_id=589733821 instance=ExtResource("15_qr_window")]
[node name="QRPopup" parent="." unique_id=589733821 instance=ExtResource("15_qr_window")]
unique_name_in_owner = true
visible = false
layout_mode = 1
@@ -50,7 +50,7 @@ offset_top = 153.0
offset_right = 720.0
offset_bottom = 153.0
[node name="ShortcutsWindow" parent="." unique_id=1513416242 instance=ExtResource("13_8eebo")]
[node name="ShortcutsPopup" parent="." unique_id=1513416242 instance=ExtResource("13_8eebo")]
unique_name_in_owner = true
visible = false
layout_mode = 1
@@ -82,7 +82,7 @@ text = "Total amount of soundtracks in the playlist: 9000"
horizontal_alignment = 1
vertical_alignment = 1
[node name="AboutWindow" parent="." unique_id=141261008 instance=ExtResource("16_about_window")]
[node name="AboutPopup" parent="." unique_id=141261008 instance=ExtResource("16_about_window")]
unique_name_in_owner = true
visible = false
layout_mode = 1
@@ -91,7 +91,7 @@ offset_top = 153.0
offset_right = 720.0
offset_bottom = 153.0
[node name="Log" parent="." unique_id=1289881388 instance=ExtResource("14_26rwn")]
[node name="LogPopup" parent="." unique_id=1289881388 instance=ExtResource("14_26rwn")]
unique_name_in_owner = true
visible = false
layout_mode = 1
+2 -2
View File
@@ -1,8 +1,8 @@
[gd_scene format=3]
[ext_resource type="Script" path="res://music_list_panel.gd" id="part_script"]
[ext_resource type="Script" uid="uid://gf1bk6xbe3j" path="res://MusicListScrollContainer.gd" id="7_dj026"]
[ext_resource type="Theme" uid="uid://rxexo3ur85as" path="res://LightGrayTheme.tres" id="7_wxbv6"]
[ext_resource type="Script" uid="uid://gf1bk6xbe3j" path="res://scroll_to_end_container.gd" id="7_dj026"]
[ext_resource type="Theme" uid="uid://rxexo3ur85as" path="res://light_gray_theme.tres" id="7_wxbv6"]
[node name="MusicListPanel" type="PanelContainer" unique_id=2011292375]
layout_mode = 3
+2 -2
View File
@@ -1,10 +1,10 @@
[gd_scene load_steps=10 format=3 uid="uid://ds15cgsf8vpvc"]
[ext_resource type="Script" uid="uid://d1v0rquma6nt8" path="res://MusicPlayer.gd" id="1_t24ra"]
[ext_resource type="Script" uid="uid://d1v0rquma6nt8" path="res://music_player.gd" id="1_t24ra"]
[ext_resource type="AudioStream" uid="uid://n2g8jddr85h2" path="res://sounds/01. Opening.mp3" id="2_xti80"]
[ext_resource type="Texture2D" uid="uid://comxqfiykp54f" path="res://icons/play_icon_light.svg" id="3_6g308"]
[ext_resource type="Texture2D" uid="uid://ccb6rvbldlgdg" path="res://icons/reload_light_icon.svg" id="4_jleuo"]
[ext_resource type="PackedScene" uid="uid://w400rnew7453" path="res://volume_slider.tscn" id="5_iifuj"]
[ext_resource type="PackedScene" uid="uid://w400rnew7453" path="res://VolumeSlider.tscn" id="5_iifuj"]
[sub_resource type="InputEventKey" id="InputEventKey_r4qo3"]
device = -1
+2 -2
View File
@@ -1,6 +1,6 @@
[gd_scene load_steps=9 format=3 uid="uid://cslogy2csnd7a"]
[ext_resource type="Script" uid="uid://dl6no2wr2c86y" path="res://Player.gd" id="1_if4kc"]
[ext_resource type="Script" uid="uid://dl6no2wr2c86y" path="res://player_row.gd" id="1_if4kc"]
[ext_resource type="Texture2D" uid="uid://r4as0nmtoa7p" path="res://noCharacter.png" id="2_hpj3s"]
[ext_resource type="Texture2D" uid="uid://b2kj6m8qpsgb1" path="res://icons/person_remove_light.svg" id="3_j3uxe"]
@@ -19,7 +19,7 @@ bg_color = Color(0.180392, 0.180392, 0.180392, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_b2crt"]
bg_color = Color(0.180392, 0.180392, 0.180392, 1)
[node name="Player" type="Control"]
[node name="PlayerRow" type="Control"]
custom_minimum_size = Vector2(2.08165e-12, 40)
layout_mode = 3
anchors_preset = 0
+1 -1
View File
@@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://players_panel.gd" id="part_script"]
[ext_resource type="Texture2D" uid="uid://bcfmpd7h512ef" path="res://icons/person_add_light.svg" id="5_31tjv"]
[ext_resource type="Script" uid="uid://cgakje8gb37tf" path="res://PlayerNameField.gd" id="7_qsdfy"]
[ext_resource type="Script" uid="uid://cgakje8gb37tf" path="res://player_name_field.gd" id="7_qsdfy"]
[sub_resource type="InputEventKey" id="InputEventKey_03bm3"]
device = -1
+2 -2
View File
@@ -1,10 +1,10 @@
[gd_scene format=3 uid="uid://btupbowehiyyu"]
[ext_resource type="Script" uid="uid://bsa6xg5xos6h7" path="res://QRWindow.gd" id="1_qr_script"]
[ext_resource type="Script" uid="uid://bsa6xg5xos6h7" path="res://qr_popup.gd" id="1_qr_script"]
[ext_resource type="Script" uid="uid://dynulhnyq5hpq" path="res://addons/kenyoni/qr_code/qr_code_rect.gd" id="2_jpsxt"]
[ext_resource type="Theme" path="res://popup_theme.tres" id="popup_theme"]
[node name="QRControl" type="Control" unique_id=1996957585 node_paths=PackedStringArray("panel")]
[node name="QRPopup" type="Control" unique_id=1996957585 node_paths=PackedStringArray("panel")]
theme = ExtResource("popup_theme")
layout_mode = 3
anchors_preset = 15
+6 -6
View File
@@ -2,9 +2,9 @@
[ext_resource type="Script" path="res://quiz.gd" id="quiz_script"]
[ext_resource type="PackedScene" uid="uid://ds15cgsf8vpvc" path="res://MusicPlayer.tscn" id="5_emn36"]
[ext_resource type="PackedScene" uid="uid://cdy4kvemwaiom" path="res://new_character_select.tscn" id="6_dhrvg"]
[ext_resource type="PackedScene" uid="uid://dldpeo5y3l5hq" path="res://SettingsWindow.tscn" id="11_k62u5"]
[ext_resource type="PackedScene" uid="uid://cxlsmxnrp0agh" path="res://WinnerWindow.tscn" id="17_winner_window"]
[ext_resource type="PackedScene" uid="uid://cdy4kvemwaiom" path="res://CharacterSelectPopup.tscn" id="6_dhrvg"]
[ext_resource type="PackedScene" uid="uid://dldpeo5y3l5hq" path="res://SettingsPopup.tscn" id="11_k62u5"]
[ext_resource type="PackedScene" uid="uid://cxlsmxnrp0agh" path="res://WinnerPopup.tscn" id="17_winner_window"]
[ext_resource type="PackedScene" path="res://MusicListPanel.tscn" id="scene_MusicListPanel"]
[ext_resource type="PackedScene" path="res://PlayersPanel.tscn" id="scene_PlayersPanel"]
[ext_resource type="PackedScene" path="res://InspirationList.tscn" id="scene_InspirationList"]
@@ -90,7 +90,7 @@ offset_top = 944.0
offset_right = 368.0
offset_bottom = 975.0
[node name="SettingsWindow" parent="." unique_id=1323246978 instance=ExtResource("11_k62u5")]
[node name="SettingsPopup" parent="." unique_id=1323246978 instance=ExtResource("11_k62u5")]
visible = false
layout_mode = 1
offset_left = 720.0
@@ -98,7 +98,7 @@ offset_top = 153.0
offset_right = 720.0
offset_bottom = 153.0
[node name="NewCharacterSelect" parent="." unique_id=1679856322 instance=ExtResource("6_dhrvg")]
[node name="CharacterSelectPopup" parent="." unique_id=1679856322 instance=ExtResource("6_dhrvg")]
unique_name_in_owner = true
visible = false
layout_mode = 1
@@ -107,7 +107,7 @@ offset_top = 165.0
offset_right = 1557.0
offset_bottom = 805.0
[node name="WinnerWindow" parent="." unique_id=999999999 instance=ExtResource("17_winner_window")]
[node name="WinnerPopup" parent="." unique_id=999999999 instance=ExtResource("17_winner_window")]
unique_name_in_owner = true
visible = false
layout_mode = 1
+1 -1
View File
@@ -5,7 +5,7 @@ Releases are made from the version in `project.godot`
same version in the About window.
1. Bump the version, e.g. from `1.9.0` to `1.10.0`, and add a `WHATS_NEW` entry in
`AboutWindow.gd`.
`about_popup.gd`.
2. Merge to `main` and push.
The `Build` workflow (`.gitea/workflows/gitea-build.yaml`) then:
+2 -2
View File
@@ -1,9 +1,9 @@
[gd_scene format=3 uid="uid://bxydgil1yifps"]
[ext_resource type="Script" uid="uid://bg5yo08638600" path="res://SearchWindow.gd" id="1_m7bij"]
[ext_resource type="Script" uid="uid://bg5yo08638600" path="res://search_popup.gd" id="1_m7bij"]
[ext_resource type="Theme" path="res://popup_theme.tres" id="popup_theme"]
[node name="Control" type="Control" unique_id=616238617 node_paths=PackedStringArray("panel")]
[node name="SearchPopup" type="Control" unique_id=616238617 node_paths=PackedStringArray("panel")]
theme = ExtResource("popup_theme")
layout_mode = 3
anchors_preset = 15
+2 -2
View File
@@ -1,12 +1,12 @@
[gd_scene format=3 uid="uid://dldpeo5y3l5hq"]
[ext_resource type="Script" uid="uid://dukqyjoduf1af" path="res://SettingsWindow.gd" id="1_bt55j"]
[ext_resource type="Script" uid="uid://dukqyjoduf1af" path="res://settings_popup.gd" id="1_bt55j"]
[ext_resource type="Theme" path="res://popup_theme.tres" id="popup_theme"]
[sub_resource type="LabelSettings" id="LabelSettings_3xrlm"]
font_size = 25
[node name="SettingsControl" type="Control" unique_id=1298840328 node_paths=PackedStringArray("panel")]
[node name="SettingsPopup" type="Control" unique_id=1298840328 node_paths=PackedStringArray("panel")]
theme = ExtResource("popup_theme")
layout_mode = 3
anchors_preset = 15
+2 -2
View File
@@ -1,9 +1,9 @@
[gd_scene load_steps=2 format=3 uid="uid://bd1by80q1v27e"]
[ext_resource type="Script" uid="uid://rolypd0cqd6h" path="res://shortcuts_window.gd" id="1_12pxi"]
[ext_resource type="Script" uid="uid://rolypd0cqd6h" path="res://shortcuts_popup.gd" id="1_12pxi"]
[ext_resource type="Theme" path="res://popup_theme.tres" id="popup_theme"]
[node name="ShorcutsControl" type="Control" node_paths=PackedStringArray("panel")]
[node name="ShortcutsPopup" type="Control" node_paths=PackedStringArray("panel")]
theme = ExtResource("popup_theme")
custom_minimum_size = Vector2(700, 700)
layout_mode = 3
+2 -2
View File
@@ -1,11 +1,11 @@
[gd_scene load_steps=5 format=3 uid="uid://1jbtmhbqolqe"]
[ext_resource type="Texture2D" uid="uid://c8r7ykphss4c2" path="res://characters/Link.png" id="1_ll28s"]
[ext_resource type="Script" uid="uid://cjo13wixip8mq" path="res://song_list_object.gd" id="1_lspki"]
[ext_resource type="Script" uid="uid://cjo13wixip8mq" path="res://song_row.gd" id="1_lspki"]
[ext_resource type="Theme" uid="uid://8bllart6xn1f" path="res://default_theme.tres" id="1_x7fq8"]
[ext_resource type="StyleBox" uid="uid://bsv6yb0yir04l" path="res://style_box_flat.tres" id="3_5h84f"]
[node name="SongListObject" type="PanelContainer"]
[node name="SongRow" type="PanelContainer"]
custom_minimum_size = Vector2(1000, 0)
offset_right = 1088.0
offset_bottom = 59.0
+2 -2
View File
@@ -1,12 +1,12 @@
[gd_scene format=3 uid="uid://dpdem7pdxweb5"]
[ext_resource type="Script" uid="uid://c3ejukwth512a" path="res://sync_window.gd" id="1_8ba47"]
[ext_resource type="Script" uid="uid://c3ejukwth512a" path="res://sync_popup.gd" id="1_8ba47"]
[ext_resource type="Theme" path="res://popup_theme.tres" id="popup_theme"]
[sub_resource type="LabelSettings" id="LabelSettings_anbfi"]
font_size = 25
[node name="Control2" type="Control" unique_id=1302914356 node_paths=PackedStringArray("panel")]
[node name="SyncPopup" type="Control" unique_id=1302914356 node_paths=PackedStringArray("panel")]
theme = ExtResource("popup_theme")
layout_mode = 3
anchors_preset = 15
+1 -1
View File
@@ -27,7 +27,7 @@ pass.
| Folder | Contents |
|---|---|
| `tests/unit/` | Logic without scenes: playlist, songs, player scoring, time formatting, search, the server client |
| `tests/integration/` | Real scenes (`MainWindow.tscn`, `SyncWindow.tscn`) run against a fake server, including the point keybinds |
| `tests/integration/` | Real scenes (`MainWindow.tscn`, `SyncPopup.tscn`) run against a fake server, including the point keybinds |
| `tests/fakes/` | `FakeHttpTransport`, `AutoloadSnapshot` and the `MainWindowTestSuite` base class |
| `tests/data/` | Files the fake server sends, e.g. a short MP3 |
File renamed without changes.
+2 -2
View File
@@ -1,13 +1,13 @@
[gd_scene format=3 uid="uid://cxlsmxnrp0agh"]
[ext_resource type="Script" uid="uid://dxpb22xbwf3t1" path="res://winner_window.gd" id="1_winner_script"]
[ext_resource type="Script" uid="uid://dxpb22xbwf3t1" path="res://winner_popup.gd" id="1_winner_script"]
[ext_resource type="Texture2D" uid="uid://r4as0nmtoa7p" path="res://noCharacter.png" id="2_no_character"]
[ext_resource type="Theme" path="res://popup_theme.tres" id="popup_theme"]
[sub_resource type="LabelSettings" id="LabelSettings_hr75l"]
font_size = 35
[node name="WinnerControl" type="Control" unique_id=1111111111 node_paths=PackedStringArray("panel")]
[node name="WinnerPopup" type="Control" unique_id=1111111111 node_paths=PackedStringArray("panel")]
theme = ExtResource("popup_theme")
layout_mode = 3
anchors_preset = 15
+1 -1
View File
@@ -1,5 +1,5 @@
class_name AboutPopup
extends PopupWindow
extends BasePopup
@onready
var about_panel: Panel = %AboutPanel
File renamed without changes.
+1 -1
View File
@@ -1,4 +1,4 @@
class_name PopupWindow
class_name BasePopup
extends Control
## A window shown on top of the main window, such as Settings or About.
##
File renamed without changes.
+1 -1
View File
@@ -1,4 +1,4 @@
class_name Character
class_name CharacterCard
extends Control
@onready
File renamed without changes.
@@ -1,5 +1,5 @@
class_name CharacterSelectPopup
extends PopupWindow
extends BasePopup
@onready
var character_panel: Panel = %CharacterPanel
@@ -17,7 +17,7 @@ var can_select_character: bool = false
signal new_new_character_selected(file_name: String)
var character: PackedScene = preload("res://character.tscn")
var character: PackedScene = preload("res://CharacterCard.tscn")
func _ready() -> void:
close_timer.timeout.connect(_on_close_timeout)
@@ -35,7 +35,7 @@ func load_characters() -> void:
if typeof(list) == TYPE_ARRAY:
for character_name: String in list:
GameLog.debug("character_name ", character_name)
var character_box: Character = character.instantiate()
var character_box: CharacterCard = character.instantiate()
character_grid.add_child(character_box)
character_box.custom_minimum_size = Vector2(235, 145)
character_box.size = Vector2(235, 145)
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -1,5 +1,5 @@
class_name LogPopup
extends PopupWindow
extends BasePopup
@onready
var log_panel: Panel = %LogPanel
View File
File renamed without changes.
+22 -22
View File
@@ -12,22 +12,22 @@ var top_bar: TopBar = $TopBar
var quiz: Quiz = $Quiz
@onready
var search_view: SearchPopup = $Search
var search_popup: SearchPopup = $SearchPopup
@onready
var sync_window: SyncPopup = %SyncWindow
var sync_popup: SyncPopup = %SyncPopup
@onready
var shortcuts_window: ShortcutsPopup = %ShortcutsWindow
var shortcuts_popup: ShortcutsPopup = %ShortcutsPopup
@onready
var qr_window: QRPopup = %QRWindow
var qr_popup: QRPopup = %QRPopup
@onready
var about_window: AboutPopup = %AboutWindow
var about_popup: AboutPopup = %AboutPopup
@onready
var log_window: LogPopup = %Log
var log_popup: LogPopup = %LogPopup
@onready
var statistic_popup: PopupPanel = $StatisticsPopupPanel
@@ -50,12 +50,12 @@ func _ready() -> void:
top_bar.about_pressed.connect(show_about)
top_bar.qr_pressed.connect(show_qr)
sync_window.connect("sync_started", _on_sync_started)
sync_window.connect("sync_finished", _on_sync_finished)
quiz.server_changed.connect(search_view.get_list_of_soundtracks)
quiz.event_logged.connect(log_window.add_log_row)
sync_popup.connect("sync_started", _on_sync_started)
sync_popup.connect("sync_finished", _on_sync_finished)
quiz.server_changed.connect(search_popup.get_list_of_soundtracks)
quiz.event_logged.connect(log_popup.add_log_row)
search_view.get_list_of_soundtracks()
search_popup.get_list_of_soundtracks()
func _input(event: InputEvent) -> void:
@@ -68,45 +68,45 @@ func _input(event: InputEvent) -> void:
if Settings.fullscreen == false:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
if event.alt_pressed && event.keycode == KEY_K:
shortcuts_window.toggle()
shortcuts_popup.toggle()
if event.alt_pressed && event.keycode == KEY_L:
log_window.toggle()
log_popup.toggle()
func _popups() -> Array[PopupWindow]:
return [search_view, sync_window, qr_window, shortcuts_window, about_window, log_window]
func _popups() -> Array[BasePopup]:
return [search_popup, sync_popup, qr_popup, shortcuts_popup, about_popup, log_popup]
func show_search() -> void:
GameLog.debug("show_search")
search_view.toggle()
search_popup.toggle()
func show_about() -> void:
GameLog.debug("show_about")
about_window.open()
about_popup.open()
func show_shortcuts() -> void:
GameLog.debug("show_shortcuts")
shortcuts_window.open()
shortcuts_popup.open()
func show_qr() -> void:
GameLog.debug("show_qr")
qr_window.open()
qr_popup.open()
func get_statistics() -> void:
GameLog.debug("get_statistics")
statistic_popup.visible = true
statistic_label.text = "Total amount of soundtracks in the playlist: " \
+ str(search_view.soundtracks.size())
+ str(search_popup.soundtracks.size())
func sync_soundtracks() -> void:
GameLog.debug("sync_soundtracks")
sync_window.start_sync()
sync_popup.start_sync()
func _on_sync_started() -> void:
@@ -117,5 +117,5 @@ func _on_sync_started() -> void:
func _on_sync_finished() -> void:
GameLog.debug("_on_sync_finished")
search_view.get_list_of_soundtracks()
search_popup.get_list_of_soundtracks()
quiz.on_sync_finished()
File renamed without changes.
+2 -2
View File
@@ -5,7 +5,7 @@ extends PanelContainer
## Emitted when the row of song number [param song_no] is clicked.
signal song_clicked(song_no: int)
var _song_list_object: PackedScene = preload("res://song_list_object.tscn")
var _song_list_object: PackedScene = preload("res://SongRow.tscn")
@onready
var _rows: VBoxContainer = $ScrollContainer/MusicList
@@ -15,7 +15,7 @@ var _rows: VBoxContainer = $ScrollContainer/MusicList
func refresh() -> void:
Settings.delete_children(_rows)
for s: SongObject in Playlist.get_playlist():
var new_song_list_object: SongListObject = _song_list_object.instantiate()
var new_song_list_object: SongRow = _song_list_object.instantiate()
new_song_list_object.song_object = s
new_song_list_object.gui_input.connect(_on_row_input.bind(s.song_number))
_rows.add_child(new_song_list_object)
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -1,4 +1,4 @@
class_name Player
class_name PlayerRow
extends Control
@onready
View File
File renamed without changes.
+4 -4
View File
@@ -13,9 +13,9 @@ signal player_added(player_object: PlayerObject)
signal player_removed(player_object: PlayerObject)
## Emitted when the character button in [param row] is pressed.
signal change_character_requested(row: Player, player_name: String)
signal change_character_requested(row: PlayerRow, player_name: String)
var _player_row: PackedScene = preload("res://Player.tscn")
var _player_row: PackedScene = preload("res://PlayerRow.tscn")
@onready
var add_players_button: TextureButton = $VBoxContainer/HBoxContainer/AddPlayersButton
@@ -68,7 +68,7 @@ func reload() -> void:
for player_object: PlayerObject in Settings.player_array:
GameLog.debug(player_object.player_name)
var new_player: Player = _player_row.instantiate()
var new_player: PlayerRow = _player_row.instantiate()
new_player.player_object = player_object
new_player.list_index = counter
@@ -79,7 +79,7 @@ func reload() -> void:
counter += 1
func _on_change_character_clicked(row: Player, player_name: String) -> void:
func _on_change_character_clicked(row: PlayerRow, player_name: String) -> void:
change_character_requested.emit(row, player_name)
+4 -4
View File
@@ -7,12 +7,12 @@ extends ColorRect
## Popups close themselves when clicked outside, and the backdrop keeps that click from
## reaching the buttons behind them.
var _popups: Array[PopupWindow] = []
var _popups: Array[BasePopup] = []
## Adds a backdrop to [param parent] and moves [param popups] above it. The backdrop
## shows while any of them is open.
static func add_to(parent: Control, popups: Array[PopupWindow]) -> PopupBackdrop:
static func add_to(parent: Control, popups: Array[BasePopup]) -> PopupBackdrop:
var backdrop: PopupBackdrop = PopupBackdrop.new()
backdrop.name = "PopupBackdrop"
backdrop.color = Color(0, 0, 0, 0.55)
@@ -20,7 +20,7 @@ static func add_to(parent: Control, popups: Array[PopupWindow]) -> PopupBackdrop
backdrop._popups = popups
parent.add_child(backdrop)
backdrop.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
for popup: PopupWindow in popups:
for popup: BasePopup in popups:
parent.move_child(popup, -1)
popup.visibility_changed.connect(backdrop._update)
backdrop._update()
@@ -28,4 +28,4 @@ static func add_to(parent: Control, popups: Array[PopupWindow]) -> PopupBackdrop
func _update() -> void:
visible = _popups.any(func(popup: PopupWindow) -> bool: return popup.visible)
visible = _popups.any(func(popup: BasePopup) -> bool: return popup.visible)
+1 -1
View File
@@ -23,7 +23,7 @@ config/icon="res://icon.svg"
[autoload]
GameLog="*res://game_log.gd"
Settings="*res://Settings.gd"
Settings="*res://settings.gd"
Playlist="*res://playlist.gd"
MusicServerClient="*res://music_server_client.gd"
+1 -1
View File
@@ -1,5 +1,5 @@
class_name QRPopup
extends PopupWindow
extends BasePopup
@onready
var qr_panel: Panel = $QRPanel
View File
File renamed without changes.
+42 -42
View File
@@ -18,7 +18,7 @@ signal event_logged(text: String)
var open_button: Button = $Open
@onready
var fileDialog: FileDialog = $FileDialog
var file_dialog: FileDialog = $FileDialog
@onready
var inspiration_list: InspirationList = $InspirationList
@@ -33,10 +33,10 @@ var players_panel: PlayersPanel = $PlayersPanel
var toolbar: QuizToolbar = $QuizToolbar
@onready
var settings_window: SettingsPopup = $SettingsWindow
var settings_popup: SettingsPopup = $SettingsPopup
@onready
var winner_window: WinnerPopup = %WinnerWindow
var winner_popup: WinnerPopup = %WinnerPopup
@onready
var song_controls: SongControls = $SongControls
@@ -48,16 +48,16 @@ var song_loader: SongLoader = $SongLoader
var music_list_panel: MusicListPanel = $MusicListPanel
@onready
var new_character_select: CharacterSelectPopup = %NewCharacterSelect
var character_select_popup: CharacterSelectPopup = %CharacterSelectPopup
@onready
var music_player_container: MusicPlayer = $MusicPlayer
var music_player: MusicPlayer = $MusicPlayer
@onready
var debug_label: Label = $DebugLabel
var songs: Array= []
var current_player: Node
var current_player_row: PlayerRow
## True while statistics are off because a player won, until points are reset.
var stats_paused_by_win: bool = false
@@ -72,51 +72,51 @@ func _ready() -> void:
GameLog.debug("is_debug")
debug_label.visible = true
Settings.is_debug = true
settings_window.set_winning_score(5)
settings_window.set_selected_server(4)
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_container.get_sound_test_song)
toolbar.sound_test_pressed.connect(music_player.get_sound_test_song)
toolbar.settings_pressed.connect(show_settings)
toolbar.reset_playlist_pressed.connect(reset_playlist)
toolbar.reset_points_pressed.connect(reset_points)
song_loader.song_list_loaded.connect(update_song_list)
song_loader.song_added.connect(_on_song_added)
new_character_select.connect("new_new_character_selected", _on_new_character_selected)
character_select_popup.connect("new_new_character_selected", _on_new_character_selected)
music_list_panel.song_clicked.connect(song_object_clicked)
players_panel.player_added.connect(_on_player_added)
players_panel.player_removed.connect(_on_player_removed)
players_panel.change_character_requested.connect(_on_player_change_character_clicked)
music_player_container.connect("play_next_song", play_next_song)
music_player_container.connect("update_song_list", update_song_list)
settings_window.connect("server_changed", _on_server_changed)
settings_window.visibility_changed.connect(_on_settings_window_visibility_changed)
players_panel.change_character_requested.connect(_on_change_character_requested)
music_player.connect("play_next_song", play_next_song)
music_player.connect("update_song_list", update_song_list)
settings_popup.connect("server_changed", _on_server_changed)
settings_popup.visibility_changed.connect(_on_settings_popup_visibility_changed)
open_button.pressed.connect(open)
inspiration_list.load_from_server()
song_loader.load_song_list()
new_character_select.load_characters()
character_select_popup.load_characters()
func _input(event: InputEvent) -> void:
if event is InputEventKey and event.pressed:
if event.alt_pressed && event.keycode == KEY_UP:
GameLog.debug("Alt + UP pressed")
music_player_container.change_volume(0.05)
music_player.change_volume(0.05)
if event.alt_pressed && event.keycode == KEY_DOWN:
GameLog.debug("Alt + DOWN pressed")
music_player_container.change_volume(-0.05)
music_player.change_volume(-0.05)
if event.alt_pressed && event.ctrl_pressed && event.keycode == KEY_LEFT:
GameLog.debug("Ctrl + Alt + LEFT pressed")
music_player_container.restart()
music_player.restart()
elif event.alt_pressed && event.keycode == KEY_LEFT:
GameLog.debug("Alt + LEFT pressed")
music_player_container.seek(-5)
music_player.seek(-5)
if event.alt_pressed && event.keycode == KEY_RIGHT:
GameLog.debug("Alt + RIGHT pressed")
music_player_container.seek(5)
music_player.seek(5)
## Disables the buttons that use the song list while the server syncs it.
@@ -138,7 +138,7 @@ func refresh_from_server() -> void:
GameLog.debug("refresh_from_server")
inspiration_list.load_from_server()
reset_playlist()
new_character_select.load_characters()
character_select_popup.load_characters()
func _on_server_changed() -> void:
@@ -159,20 +159,20 @@ func play_next_song() -> void:
if Playlist.first_song_played:
Playlist.set_latest_played_song()
Playlist.first_song_played = true
music_player_container.play_song_object(Playlist.latest_played_song)
music_player.play_song_object(Playlist.latest_played_song)
if !(Playlist.get_preloaded_songs() > 0):
song_controls.set_next_enabled(false)
song_loader.fetch_song_if_idle()
func _popups() -> Array[PopupWindow]:
return [settings_window, new_character_select, winner_window]
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_window_visibility_changed() -> void:
if !settings_window.visible:
func _on_settings_popup_visibility_changed() -> void:
if !settings_popup.visible:
song_loader.fill_cache()
@@ -199,11 +199,11 @@ func song_object_clicked(song_no: int) -> void:
var sound: AudioStream = AudioStreamMP3.new()
sound.data = body
Playlist.add_song_to_song_object(song_no, sound)
music_player_container.play_song_object(song_no)
music_player.play_song_object(song_no)
MusicServerClient.fetch_song(song_no, song_downloaded)
else:
GameLog.debug("song already downloaded")
music_player_container.play_song_object(song_no)
music_player.play_song_object(song_no)
func reset_playlist() -> void:
@@ -228,13 +228,13 @@ func reset_points() -> void:
func show_settings() -> void:
GameLog.debug("show_settings")
settings_window.open()
settings_popup.open()
# Each new player's points reach the music player, the log and the winner window.
# 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.connect("first_point_triggerd", music_player_container._on_point_triggered.bind("first"))
new_player_object.connect("match_point_triggerd", music_player_container._on_point_triggered.bind("match"))
new_player_object.connect("first_point_triggerd", music_player._on_point_triggered.bind("first"))
new_player_object.connect("match_point_triggerd", music_player._on_point_triggered.bind("match"))
new_player_object.connect("winner_triggerd", _on_player_won.bind(new_player_object))
new_player_object.connect("point_given_sound", _on_make_point_given_sound)
new_player_object.connect("player_point_given", _on_point_given.bind(new_player_object))
@@ -250,13 +250,13 @@ func _on_point_given(player_object: PlayerObject) -> void:
func _on_make_point_given_sound() -> void:
music_player_container.play_sound_effect(preload("res://sounds/itemopen.wav"))
music_player.play_sound_effect(preload("res://sounds/itemopen.wav"))
func _on_point_taken(player_object: PlayerObject) -> void:
GameLog.debug("_on_point_taken")
event_logged.emit(player_object.player_name + " lost a point")
music_player_container.play_sound_effect(preload("res://sounds/itemequip.wav"))
music_player.play_sound_effect(preload("res://sounds/itemequip.wav"))
if Playlist.currently_playing_song >= 0:
Playlist.remove_point(player_object.id)
update_song_list()
@@ -264,8 +264,8 @@ func _on_point_taken(player_object: PlayerObject) -> void:
func _on_player_won(player_object: PlayerObject) -> void:
GameLog.debug("_on_player_won")
winner_window.show_winner(player_object)
music_player_container.play_song(preload("res://sounds/winning.mp3"))
winner_popup.show_winner(player_object)
music_player.play_song(preload("res://sounds/winning.mp3"))
# Songs played after the game is won don't count towards the statistics
if Settings.add_to_stats:
Settings.add_to_stats = false
@@ -277,16 +277,16 @@ func _on_player_removed(player_object: PlayerObject) -> void:
update_song_list()
func _on_player_change_character_clicked(new_player: Player, player_name: String) -> void:
func _on_change_character_requested(new_player: PlayerRow, player_name: String) -> void:
GameLog.debug("_on_player_change_character_clicked")
current_player = new_player
current_player_row = new_player
GameLog.debug("Change character for: " + player_name)
new_character_select.show_grid(player_name)
character_select_popup.show_grid(player_name)
func _on_new_character_selected(character_texture: ImageTexture) -> void:
GameLog.debug("_on_new_character_selected")
current_player.new_character_selected(character_texture)
current_player_row.new_character_selected(character_texture)
###Local
@@ -294,7 +294,7 @@ func _on_new_character_selected(character_texture: ImageTexture) -> void:
var local_path: String = '/Users/sebastian/ResilioSync/Sorterat_test/Metal Gear Solid 4 - Guns of the Patriots/2-16 Metal Gear Saga.mp3'
func open() -> void:
fileDialog.popup()
file_dialog.popup()
func _on_file_dialog_dir_selected(path: String) -> void:
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -1,5 +1,5 @@
class_name SearchPopup
extends PopupWindow
extends BasePopup
@onready
var search_list: VBoxContainer = $ScrollContainer/VBoxContainer
File renamed without changes.
View File
File renamed without changes.
+2 -2
View File
@@ -1,5 +1,5 @@
class_name SettingsPopup
extends PopupWindow
extends BasePopup
@onready
var settings_panel: Panel = %SettingsPanel
@@ -114,7 +114,7 @@ func _ready() -> void:
# 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 window, e.g. winning turns statistics off
# 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
File renamed without changes.
+1 -1
View File
@@ -1,5 +1,5 @@
class_name ShortcutsPopup
extends PopupWindow
extends BasePopup
@onready
var shortcuts_vbox: VBoxContainer = %shortcutsVBox
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -1,4 +1,4 @@
class_name SongListObject
class_name SongRow
extends PanelContainer
@onready
File renamed without changes.
+1 -1
View File
@@ -1,5 +1,5 @@
class_name SyncPopup
extends PopupWindow
extends BasePopup
@onready
var sync_panel: Panel = %SyncPanel
File renamed without changes.
+2 -2
View File
@@ -84,10 +84,10 @@ func _add_player(player_name: String) -> PlayerObject:
## Returns the row in the player list that shows [param player_object].
func _player_row(player_object: PlayerObject) -> Player:
func _player_row(player_object: PlayerObject) -> PlayerRow:
var rows: Node = _quiz.get_node(
"PlayersPanel/VBoxContainer/ScrollContainer/PlayersListVBoxContainer")
for row: Player in rows.get_children():
for row: PlayerRow in rows.get_children():
if row.player_object == player_object:
return row
return null
+31 -26
View File
@@ -27,10 +27,15 @@ const SYNC_RESULT: Dictionary = {
"total_time": "00:00:03",
}
## Popups in the order the tour opens them.
const POPUPS: Array[String] = [
"Search", "SyncWindow", "SettingsWindow", "QRWindow", "NewCharacterSelect",
"ShortcutsWindow", "AboutWindow", "WinnerWindow", "Log", "StatisticsPopupPanel",
## Popups in the order the tour opens them: the state name, then the popup's node. The
## state names are what the popups were first called, so screenshots taken before they
## were renamed can still be compared with new ones.
const POPUPS: Array[Array] = [
["Search", "SearchPopup"], ["SyncWindow", "SyncPopup"],
["SettingsWindow", "SettingsPopup"], ["QRWindow", "QRPopup"],
["NewCharacterSelect", "CharacterSelectPopup"], ["ShortcutsWindow", "ShortcutsPopup"],
["AboutWindow", "AboutPopup"], ["WinnerWindow", "WinnerPopup"], ["Log", "LogPopup"],
["StatisticsPopupPanel", "StatisticsPopupPanel"],
]
var _main: Control
@@ -108,31 +113,31 @@ func run(on_state: Callable) -> void:
await _settle()
await on_state.call("playing", null)
for popup_name: String in POPUPS:
var popup: Node = await _open_popup(popup_name)
for state_and_node: Array in POPUPS:
var popup: Node = await _open_popup(state_and_node[1])
await _settle()
await on_state.call("popup_" + popup_name, popup)
await on_state.call("popup_" + state_and_node[0], popup)
_close_popup(popup)
await _settle()
var sync_window: PopupWindow = _node("SyncWindow")
var sync_popup: BasePopup = _node("SyncPopup")
Settings.currently_syncing = false
sync_window.has_synced = false
sync_window.start_sync()
sync_window.sync_timer.stop()
sync_window._on_sync_timeout()
sync_popup.has_synced = false
sync_popup.start_sync()
sync_popup.sync_timer.stop()
sync_popup._on_sync_timeout()
await _settle()
await on_state.call("sync_in_progress", sync_window)
sync_window.close()
await on_state.call("sync_in_progress", sync_popup)
sync_popup.close()
await _settle()
await on_state.call("sync_buttons_locked", null)
_server().respond_json("/sync/progress", SYNC_RESULT)
sync_window._on_sync_timeout()
sync_window.open()
sync_popup._on_sync_timeout()
sync_popup.open()
await _settle()
await on_state.call("sync_result", sync_window)
sync_window.close()
await on_state.call("sync_result", sync_popup)
sync_popup.close()
await _settle()
@@ -204,7 +209,7 @@ func _add_player(player_name: String) -> void:
_call("add_player")
func _player_row(index: int) -> Player:
func _player_row(index: int) -> PlayerRow:
return _node("PlayersPanel").get_node(
"VBoxContainer/ScrollContainer/PlayersListVBoxContainer").get_child(index)
@@ -220,20 +225,20 @@ func _freeze_music_player() -> void:
## The log starts each row with the time of day; use a fixed time instead.
func _fix_log_times() -> void:
var log_window: PopupWindow = _node("Log")
for row: Label in log_window.log_box.get_children():
var log_popup: BasePopup = _node("LogPopup")
for row: Label in log_popup.log_box.get_children():
row.text = "12:00:00 " + row.text.substr(9)
func _open_popup(popup_name: String) -> Node:
var popup: Node = _node(popup_name)
match popup_name:
"SyncWindow":
# Opening the window starts a sync; show the empty window instead
"SyncPopup":
# Opening the popup starts a sync; show the empty popup instead
popup.open()
"NewCharacterSelect":
"CharacterSelectPopup":
popup.show_grid("Crono")
"WinnerWindow":
"WinnerPopup":
popup.show_winner(Settings.player_array[0])
"StatisticsPopupPanel":
_call("get_statistics")
@@ -243,7 +248,7 @@ func _open_popup(popup_name: String) -> Node:
func _close_popup(popup: Node) -> void:
if popup is PopupWindow:
if popup is BasePopup:
popup.close()
else:
popup.visible = false
+51 -33
View File
@@ -10,33 +10,53 @@ extends GdUnitTestSuite
const BASELINE_PATH: String = "res://tests/data/layout_baseline.json"
## Nodes that moved from the main window into the Quiz scene, by their old name.
const QUIZ_NODES: Array[String] = [
"Open", "FileDialog", "MusicListPanel", "DebugLabel", "SettingsWindow",
"NewCharacterSelect", "WinnerWindow",
]
## Nodes that moved into the Quiz scene under another path: old name to new path in
## the quiz.
const RENAMED_QUIZ_NODES: Dictionary = {
"Players": "PlayersPanel",
"ScrollContainer": "InspirationList",
"VBoxContainer": "NowPlaying",
"MusicPlayer": "MusicPlayer/PlayerBar",
"RepeatSongCheckButton": "MusicPlayer/RepeatSongCheckButton",
"ResetPlaylistButton": "QuizToolbar/ResetPlaylistButton",
"ResetPointsButton": "QuizToolbar/ResetPointsButton",
"SettingsButton": "QuizToolbar/SettingsButton",
"SoundTestButton": "QuizToolbar/SoundTestButton",
"ShowAnswerButton": "SongControls/ShowAnswerButton",
"NextButton": "SongControls/NextButton",
## Where each node of the old main window lives now: its old name, and the path that
## replaces it. Nodes that are not listed are still where they were.
const MOVED: Dictionary = {
# The top bar
"TopPanelContainer": "TopBar/TopPanelContainer",
"Title": "TopBar/Title",
"SearchButton": "TopBar/SearchButton",
"SyncButton": "TopBar/SyncButton",
"StatisticsButton": "TopBar/StatisticsButton",
"ShortcutsButton": "TopBar/ShortcutsButton",
"AboutButton": "TopBar/AboutButton",
"QRButton": "TopBar/QRButton",
# The popups of the main window, renamed from *Window to *Popup
"Search": "SearchPopup",
"SyncWindow": "SyncPopup",
"QRWindow": "QRPopup",
"ShortcutsWindow": "ShortcutsPopup",
"AboutWindow": "AboutPopup",
"Log": "LogPopup",
# The quiz and its parts
"Open": "Quiz/Open",
"FileDialog": "Quiz/FileDialog",
"DebugLabel": "Quiz/DebugLabel",
"MusicListPanel": "Quiz/MusicListPanel",
"Players": "Quiz/PlayersPanel",
"ScrollContainer": "Quiz/InspirationList",
"VBoxContainer": "Quiz/NowPlaying",
"MusicPlayer": "Quiz/MusicPlayer/PlayerBar",
"RepeatSongCheckButton": "Quiz/MusicPlayer/RepeatSongCheckButton",
"ResetPlaylistButton": "Quiz/QuizToolbar/ResetPlaylistButton",
"ResetPointsButton": "Quiz/QuizToolbar/ResetPointsButton",
"SettingsButton": "Quiz/QuizToolbar/SettingsButton",
"SoundTestButton": "Quiz/QuizToolbar/SoundTestButton",
"ShowAnswerButton": "Quiz/SongControls/ShowAnswerButton",
"NextButton": "Quiz/SongControls/NextButton",
"SettingsWindow": "Quiz/SettingsPopup",
"NewCharacterSelect": "Quiz/CharacterSelectPopup",
"WinnerWindow": "Quiz/WinnerPopup",
}
## Nodes that moved from the main window into the TopBar scene, by their old name.
const TOP_BAR_NODES: Array[String] = [
"TopPanelContainer", "Title", "SearchButton", "SyncButton", "StatisticsButton",
"ShortcutsButton", "AboutButton", "QRButton",
]
## Scenes that were renamed, by their old and new root name. A row added to a list is
## named after its scene's root when the name is still free, so these show up deeper in a
## path.
const RENAMED_SCENES: Dictionary = {
"SongListObject": "SongRow",
"Player": "PlayerRow",
}
## How far a node may be from its old place, in pixels.
const TOLERANCE: float = 0.5
@@ -71,14 +91,12 @@ func after() -> void:
## Where the node that used to be at [param old_path] in the main window is now.
static func new_path(old_path: String) -> String:
var first: String = old_path.get_slice("/", 0)
if first in QUIZ_NODES:
return "Quiz/" + old_path
if first in RENAMED_QUIZ_NODES:
return "Quiz/" + RENAMED_QUIZ_NODES[first] + old_path.trim_prefix(first)
if first in TOP_BAR_NODES:
return "TopBar/" + old_path
return old_path
var parts: PackedStringArray = old_path.split("/")
for i: int in parts.size():
parts[i] = RENAMED_SCENES.get(parts[i], parts[i])
var first: String = parts[0]
parts[0] = MOVED.get(first, first)
return "/".join(parts)
func _baseline() -> Dictionary:
+3 -3
View File
@@ -165,11 +165,11 @@ func _open_settings() -> void:
func _close_settings() -> void:
(_quiz.get_node("SettingsWindow") as Control).visible = false
(_quiz.get_node("SettingsPopup") as Control).visible = false
func _press_settings_button(unique_name: String) -> void:
(_quiz.get_node("SettingsWindow").get_node("%" + unique_name) as Button).pressed.emit()
(_quiz.get_node("SettingsPopup").get_node("%" + unique_name) as Button).pressed.emit()
func test_raising_cache_size_does_not_download_while_settings_are_open() -> void:
@@ -229,7 +229,7 @@ func test_show_answer_before_first_song_does_not_reveal_next_song() -> void:
func test_log_adds_one_row_per_point_with_padded_time() -> void:
var log_box: VBoxContainer = _window.get_node("%Log").get_node("%LogVBoxContainer")
var log_box: VBoxContainer = _window.get_node("%LogPopup").get_node("%LogVBoxContainer")
var crono: PlayerObject = _add_player("Crono")
await _play_first_song()
+1 -1
View File
@@ -37,7 +37,7 @@ func test_starts_empty() -> void:
func test_refresh_shows_one_row_per_song_in_order() -> void:
_panel.refresh()
assert_array(_rows().map(func(row: SongListObject) -> int: return row.song_object.song_number)) \
assert_array(_rows().map(func(row: SongRow) -> int: return row.song_object.song_number)) \
.contains_exactly([0, 1, 2])
+2 -2
View File
@@ -146,7 +146,7 @@ func test_player_list_shows_rows_in_player_order() -> void:
var rows: Array[Node] = _quiz.get_node(
"PlayersPanel/VBoxContainer/ScrollContainer/PlayersListVBoxContainer").get_children()
assert_array(rows.map(func(row: Player) -> PlayerObject: return row.player_object)) \
assert_array(rows.map(func(row: PlayerRow) -> PlayerObject: return row.player_object)) \
.contains_exactly([_marle, _lucca, robo])
assert_array(rows.map(func(row: Player) -> int: return row.list_index)) \
assert_array(rows.map(func(row: PlayerRow) -> int: return row.list_index)) \
.contains_exactly([0, 1, 2])
+6 -6
View File
@@ -58,7 +58,7 @@ func test_adding_a_name_adds_a_player_and_a_row() -> void:
assert_str(crono.player_name).is_equal("Crono")
await signals.is_emitted("player_added", [crono])
assert_str(_panel.new_player_name_field.text).is_empty()
assert_object((_rows()[0] as Player).player_object).is_same(crono)
assert_object((_rows()[0] as PlayerRow).player_object).is_same(crono)
func test_add_button_in_the_row_adds_the_player() -> void:
@@ -105,9 +105,9 @@ func test_rows_follow_player_order_and_numbering() -> void:
_add("Marle")
_add("Lucca")
assert_array(_rows().map(func(row: Player) -> String: return row.player_object.player_name)) \
assert_array(_rows().map(func(row: PlayerRow) -> String: return row.player_object.player_name)) \
.contains_exactly(["Crono", "Marle", "Lucca"])
assert_array(_rows().map(func(row: Player) -> int: return row.list_index)) \
assert_array(_rows().map(func(row: PlayerRow) -> int: return row.list_index)) \
.contains_exactly([0, 1, 2])
@@ -123,12 +123,12 @@ func test_remove_button_removes_the_player_and_row() -> void:
assert_array(Settings.player_array.map(
func(p: PlayerObject) -> String: return p.player_name)).contains_exactly(["Marle"])
assert_int(_rows().size()).is_equal(1)
assert_int((_rows()[0] as Player).list_index).is_equal(0)
assert_int((_rows()[0] as PlayerRow).list_index).is_equal(0)
func test_character_button_asks_for_a_new_character() -> void:
_add("Crono")
var row: Player = _rows()[0]
var row: PlayerRow = _rows()[0]
var signals: GdUnitSignalAssert = assert_signal(monitor_signals(_panel))
(row.get_node("HBoxContainer/Character") as BaseButton).pressed.emit()
@@ -142,5 +142,5 @@ func test_reload_shows_new_scores() -> void:
_panel.reload()
assert_str(((_rows()[0] as Player).get_node("HBoxContainer/Name") as Label).text) \
assert_str(((_rows()[0] as PlayerRow).get_node("HBoxContainer/Name") as Label).text) \
.ends_with("Crono: 3")
+17 -17
View File
@@ -1,44 +1,44 @@
extends MainWindowTestSuite
## All popups share PopupWindow: clicking outside the panel closes them, the backdrop
## All popups share BasePopup: clicking outside the panel closes them, the backdrop
## dims the window behind them, and the closing click does not reach the main window.
## The main window and the quiz each have their own popups and their own backdrop.
## Popups in the main window: the ones opened from the top bar, and the log.
const MAIN_POPUPS: Array[String] = [
"Search", "SyncWindow", "QRWindow", "ShortcutsWindow", "AboutWindow", "Log",
"SearchPopup", "SyncPopup", "QRPopup", "ShortcutsPopup", "AboutPopup", "LogPopup",
]
## Popups opened from the quiz, in the Quiz scene.
const QUIZ_POPUPS: Array[String] = [
"SettingsWindow", "NewCharacterSelect", "WinnerWindow",
"SettingsPopup", "CharacterSelectPopup", "WinnerPopup",
]
func _popup(node_name: String) -> PopupWindow:
func _popup(node_name: String) -> BasePopup:
return _quiz.get_node(node_name) if node_name in QUIZ_POPUPS \
else _window.get_node(node_name)
## The backdrop that shows behind [param popup].
func _backdrop(popup: PopupWindow = _popup("SettingsWindow")) -> ColorRect:
func _backdrop(popup: BasePopup = _popup("SettingsPopup")) -> ColorRect:
return popup.get_parent().get_node("PopupBackdrop")
## A point on screen outside the popup's panel.
func _outside(popup: PopupWindow) -> Vector2:
func _outside(popup: BasePopup) -> Vector2:
var rect: Rect2 = popup.panel.get_global_rect()
return Vector2(rect.end.x + 5, rect.end.y + 5) if rect.end.x < 1900 \
else Vector2(rect.position.x - 5, rect.position.y - 5)
func test_backdrops_are_hidden_without_popups() -> void:
assert_bool(_backdrop(_popup("SettingsWindow")).visible).is_false()
assert_bool(_backdrop(_popup("AboutWindow")).visible).is_false()
assert_bool(_backdrop(_popup("SettingsPopup")).visible).is_false()
assert_bool(_backdrop(_popup("AboutPopup")).visible).is_false()
func test_backdrops_cover_the_whole_window() -> void:
for node_name: String in ["SettingsWindow", "AboutWindow"]:
var popup: PopupWindow = _popup(node_name)
for node_name: String in ["SettingsPopup", "AboutPopup"]:
var popup: BasePopup = _popup(node_name)
popup.open()
assert_object(_backdrop(popup).get_global_rect()).override_failure_message(
@@ -49,12 +49,12 @@ func test_backdrops_cover_the_whole_window() -> void:
func test_every_popup_is_a_popup_window() -> void:
for node_name: String in MAIN_POPUPS + QUIZ_POPUPS:
assert_object(_popup(node_name)).is_instanceof(PopupWindow)
assert_object(_popup(node_name)).is_instanceof(BasePopup)
func test_every_popup_shows_backdrop_and_closes_on_outside_click() -> void:
for node_name: String in MAIN_POPUPS + QUIZ_POPUPS:
var popup: PopupWindow = _popup(node_name)
var popup: BasePopup = _popup(node_name)
popup.open()
await _runner.simulate_frames(1)
assert_bool(_backdrop(popup).visible).override_failure_message(
@@ -69,7 +69,7 @@ func test_every_popup_shows_backdrop_and_closes_on_outside_click() -> void:
func test_click_inside_popup_keeps_it_open() -> void:
var settings: PopupWindow = _popup("SettingsWindow")
var settings: BasePopup = _popup("SettingsPopup")
settings.open()
await _runner.simulate_frames(1)
@@ -79,7 +79,7 @@ func test_click_inside_popup_keeps_it_open() -> void:
func test_closing_click_does_not_press_button_behind_popup() -> void:
var settings: PopupWindow = _popup("SettingsWindow")
var settings: BasePopup = _popup("SettingsPopup")
var reset_button: Button = _quiz.get_node("QuizToolbar/ResetPlaylistButton")
settings.open()
await _runner.simulate_frames(1)
@@ -101,7 +101,7 @@ func test_button_works_again_after_popup_closed() -> void:
func test_closing_search_clears_the_search() -> void:
var search: PopupWindow = _popup("Search")
var search: BasePopup = _popup("SearchPopup")
search.open()
var search_bar: TextEdit = search.get_node("Searchbar")
search_bar.text = "mario"
@@ -112,7 +112,7 @@ func test_closing_search_clears_the_search() -> void:
func test_closing_character_select_allows_song_clicks_again() -> void:
var character_select: PopupWindow = _popup("NewCharacterSelect")
var character_select: BasePopup = _popup("CharacterSelectPopup")
character_select.show_grid("Crono")
assert_bool(Settings.character_select_open).is_true()
@@ -122,7 +122,7 @@ func test_closing_character_select_allows_song_clicks_again() -> void:
func test_toggle_opens_and_closes() -> void:
var shortcuts: PopupWindow = _popup("ShortcutsWindow")
var shortcuts: BasePopup = _popup("ShortcutsPopup")
shortcuts.toggle()
assert_bool(shortcuts.visible).is_true()
+22 -22
View File
@@ -5,8 +5,8 @@ extends MainWindowTestSuite
## server and the keyboard shortcuts reach both the main window and the quiz.
const MAIN_WINDOW_CHILDREN: Array[String] = [
"TopBar", "Quiz", "PopupBackdrop", "Search", "SyncWindow", "QRWindow",
"ShortcutsWindow", "StatisticsPopupPanel", "AboutWindow", "Log",
"TopBar", "Quiz", "PopupBackdrop", "SearchPopup", "SyncPopup", "QRPopup",
"ShortcutsPopup", "StatisticsPopupPanel", "AboutPopup", "LogPopup",
]
const TOP_BAR_CHILDREN: Array[String] = [
@@ -16,12 +16,12 @@ const TOP_BAR_CHILDREN: Array[String] = [
## Each top bar button and the popup it opens in the main window.
const TOP_BAR_POPUPS: Dictionary = {
"SearchButton": "Search",
"SyncButton": "SyncWindow",
"SearchButton": "SearchPopup",
"SyncButton": "SyncPopup",
"StatisticsButton": "StatisticsPopupPanel",
"ShortcutsButton": "ShortcutsWindow",
"AboutButton": "AboutWindow",
"QRButton": "QRWindow",
"ShortcutsButton": "ShortcutsPopup",
"AboutButton": "AboutPopup",
"QRButton": "QRPopup",
}
@@ -85,7 +85,7 @@ func test_clicking_each_top_bar_button_opens_its_popup() -> void:
assert_bool(popup.visible).override_failure_message(
"%s did not open %s" % [button_name, popup.name]).is_true()
if popup is PopupWindow:
if popup is BasePopup:
popup.close()
else:
popup.visible = false
@@ -115,7 +115,7 @@ func test_clicking_a_song_in_the_music_list_plays_it() -> void:
var rows: Array[Node] = _quiz.get_node("MusicListPanel/ScrollContainer/MusicList") \
.get_children()
var first_row: Control = rows.filter(
func(row: SongListObject) -> bool: return row.song_object.song_number == 0)[0]
func(row: SongRow) -> bool: return row.song_object.song_number == 0)[0]
await _click_at(first_row.get_global_rect().position + Vector2(20, first_row.size.y / 2))
await get_tree().create_timer(0.7).timeout
@@ -130,13 +130,13 @@ func test_points_from_the_player_list_reach_the_song_and_log() -> void:
(_player_row(crono).get_node("HBoxContainer/AddPoint") as BaseButton).pressed.emit()
assert_array(Playlist.song_object_array[0].players_given_point).contains_exactly([crono.id])
assert_int((_window.get_node("%Log").get_node("%LogVBoxContainer") as Node).get_child_count()) \
assert_int((_window.get_node("%LogPopup").get_node("%LogVBoxContainer") as Node).get_child_count()) \
.is_equal(1)
func test_character_button_in_the_player_list_picks_a_new_character() -> void:
var crono: PlayerObject = _add_player("Crono")
var character_select: PopupWindow = _quiz.get_node("NewCharacterSelect")
var character_select: BasePopup = _quiz.get_node("CharacterSelectPopup")
(_player_row(crono).get_node("HBoxContainer/Character") as BaseButton).pressed.emit()
@@ -167,12 +167,12 @@ func test_loaded_song_list_shows_in_the_music_list() -> void:
_quiz.song_loader.load_song_list()
var rows: Array[Node] = _quiz.get_node("MusicListPanel/ScrollContainer/MusicList").get_children()
assert_array(rows.map(func(row: SongListObject) -> int: return row.song_object.song_number)) \
assert_array(rows.map(func(row: SongRow) -> int: return row.song_object.song_number)) \
.contains_exactly([0, 1])
func test_quiz_popup_backdrop_covers_the_top_bar() -> void:
var settings: PopupWindow = _quiz.get_node("SettingsWindow")
var settings: BasePopup = _quiz.get_node("SettingsPopup")
settings.open()
await _runner.simulate_frames(1)
@@ -184,8 +184,8 @@ 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: PopupWindow = _quiz.get_node("SettingsWindow")
var search: PopupWindow = _window.get_node("Search")
var settings: BasePopup = _quiz.get_node("SettingsPopup")
var search: BasePopup = _window.get_node("SearchPopup")
settings.open()
await _runner.simulate_frames(1)
@@ -198,10 +198,10 @@ func test_click_on_top_bar_while_quiz_popup_is_open_only_closes_it() -> void:
func test_sync_disables_quiz_buttons_until_finished() -> void:
_server.respond_bytes("/sync", PackedByteArray())
_server.respond_json("/sync/progress", {"progress": 10, "time_spent": "00:00:01"})
var sync_window: PopupWindow = _window.get_node("SyncWindow")
var sync_popup: BasePopup = _window.get_node("SyncPopup")
_top_bar_button("SyncButton").pressed.emit()
sync_window.sync_timer.stop()
sync_popup.sync_timer.stop()
for button_name: String in ["QuizToolbar/SoundTestButton", "QuizToolbar/ResetPlaylistButton", "SongControls/ShowAnswerButton",
"SongControls/NextButton"]:
@@ -211,7 +211,7 @@ func test_sync_disables_quiz_buttons_until_finished() -> void:
_server.respond_json("/sync/progress", UiTour.SYNC_RESULT)
var reloads_before: int = _server.count("/music/all/order")
sync_window._on_sync_timeout()
sync_popup._on_sync_timeout()
await _runner.simulate_frames(2)
for button_name: String in ["QuizToolbar/SoundTestButton", "QuizToolbar/ResetPlaylistButton", "SongControls/ShowAnswerButton",
@@ -229,7 +229,7 @@ func test_changing_server_reloads_search_and_quiz() -> void:
var player: PlayerObject = _add_player("Crono")
player.add_point()
_quiz.get_node("SettingsWindow").server_changed.emit()
_quiz.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)
@@ -239,10 +239,10 @@ func test_changing_server_reloads_search_and_quiz() -> void:
func test_alt_k_opens_shortcuts_and_alt_l_opens_log() -> void:
await _press_keys([KEY_ALT, KEY_K])
assert_bool((_window.get_node("ShortcutsWindow") as Control).visible).is_true()
assert_bool((_window.get_node("ShortcutsPopup") as Control).visible).is_true()
await _press_keys([KEY_ALT, KEY_L])
assert_bool((_window.get_node("Log") as Control).visible).is_true()
assert_bool((_window.get_node("LogPopup") as Control).visible).is_true()
func test_alt_down_lowers_the_volume() -> void:
@@ -258,7 +258,7 @@ func test_alt_down_lowers_the_volume() -> void:
func test_alt_enter_switches_fullscreen_and_settings_shows_it() -> void:
var settings: PopupWindow = _quiz.get_node("SettingsWindow")
var settings: BasePopup = _quiz.get_node("SettingsPopup")
var was_fullscreen: bool = Settings.fullscreen
await _press_keys([KEY_ALT, KEY_ENTER])
+2 -2
View File
@@ -12,7 +12,7 @@ func before_test() -> void:
func _stats_checkbox() -> CheckButton:
return _quiz.get_node("SettingsWindow").get_node("%AddToDatabaseCheckButton")
return _quiz.get_node("SettingsPopup").get_node("%AddToDatabaseCheckButton")
func test_winning_turns_statistics_off() -> void:
@@ -57,7 +57,7 @@ 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("SettingsWindow").get_node("%LowerButton")
var lower_button: Button = _quiz.get_node("SettingsPopup").get_node("%LowerButton")
for i: int in 3:
lower_button.pressed.emit()
@@ -11,7 +11,7 @@ func before_test() -> void:
Settings.currently_syncing = false
_server = FakeHttpTransport.new().install()
_server.respond_bytes("/sync", PackedByteArray())
_runner = scene_runner("res://SyncWindow.tscn")
_runner = scene_runner("res://SyncPopup.tscn")
_window = _runner.scene()
+1 -1
View File
@@ -1,6 +1,6 @@
extends GdUnitTestSuite
const SearchWindowScript: GDScript = preload("res://SearchWindow.gd")
const SearchWindowScript: GDScript = preload("res://search_popup.gd")
var _search: Control
+1 -1
View File
@@ -1,5 +1,5 @@
class_name WinnerPopup
extends PopupWindow
extends BasePopup
@onready
var winner_panel: Panel = %WinnerPanel
File renamed without changes.