diff --git a/hamncheese/Art/glossy-green-button.svg b/hamncheese/Art/glossy-green-button.svg new file mode 100644 index 0000000..5a5a0d7 --- /dev/null +++ b/hamncheese/Art/glossy-green-button.svg @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + glossy green button + 2011-02-26T02:58:54 + + https://openclipart.org/detail/122737/glossy-green-button-by-ricardomaia + + + ricardomaia + + + + + button + glass + glossy + + + + + + + + + + + diff --git a/hamncheese/Art/glossy-green-button.svg.import b/hamncheese/Art/glossy-green-button.svg.import new file mode 100644 index 0000000..02d6b6e --- /dev/null +++ b/hamncheese/Art/glossy-green-button.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cmbdj0ptiayuj" +path="res://.godot/imported/glossy-green-button.svg-3713d2b1d0121db3a723b559cc3b51fb.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/glossy-green-button.svg" +dest_files=["res://.godot/imported/glossy-green-button.svg-3713d2b1d0121db3a723b559cc3b51fb.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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 diff --git a/hamncheese/Art/glossy-red-button.svg b/hamncheese/Art/glossy-red-button.svg new file mode 100644 index 0000000..13516fc --- /dev/null +++ b/hamncheese/Art/glossy-red-button.svg @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + glossy red button + 2011-02-26T02:58:54 + + https://openclipart.org/detail/122749/glossy-red-button-by-ricardomaia + + + ricardomaia + + + + + button + glass + glossy + + + + + + + + + + + diff --git a/hamncheese/Art/glossy-red-button.svg.import b/hamncheese/Art/glossy-red-button.svg.import new file mode 100644 index 0000000..9038d23 --- /dev/null +++ b/hamncheese/Art/glossy-red-button.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bg0mix7qygorr" +path="res://.godot/imported/glossy-red-button.svg-122e1cdee686ccf1358525786984389b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/glossy-red-button.svg" +dest_files=["res://.godot/imported/glossy-red-button.svg-122e1cdee686ccf1358525786984389b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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 diff --git a/hamncheese/Art/glossy-yellow-button.svg b/hamncheese/Art/glossy-yellow-button.svg new file mode 100644 index 0000000..b91d60e --- /dev/null +++ b/hamncheese/Art/glossy-yellow-button.svg @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + glossy yellow button + 2011-02-26T02:58:54 + + https://openclipart.org/detail/122755/glossy-yellow-button-by-ricardomaia + + + ricardomaia + + + + + button + glass + glossy + + + + + + + + + + + diff --git a/hamncheese/Art/glossy-yellow-button.svg.import b/hamncheese/Art/glossy-yellow-button.svg.import new file mode 100644 index 0000000..97b111b --- /dev/null +++ b/hamncheese/Art/glossy-yellow-button.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bm7fdf52fc6ee" +path="res://.godot/imported/glossy-yellow-button.svg-0c567d7973444f06bc2b43b726033484.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/glossy-yellow-button.svg" +dest_files=["res://.godot/imported/glossy-yellow-button.svg-0c567d7973444f06bc2b43b726033484.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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 diff --git a/hamncheese/Art/icon.svg b/hamncheese/Art/icon.svg deleted file mode 100644 index b370ceb..0000000 --- a/hamncheese/Art/icon.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/hamncheese/Art/toast-128.png b/hamncheese/Art/toast-128.png new file mode 100644 index 0000000..c62455c --- /dev/null +++ b/hamncheese/Art/toast-128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44fe2c41f7ac3db1e8920ca7efdf62d6baae6f29d103e0c6451d9d9dba80f2ae +size 7953 diff --git a/hamncheese/Art/toast-128.png.import b/hamncheese/Art/toast-128.png.import new file mode 100644 index 0000000..5e107cc --- /dev/null +++ b/hamncheese/Art/toast-128.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://diat4mmfgaiy4" +path="res://.godot/imported/toast-128.png-fb1cbd5741717a5ad139f5f8fe590afd.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/toast-128.png" +dest_files=["res://.godot/imported/toast-128.png-fb1cbd5741717a5ad139f5f8fe590afd.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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 diff --git a/hamncheese/Art/toast.svg b/hamncheese/Art/toast.svg new file mode 100644 index 0000000..d334137 --- /dev/null +++ b/hamncheese/Art/toast.svg @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/hamncheese/Art/icon.svg.import b/hamncheese/Art/toast.svg.import similarity index 73% rename from hamncheese/Art/icon.svg.import rename to hamncheese/Art/toast.svg.import index 0ac0b95..7c70a55 100644 --- a/hamncheese/Art/icon.svg.import +++ b/hamncheese/Art/toast.svg.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://b7clpxetrjyc5" -path="res://.godot/imported/icon.svg-750f30f6912a3e29e1f50a8e1a7e4a3e.ctex" +uid="uid://lgaqc3pc7o8d" +path="res://.godot/imported/toast.svg-df0242f2f5561416d0b78ab190daa53f.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Art/icon.svg" -dest_files=["res://.godot/imported/icon.svg-750f30f6912a3e29e1f50a8e1a7e4a3e.ctex"] +source_file="res://Art/toast.svg" +dest_files=["res://.godot/imported/toast.svg-df0242f2f5561416d0b78ab190daa53f.ctex"] [params] diff --git a/hamncheese/Scenes/about.tscn b/hamncheese/Scenes/about.tscn index 7cb0322..4179932 100644 --- a/hamncheese/Scenes/about.tscn +++ b/hamncheese/Scenes/about.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=2 format=3 uid="uid://0gb8db7vlk1d"] +[gd_scene load_steps=3 format=3 uid="uid://0gb8db7vlk1d"] [ext_resource type="Script" path="res://Scripts/about.gd" id="1_00jo2"] +[ext_resource type="Texture2D" uid="uid://diat4mmfgaiy4" path="res://Art/toast-128.png" id="2_7edtr"] [node name="AboutWindowControl" type="Control"] layout_mode = 3 @@ -14,8 +15,47 @@ script = ExtResource("1_00jo2") [node name="AboutWindow" type="Window" parent="."] unique_name_in_owner = true title = "About" -initial_position = 1 -size = Vector2i(200, 200) +initial_position = 2 +size = Vector2i(500, 240) unresizable = true +[node name="VBoxContainer" type="VBoxContainer" parent="AboutWindow"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="HBoxContainer" type="HBoxContainer" parent="AboutWindow/VBoxContainer"] +layout_mode = 2 + +[node name="RichTextLabel" type="RichTextLabel" parent="AboutWindow/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +bbcode_enabled = true +text = "[center] +[b]Ham'n'Cheese[/b] + +[i]Open Source Peer-to-Peer VPN Client[/i] + +Copyright 2023-2024 Scott C. Duensing +2023-2024 [url]Kangaroo Punch Studios[/url] +[/center] +" +fit_content = true + +[node name="TextureRect" type="TextureRect" parent="AboutWindow/VBoxContainer/HBoxContainer"] +layout_mode = 2 +texture = ExtResource("2_7edtr") +stretch_mode = 3 + +[node name="Button" type="Button" parent="AboutWindow/VBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 4 +text = "Close" + [connection signal="close_requested" from="AboutWindow" to="." method="_on_about_window_close_requested"] +[connection signal="meta_clicked" from="AboutWindow/VBoxContainer/HBoxContainer/RichTextLabel" to="." method="_on_rich_text_label_meta_clicked"] +[connection signal="pressed" from="AboutWindow/VBoxContainer/Button" to="." method="_on_button_pressed"] diff --git a/hamncheese/Scenes/disclaimer.tscn b/hamncheese/Scenes/disclaimer.tscn new file mode 100644 index 0000000..afdbcb3 --- /dev/null +++ b/hamncheese/Scenes/disclaimer.tscn @@ -0,0 +1,60 @@ +[gd_scene load_steps=2 format=3 uid="uid://d07wdskvuouof"] + +[ext_resource type="Script" path="res://Scripts/disclaimer.gd" id="1_ryu3b"] + +[node name="DisclaimerControlNode" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_ryu3b") + +[node name="DisclaimerWindow" type="Window" parent="."] +unique_name_in_owner = true +title = "Disclaimer" +initial_position = 2 +size = Vector2i(300, 340) +exclusive = true +unresizable = true + +[node name="MarginContainer" type="MarginContainer" parent="DisclaimerWindow"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_constants/margin_left = 20 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 + +[node name="VBoxContainer" type="VBoxContainer" parent="DisclaimerWindow/MarginContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="RichTextLabel" type="RichTextLabel" parent="DisclaimerWindow/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +bbcode_enabled = true +text = "[center][font_size=24][bgcolor=\"black\"][color=\"red\"]NOTICE![/color][/bgcolor][/font_size] + +This software is an alpha release. + +It is not bug free. +It is not feature complete. +It is intended for testing only. + +Do not be surprised +if it scares your cat.[/center]" + +[node name="Button" type="Button" parent="DisclaimerWindow/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "I Read and Understand" + +[connection signal="close_requested" from="DisclaimerWindow" to="." method="_on_disclaimer_window_close_requested"] +[connection signal="pressed" from="DisclaimerWindow/MarginContainer/VBoxContainer/Button" to="." method="_on_button_pressed"] diff --git a/hamncheese/Scenes/manual.tscn b/hamncheese/Scenes/manual.tscn index 4b1cbbd..7f5a680 100644 --- a/hamncheese/Scenes/manual.tscn +++ b/hamncheese/Scenes/manual.tscn @@ -1,7 +1,10 @@ -[gd_scene load_steps=2 format=3 uid="uid://ncoejgdv7u3s"] +[gd_scene load_steps=3 format=3 uid="uid://ncoejgdv7u3s"] [ext_resource type="Script" path="res://Scripts/manual.gd" id="1_2s7bw"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yj1kx"] +bg_color = Color(0, 0, 0, 1) + [node name="ManualWindowControl" type="Control"] layout_mode = 3 anchors_preset = 15 @@ -15,6 +18,34 @@ script = ExtResource("1_2s7bw") unique_name_in_owner = true title = "Manual" initial_position = 1 -size = Vector2i(400, 400) +size = Vector2i(450, 200) + +[node name="VBoxContainer" type="VBoxContainer" parent="ManualWindow"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="RichTextLabel" type="RichTextLabel" parent="ManualWindow/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_styles/normal = SubResource("StyleBoxFlat_yj1kx") +bbcode_enabled = true +text = "[center] +[i][color=gray] + +The instruction manual will eventually be here. +[/color][/i] +[/center] +" +fit_content = true + +[node name="Button" type="Button" parent="ManualWindow/VBoxContainer"] +layout_mode = 2 +text = "Close" [connection signal="close_requested" from="ManualWindow" to="." method="_on_manual_window_close_requested"] +[connection signal="pressed" from="ManualWindow/VBoxContainer/Button" to="." method="_on_button_pressed"] diff --git a/hamncheese/Scripts/about.gd b/hamncheese/Scripts/about.gd index ad5d4ff..3851351 100644 --- a/hamncheese/Scripts/about.gd +++ b/hamncheese/Scripts/about.gd @@ -25,3 +25,11 @@ extends Control func _on_about_window_close_requested(): about_window.visible = false + + +func _on_button_pressed(): + about_window.visible = false + + +func _on_rich_text_label_meta_clicked(_meta): + OS.shell_open("https://kangaroopunch.com") diff --git a/hamncheese/Scripts/disclaimer.gd b/hamncheese/Scripts/disclaimer.gd new file mode 100644 index 0000000..b1f1e68 --- /dev/null +++ b/hamncheese/Scripts/disclaimer.gd @@ -0,0 +1,47 @@ +# +# Ham'n'Cheese +# Copyright (C) 2023-2024 Scott Duensing +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see +# + + +extends Control + + +signal _disclaimer_closed + + +@onready var disclaimer_window = %DisclaimerWindow + + +var _result = false + + +func _on_disclaimer_window_close_requested(): + _result = false + _disclaimer_closed.emit() + + +func _on_button_pressed(): + _result = true + _disclaimer_closed.emit() + + +func show_disclaimer(): + Disclaimer.disclaimer_window.visible = true + Disclaimer.disclaimer_window.move_to_center() + await _disclaimer_closed + Disclaimer.disclaimer_window.visible = false + return _result diff --git a/hamncheese/Scripts/main.gd b/hamncheese/Scripts/main.gd index 342f445..28bf3e3 100644 --- a/hamncheese/Scripts/main.gd +++ b/hamncheese/Scripts/main.gd @@ -18,8 +18,7 @@ # Things to do: -# - Get the rest of the edge settings into the dialog. -# - Rearrange settings dialog into simple/advanced. +# - Hash community and password together so more than one network on a supernode can have the same network name. # - Find non-sleazy way to handle registry editing for file access on Windows. # - Crazy amount of other stuff. # @@ -41,6 +40,7 @@ const FILE_ID_EXIT = 2 const HELP_ID_ABOUT = 0 const HELP_ID_MANUAL = 1 +const BUTTON_NONE = 0 const BUTTON_CHAT = 1 @@ -49,6 +49,11 @@ const BUTTON_CHAT = 1 @onready var peers_tree = %PeersTree +var _icon_chat +var _icon_red +var _icon_yellow +var _icon_green + var _ip := "" @@ -75,31 +80,21 @@ func _data_recieved(type, data): func _draw_tree(): # Redraw peer tree. - var icon_chat = load("res://Art/chat-circle-dots-fill.svg") peers_tree.clear() peers_tree.columns = 1 var root = peers_tree.create_item() for peer in Peers.peerArray: if peer["online"] or true: - var debug = str(peer["online"]) + " " - if peer["tcp"] == null: - debug = debug + "NULL" - else: - match peer["tcp"].get_status(): - StreamPeerTCP.STATUS_NONE: - debug = debug + "None" - StreamPeerTCP.STATUS_CONNECTING: - debug = debug + "Connecting" - StreamPeerTCP.STATUS_CONNECTED: - debug = debug + "Connected " + peer["tcp"].get_connected_host() - StreamPeerTCP.STATUS_ERROR: - debug = debug + "Error" - _: - debug = debug + "Unknown" var child = peers_tree.create_item(root) child.set_meta("peer", peer["uuid"]) - child.set_text(0, peer["user"] + " (" + peer["ip"] + ") " + debug) - child.add_button(0, icon_chat, BUTTON_CHAT) + child.set_text(0, peer["user"] + " (" + peer["ip"] + ")") + if peer["online"] == false: + child.add_button(0, _icon_red, BUTTON_NONE, true, "Offline") + else: + if peer["_type"] == "p2p": + child.add_button(0, _icon_green, BUTTON_NONE, true, "Peer-to-Peer") + else: + child.add_button(0, _icon_yellow, BUTTON_NONE, true, "Proxied") func _go_offline(): @@ -163,6 +158,10 @@ func _on_peers_tree_button_clicked(item, _column, id, mouse_button_index): func _ready(): + _icon_chat = Util.load_icon("res://Art/chat-circle-dots-fill.svg") + _icon_red = Util.load_icon("res://Art/glossy-red-button.svg") + _icon_yellow = Util.load_icon("res://Art/glossy-yellow-button.svg") + _icon_green = Util.load_icon("res://Art/glossy-green-button.svg") About.about_window.visible = false Manual.manual_window.visible = false Settings.startup() @@ -178,7 +177,10 @@ func _ready(): Edge.startup() Edge.data_recieved.connect(_data_recieved) Edge.network_died.connect(_network_died) - Chat.open(null) # Debug + # TESTING RELEASES ONLY! + if await Disclaimer.show_disclaimer() == false: + _shutdown() + #Chat.open(null) # Debug func _show_exit_dialog(): diff --git a/hamncheese/Scripts/manual.gd b/hamncheese/Scripts/manual.gd index fa32f84..f166ff1 100644 --- a/hamncheese/Scripts/manual.gd +++ b/hamncheese/Scripts/manual.gd @@ -25,3 +25,7 @@ extends Control func _on_manual_window_close_requested(): manual_window.visible = false + + +func _on_button_pressed(): + manual_window.visible = false diff --git a/hamncheese/Scripts/util.gd b/hamncheese/Scripts/util.gd index 275eabd..59d322f 100644 --- a/hamncheese/Scripts/util.gd +++ b/hamncheese/Scripts/util.gd @@ -80,3 +80,10 @@ func ip_string_to_int(ip: String): result += ip.get_slice(".", 2).to_int() * 256 result += ip.get_slice(".", 3).to_int() return result + + +func load_icon(filename: String, width_height: int = 32): + var compressed_texture = load(filename) + var image = compressed_texture.get_image() + image.resize(width_height, width_height, Image.INTERPOLATE_LANCZOS) + return ImageTexture.create_from_image(image) diff --git a/hamncheese/project.godot b/hamncheese/project.godot index c0fdae4..fba935b 100644 --- a/hamncheese/project.godot +++ b/hamncheese/project.godot @@ -12,13 +12,15 @@ config_version=5 config/name="Ham'n'Cheese" config/description="Open Source Peer-to-Peer VPN Client" +config/version="1.0.0" run/main_scene="res://Scenes/main.tscn" config/use_custom_user_dir=true config/custom_user_dir_name="Kangaroo Punch/HamNCheese" config/auto_accept_quit=false config/features=PackedStringArray("4.2", "GL Compatibility") run/low_processor_mode=true -config/icon="res://Art/icon.svg" +boot_splash/show_image=false +config/icon="res://Art/toast.svg" [autoload] @@ -32,6 +34,7 @@ Settings="*res://Scenes/settings.tscn" About="*res://Scenes/about.tscn" Manual="*res://Scenes/manual.tscn" Chat="*res://Scenes/chat.tscn" +Disclaimer="*res://Scenes/disclaimer.tscn" [display]