diff --git a/gui/forms/NewPollForm.tscn b/gui/forms/NewPollForm.tscn index d9f0fd4..0f137d5 100644 --- a/gui/forms/NewPollForm.tscn +++ b/gui/forms/NewPollForm.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://gui/widgets/Background.tscn" type="PackedScene" id=1] [ext_resource path="res://gui/forms/NewPollForm.gd" type="Script" id=2] [ext_resource path="res://gui/forms/CandidatesTree.gd" type="Script" id=3] +[ext_resource path="res://gui/popups/NoProviderPopup.tscn" type="PackedScene" id=4] [node name="NewPollForm" type="Control"] anchor_right = 1.0 @@ -124,5 +125,12 @@ margin_right = 230.0 margin_bottom = 20.0 size_flags_horizontal = 3 text = "CREATE" + +[node name="NoProviderPopup" parent="CenterContainer" instance=ExtResource( 4 )] +visible = false +margin_left = 380.0 +margin_top = 194.0 +margin_right = 643.0 +margin_bottom = 405.0 [connection signal="pressed" from="CenterContainer/VBoxContainer/ButtonsHBoxContainer/CancelButton" to="." method="_on_CancelButton_pressed"] [connection signal="pressed" from="CenterContainer/VBoxContainer/ButtonsHBoxContainer/LaunchButton" to="." method="_on_LaunchButton_pressed"] diff --git a/gui/forms/SettingsForm.gd b/gui/forms/SettingsForm.gd index 04f49cd..c5b4a2d 100644 --- a/gui/forms/SettingsForm.gd +++ b/gui/forms/SettingsForm.gd @@ -3,9 +3,13 @@ extends Control onready var TwitchCheckButton = find_node("TwitchCheckButton", true) - +var initializing = true func _ready(): - TwitchCheckButton.pressed = Config.get_parameter("twitch_provider_enabled", false) + TwitchCheckButton.pressed = Config.get_parameter( + "provider_MajorityJudgmentTwitchChatProvider_enabled", + false + ) + initializing = false func _on_DoneButton_pressed(): @@ -17,6 +21,9 @@ func _on_TwitchConfigureButton_pressed(): func _on_TwitchCheckButton_toggled(button_pressed): - Config.set_parameter("twitch_provider_enabled", button_pressed) -# if button_pressed: -# App.go_to_twitch_settings() + Config.set_parameter( + "provider_MajorityJudgmentTwitchChatProvider_enabled", + button_pressed + ) + if button_pressed and not initializing: + find_node('NoTwitchSettingsPopup', true).show_if_should() diff --git a/gui/forms/SettingsForm.tscn b/gui/forms/SettingsForm.tscn index 190e06b..26feed0 100644 --- a/gui/forms/SettingsForm.tscn +++ b/gui/forms/SettingsForm.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 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] +[ext_resource path="res://gui/popups/NoTwitchSettingsPopup.tscn" type="PackedScene" id=3] [node name="SettingsForm" type="Control"] anchor_right = 1.0 @@ -129,6 +130,8 @@ margin_left = 300.0 margin_right = 350.0 margin_bottom = 20.0 text = "DONE" + +[node name="NoTwitchSettingsPopup" parent="." instance=ExtResource( 3 )] [connection signal="toggled" from="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/TwitchContainer/TwitchCheckButton" to="." method="_on_TwitchCheckButton_toggled"] [connection signal="pressed" from="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/TwitchContainer/TwitchConfigureButton" to="." method="_on_TwitchConfigureButton_pressed"] [connection signal="pressed" from="CenterContainer/VBoxContainer/HBoxContainer/DoneButton" to="." method="_on_DoneButton_pressed"] diff --git a/gui/popups/NoProviderPopup.gd b/gui/popups/NoProviderPopup.gd new file mode 100644 index 0000000..4c882b5 --- /dev/null +++ b/gui/popups/NoProviderPopup.gd @@ -0,0 +1,14 @@ +extends AcceptDialog + + +func _ready(): + show_if_should() + + +func show_if_should(): + if not App.get_providers(): + call_deferred("popup") + + +func _on_NoProviderPopup_confirmed(): + App.go_to_settings() diff --git a/gui/popups/NoProviderPopup.tscn b/gui/popups/NoProviderPopup.tscn new file mode 100644 index 0000000..c5abfd8 --- /dev/null +++ b/gui/popups/NoProviderPopup.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://gui/popups/NoProviderPopup.gd" type="Script" id=1] + +[node name="NoProviderPopup" type="AcceptDialog"] +margin_right = 263.0 +margin_bottom = 136.0 +popup_exclusive = true +window_title = "Wait!" +dialog_text = "No vote provider is enabled. +Your community won't be able to vote! + +Let's go enable one in the Settings! +I will come with you. + +We're all in this together. + +-- The Popup Painter +" +script = ExtResource( 1 ) +[connection signal="confirmed" from="." to="." method="_on_NoProviderPopup_confirmed"] diff --git a/gui/popups/NoTwitchSettingsPopup.gd b/gui/popups/NoTwitchSettingsPopup.gd new file mode 100644 index 0000000..8912236 --- /dev/null +++ b/gui/popups/NoTwitchSettingsPopup.gd @@ -0,0 +1,13 @@ +extends AcceptDialog + + +func show_if_should(): + for provider in App.get_providers(): + if provider is MajorityJudgmentTwitchChatProvider: + var config = provider.get_oauth_config() + if not config["channel"]: + popup_centered() + + +func _on_NoTwitchSettingsPopup_confirmed(): + App.go_to_twitch_settings() diff --git a/gui/popups/NoTwitchSettingsPopup.tscn b/gui/popups/NoTwitchSettingsPopup.tscn new file mode 100644 index 0000000..45fa3c4 --- /dev/null +++ b/gui/popups/NoTwitchSettingsPopup.tscn @@ -0,0 +1,23 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://gui/popups/NoTwitchSettingsPopup.gd" type="Script" id=1] + +[node name="NoTwitchSettingsPopup" type="AcceptDialog"] +visible = true +margin_right = 83.0 +margin_bottom = 58.0 +popup_exclusive = true +dialog_text = "Well done! + +The thing is, to be able to read a Twitch Chat, +we need to know which Twitch Chat to read. +There's lots of them, as you may know. + +Also, the bouncer of Twitch requires credentials +to enter the premises (but the dress code is lax) + +Let's review together what's needed! + +-- The Popup Paintress" +script = ExtResource( 1 ) +[connection signal="confirmed" from="." to="." method="_on_NoTwitchSettingsPopup_confirmed"]