feat: add a form to configure the settings

master
Dominique Merle 4 years ago
parent 6f0cd52098
commit 323a5fc345

@ -10,7 +10,15 @@ func _ready():
func go_to_main_menu():
get_tree().change_scene("res://gui/MainMenu.tscn")
var _done = get_tree().change_scene("res://gui/MainMenu.tscn")
func go_to_settings():
var _done = get_tree().change_scene("res://gui/forms/SettingsForm.tscn")
func go_to_twitch_settings():
var _done = get_tree().change_scene("res://gui/forms/twitch_config/TwitchAuthConfig.tscn")
func load_config():

@ -16,3 +16,7 @@ func _on_NewPollButton_pressed():
func _on_ExitButton_pressed():
get_tree().quit()
func _on_SettingsButton_pressed():
App.go_to_settings()

@ -51,4 +51,5 @@ margin_bottom = 86.0
text = "v0.1"
align = 1
[connection signal="pressed" from="CenterContainer/VBoxContainer/NewPollButton" to="." method="_on_NewPollButton_pressed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/SettingsButton" to="." method="_on_SettingsButton_pressed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/ExitButton" to="." method="_on_ExitButton_pressed"]

@ -2,7 +2,7 @@ extends Control
func _on_CancelButton_pressed():
get_tree().change_scene("res://gui/MainMenu.tscn")
var _done = get_tree().change_scene("res://gui/MainMenu.tscn")
func _on_LaunchButton_pressed():
@ -18,7 +18,7 @@ func collect_poll_from_form(form:Control) -> MajorityJudgmentPoll:
if title_line_edit.text:
poll.set_title(title_line_edit.text)
var candidates_tree = form.find_node("CandidatesTree", true, false)
# var candidates_tree = form.find_node("CandidatesTree", true, false)
return poll

@ -0,0 +1,16 @@
extends Control
func _on_DoneButton_pressed():
App.go_to_main_menu()
func _on_TwitchConfigureButton_pressed():
App.go_to_twitch_settings()
func _on_TwitchCheckButton_toggled(button_pressed):
if button_pressed:
App.go_to_twitch_settings()

@ -0,0 +1,114 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://gui/widgets/Background.tscn" type="PackedScene" id=1]
[ext_resource path="res://gui/forms/SettingsForm.gd" type="Script" id=2]
[node name="SettingsForm" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Background" parent="." instance=ExtResource( 1 )]
[node name="CenterContainer" type="CenterContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
margin_left = 337.0
margin_top = 188.0
margin_right = 687.0
margin_bottom = 412.0
[node name="TabContainer" type="TabContainer" parent="CenterContainer/VBoxContainer"]
margin_right = 350.0
margin_bottom = 200.0
rect_min_size = Vector2( 350, 200 )
[node name="Providers" type="Control" parent="CenterContainer/VBoxContainer/TabContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
[node name="VBoxContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer/TabContainer/Providers"]
anchor_right = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TwitchCheckButton" type="CheckButton" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"]
margin_right = 229.0
margin_bottom = 40.0
text = "Twitch Chat Commands"
[node name="TwitchConfigureButton" type="Button" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"]
margin_left = 233.0
margin_right = 305.0
margin_bottom = 40.0
text = "Configure"
[node name="General" type="Control" parent="CenterContainer/VBoxContainer/TabContainer"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
[node name="HelpLabel" type="RichTextLabel" parent="CenterContainer/VBoxContainer/TabContainer/General"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
text = "TODO: General settings like background color (right now you ned to run the source and change the clear color in the project settings)"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorPicker" type="ColorPicker" parent="CenterContainer/VBoxContainer/TabContainer/General"]
visible = false
margin_left = 12.0
margin_top = 12.0
margin_right = 320.0
margin_bottom = 474.0
color = Color( 0.341176, 0.133333, 0.133333, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="PanelContainer" type="PanelContainer" parent="CenterContainer/VBoxContainer"]
visible = false
margin_top = 40.0
margin_right = 350.0
margin_bottom = 240.0
rect_min_size = Vector2( 350, 200 )
[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer"]
margin_top = 204.0
margin_right = 350.0
margin_bottom = 224.0
[node name="VSeparator" type="VSeparator" parent="CenterContainer/VBoxContainer/HBoxContainer"]
self_modulate = Color( 1, 1, 1, 0 )
margin_right = 296.0
margin_bottom = 20.0
size_flags_horizontal = 3
[node name="DoneButton" type="Button" parent="CenterContainer/VBoxContainer/HBoxContainer"]
margin_left = 300.0
margin_right = 350.0
margin_bottom = 20.0
text = "DONE"
[connection signal="toggled" from="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/TwitchCheckButton" to="." method="_on_TwitchCheckButton_toggled"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/TwitchConfigureButton" to="." method="_on_TwitchConfigureButton_pressed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/HBoxContainer/DoneButton" to="." method="_on_DoneButton_pressed"]

@ -109,8 +109,8 @@ func _on_CancelButton_pressed():
func _on_ClientIdHelpButton_pressed():
OS.shell_open("https://dev.twitch.tv/dashboard/apps/create")
var _done = OS.shell_open("https://dev.twitch.tv/dashboard/apps/create")
func _on_OAuthHelpButton_pressed():
OS.shell_open("https://twitchapps.com/tmi/")
var _done = OS.shell_open("https://twitchapps.com/tmi/")

Loading…
Cancel
Save