diff --git a/.import/close.png-3d17fd8754f6244ca24b7915a06a12bb.md5 b/.import/close.png-3d17fd8754f6244ca24b7915a06a12bb.md5 new file mode 100644 index 0000000..cf67af3 --- /dev/null +++ b/.import/close.png-3d17fd8754f6244ca24b7915a06a12bb.md5 @@ -0,0 +1,3 @@ +source_md5="1368e2dcff7491a4728920386f666c89" +dest_md5="3337b97d524c96a3da735c3a51de18fe" + diff --git a/.import/close.png-3d17fd8754f6244ca24b7915a06a12bb.stex b/.import/close.png-3d17fd8754f6244ca24b7915a06a12bb.stex new file mode 100644 index 0000000..202382b Binary files /dev/null and b/.import/close.png-3d17fd8754f6244ca24b7915a06a12bb.stex differ diff --git a/.import/close_hover.png-50bb62d3aaba3846e79e3db8d1f8a4ad.md5 b/.import/close_hover.png-50bb62d3aaba3846e79e3db8d1f8a4ad.md5 new file mode 100644 index 0000000..2060887 --- /dev/null +++ b/.import/close_hover.png-50bb62d3aaba3846e79e3db8d1f8a4ad.md5 @@ -0,0 +1,3 @@ +source_md5="fd3b3922cdfeffe86b40fa26f10764b0" +dest_md5="eb0c3c92866383db51b8d78696d2ed2b" + diff --git a/.import/close_hover.png-50bb62d3aaba3846e79e3db8d1f8a4ad.stex b/.import/close_hover.png-50bb62d3aaba3846e79e3db8d1f8a4ad.stex new file mode 100644 index 0000000..651978f Binary files /dev/null and b/.import/close_hover.png-50bb62d3aaba3846e79e3db8d1f8a4ad.stex differ diff --git a/.import/close_pressed.png-81e5d53bea00f1f05292aaa00fc94960.md5 b/.import/close_pressed.png-81e5d53bea00f1f05292aaa00fc94960.md5 new file mode 100644 index 0000000..3fdcc2c --- /dev/null +++ b/.import/close_pressed.png-81e5d53bea00f1f05292aaa00fc94960.md5 @@ -0,0 +1,3 @@ +source_md5="a78e4282af889cba694e00ae094a1529" +dest_md5="c322985f974e51fdb8dd00f8fbd153ac" + diff --git a/.import/close_pressed.png-81e5d53bea00f1f05292aaa00fc94960.stex b/.import/close_pressed.png-81e5d53bea00f1f05292aaa00fc94960.stex new file mode 100644 index 0000000..fc731fb Binary files /dev/null and b/.import/close_pressed.png-81e5d53bea00f1f05292aaa00fc94960.stex differ diff --git a/configuration/primary_user.tres b/configuration/primary_user.tres index 16825b5..e2d396e 100644 --- a/configuration/primary_user.tres +++ b/configuration/primary_user.tres @@ -18,4 +18,4 @@ scroll_bar_pressed_color = Color( 0.396078, 0.435294, 0.447059, 1 ) casual_topic_color = Color( 0.14902, 0.172549, 0.203922, 1 ) daily_topic_color = Color( 0.0980392, 0.180392, 0.305882, 1 ) urgent_topic_color = Color( 0.290196, 0.152941, 0.203922, 1 ) -add_topic_button_color = Color( 0.258824, 0.290196, 0.345098, 1 ) +add_topic_button_color = Color( 0.231373, 0.266667, 0.321569, 1 ) diff --git a/project.godot b/project.godot index 2429563..52de242 100644 --- a/project.godot +++ b/project.godot @@ -49,6 +49,11 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://user_interface/chat_panel/message_group_container.gd" }, { +"base": "Object", +"class": "MiscellaneousData", +"language": "GDScript", +"path": "res://system/data/miscellaneous_data/miscellaneous_data_singleton.gd" +}, { "base": "Reference", "class": "Topic", "language": "GDScript", @@ -83,6 +88,7 @@ _global_script_class_icons={ "MessageEditable": "", "MessageGroup": "", "MessageGroupContainer": "", +"MiscellaneousData": "", "Topic": "", "TopicData": "", "TopicDraggable": "", @@ -101,8 +107,9 @@ config/icon="res://icon.png" Data="*res://system/data/data_singleton.gd" Users="*res://system/users/users_singleton.gd" Time="*res://system/time/time_singleton.gd" -PingSystem="*res://system/ping_system/ping_system.tscn" +PingSystem="*res://system/ping_system/ping_system_singleton.tscn" Call="*res://system/call/call_singleton.gd" +Settings="*res://system/settings/settings_singleton.gd" [display] diff --git a/system/call/call_singleton.gd b/system/call/call_singleton.gd index c5881f8..0202d45 100644 --- a/system/call/call_singleton.gd +++ b/system/call/call_singleton.gd @@ -1,5 +1,6 @@ extends Node +# warning-ignore:unused_signal signal requested var is_call_active: bool = false diff --git a/system/data/data_singleton.gd b/system/data/data_singleton.gd index bd448f0..3dfb9e6 100644 --- a/system/data/data_singleton.gd +++ b/system/data/data_singleton.gd @@ -4,11 +4,10 @@ signal loaded() var messages: MessageData var topics: TopicData +var miscellaneous: MiscellaneousData func _ready(): - - var autosave_timer = Timer.new() autosave_timer.wait_time = 600.0 # Every ten minutes. autosave_timer.autostart = true @@ -24,6 +23,7 @@ func _notification(what): func setup(): messages = MessageData.new() topics = TopicData.new() + miscellaneous = MiscellaneousData.new() yield(get_tree(), "idle_frame") _load_data() @@ -31,9 +31,11 @@ func setup(): func _load_data(): messages.load_data() topics.load_data() + miscellaneous.load_data() emit_signal("loaded") func _save_data(): messages.save_data() topics.save_data() + miscellaneous.save_data() diff --git a/system/data/message_data/message.gd b/system/data/message_data/message.gd index 6344651..150eaab 100644 --- a/system/data/message_data/message.gd +++ b/system/data/message_data/message.gd @@ -17,6 +17,7 @@ func get_user() -> User: func delete(): associated_message_group.get_ref().delete(self) Data.messages.dirty_flag = true + Data.messages.message_count -= 1 func edit(new_content: String): diff --git a/system/data/message_data/message_data_singleton.gd b/system/data/message_data/message_data_singleton.gd index 3d90eff..05b4ce4 100644 --- a/system/data/message_data/message_data_singleton.gd +++ b/system/data/message_data/message_data_singleton.gd @@ -1,13 +1,15 @@ extends Object class_name MessageData - signal message_added(message) signal message_group_added(message_group) +const FILE_NAME = "message_history.dat" +const MAX_MESSAGES = 200 var dirty_flag = false var loaded_message_groups = [] +var message_count = 0 func add_message(content, time_stamp, user): @@ -30,17 +32,38 @@ func add_message(content, time_stamp, user): message.content = content message.time_stamp = time_stamp message_group.add(message) + + message_count += 1 + if message_count > MAX_MESSAGES: + get_first_message().delete() + emit_signal("message_added", message) dirty_flag = true +func get_first_message() -> Message: + if loaded_message_groups.empty(): + return null + else: + return loaded_message_groups[0].messages[0] + + +func get_last_message_of_user(user: User) -> Message: + if not loaded_message_groups.empty(): + for i in range(loaded_message_groups.size() -1, -1, -1): + var message_group = loaded_message_groups[i] + if message_group.associated_user == user: + return loaded_message_groups[i].messages[-1] + return null + + func load_data(): var file = File.new() - file.open("user://message_history.dat", File.READ) + file.open("user://" + FILE_NAME, File.READ) var json_string = file.get_as_text() if validate_json(json_string): - printerr("\"message_history.dat\" was found, but is corrupted.") + printerr("\"" + FILE_NAME + "\" was found, but is corrupted.") return var message_data_list = parse_json(json_string) for message_data in message_data_list: @@ -66,7 +89,7 @@ func save_data(): message_data_list.append(message_data) var json_string = to_json(message_data_list) var file = File.new() - file.open("user://message_history.dat", File.WRITE) + file.open("user://" + FILE_NAME, File.WRITE) file.store_string(json_string) file.close() # dirty_flag needs to be set to false after successful save! diff --git a/system/data/miscellaneous_data/miscellaneous_data_singleton.gd b/system/data/miscellaneous_data/miscellaneous_data_singleton.gd new file mode 100644 index 0000000..f3b8ff4 --- /dev/null +++ b/system/data/miscellaneous_data/miscellaneous_data_singleton.gd @@ -0,0 +1,40 @@ +extends Object +class_name MiscellaneousData + +const FILE_NAME = "miscellaneous.dat" + +var close_time_stamp + + +func load_data(): + pass +# var file = File.new() +# file.open("user://" + FILE_NAME, File.READ) +# var json_string = file.get_as_text() +# if validate_json(json_string): +# printerr("\"" + FILE_NAME + "\" was found, but is corrupted.") +# return +# var message_data_list = parse_json(json_string) +# for message_data in message_data_list: +# var user = Users.get_primary() if message_data["user"] else Users.get_helper() + + +func save_data(): + # We do not apply a dirty flag here, because close_time_stamp needs to be + # saved anyway. + pass +# var message_data_list = [] +# for message_group in loaded_message_groups: +# var user = message_group.associated_user.is_primary() +# for message in message_group.messages: +# var message_data = { +# "user" : user, +# "time_stamp" : message.time_stamp, +# "content" : message.content +# } +# message_data_list.append(message_data) +# var json_string = to_json(message_data_list) +# var file = File.new() +# file.open("user://" + FILE_NAME, File.WRITE) +# file.store_string(json_string) +# file.close() diff --git a/system/data/topic_data/topic_data_singleton.gd b/system/data/topic_data/topic_data_singleton.gd index c56afdf..63c50cd 100644 --- a/system/data/topic_data/topic_data_singleton.gd +++ b/system/data/topic_data/topic_data_singleton.gd @@ -1,10 +1,11 @@ extends Object class_name TopicData - signal topic_added(topic) signal topic_inserted(topic, position) +const FILE_NAME = "topic_list.dat" + var dirty_flag = false var loaded_topics = [] @@ -36,10 +37,10 @@ func _compare_topic_index(a, b): func load_data(): var file = File.new() - file.open("user://topic_list.dat", File.READ) + file.open("user://" + FILE_NAME, File.READ) var json_string = file.get_as_text() if validate_json(json_string): - printerr("\"topic_list.dat\" was found, but is corrupted.") + printerr("\"" + FILE_NAME + "\" was found, but is corrupted.") return var topic_data_list = parse_json(json_string) for topic_data in topic_data_list: @@ -61,7 +62,7 @@ func save_data(): topic_data_list.append(topic_data) var json_string = to_json(topic_data_list) var file = File.new() - file.open("user://topic_list.dat", File.WRITE) + file.open("user://" + FILE_NAME, File.WRITE) file.store_string(json_string) file.close() # dirty_flag needs to be set to false after successful save! diff --git a/system/ping_system/ping_system.gd b/system/ping_system/ping_system_singleton.gd similarity index 100% rename from system/ping_system/ping_system.gd rename to system/ping_system/ping_system_singleton.gd diff --git a/system/ping_system/ping_system.tscn b/system/ping_system/ping_system_singleton.tscn similarity index 78% rename from system/ping_system/ping_system.tscn rename to system/ping_system/ping_system_singleton.tscn index 5848685..79928b7 100644 --- a/system/ping_system/ping_system.tscn +++ b/system/ping_system/ping_system_singleton.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://system/ping_system/ping_system.gd" type="Script" id=1] +[ext_resource path="res://system/ping_system/ping_system_singleton.gd" type="Script" id=1] [ext_resource path="res://sounds/ping.wav" type="AudioStream" id=2] [node name="PingSystem" type="Node"] diff --git a/system/settings/settings_singleton.gd b/system/settings/settings_singleton.gd new file mode 100644 index 0000000..f70a1a5 --- /dev/null +++ b/system/settings/settings_singleton.gd @@ -0,0 +1,4 @@ +extends Node + +# warning-ignore:unused_signal +signal settings_menu_requested diff --git a/system/time/time_singleton.gd b/system/time/time_singleton.gd index 53dedba..05f28a0 100644 --- a/system/time/time_singleton.gd +++ b/system/time/time_singleton.gd @@ -1,7 +1,7 @@ extends Node -var offset = 0 # This is for debug purposes. (Doing sudden time jumps) +var offset: int = 0 # This is for debug purposes. (Doing sudden time jumps) func get_current_time() -> int: diff --git a/user_interface/chat_panel/message_box.gd b/user_interface/chat_panel/message_box.gd index 5eee2a0..46dbd32 100644 --- a/user_interface/chat_panel/message_box.gd +++ b/user_interface/chat_panel/message_box.gd @@ -10,6 +10,16 @@ func _ready(): Users.connect("switched", self, "_on_user_switched") +func _input(event): + if not text_edit.has_focus() or not text_edit.text.empty(): + return + if event is InputEventKey and event.scancode == KEY_UP: + if event.is_pressed() and not event.is_echo(): + Data.messages.get_last_message_of_user( + Users.get_current() + ).associated_node._enable_edit_mode() + + func _on_message_box_confirmed(content): if PingSystem.unhandled_ping_count == 0 and not content.empty(): text_edit.text = "" diff --git a/user_interface/fonts/separator_font.tres b/user_interface/fonts/separator_font.tres new file mode 100644 index 0000000..c430737 --- /dev/null +++ b/user_interface/fonts/separator_font.tres @@ -0,0 +1,10 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[sub_resource type="DynamicFontData" id=1] +font_path = "res://user_interface/fonts/Helvetica/Helvetica-Bold.ttf" + +[resource] +size = 14 +use_mipmaps = true +use_filter = true +font_data = SubResource( 1 ) diff --git a/user_interface/main.gd b/user_interface/main.gd index e32790d..fc16847 100644 --- a/user_interface/main.gd +++ b/user_interface/main.gd @@ -20,6 +20,7 @@ func _exit_tree(): Data._save_data() Data.messages.free() Data.topics.free() + Data.miscellaneous.free() func _on_user_switched(): diff --git a/user_interface/main.tscn b/user_interface/main.tscn index e8d918a..d50d41c 100644 --- a/user_interface/main.tscn +++ b/user_interface/main.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://user_interface/chat_panel/chat_panel.tscn" type="PackedScene" id=1] [ext_resource path="res://user_interface/tool_bar/tool_bar.tscn" type="PackedScene" id=2] [ext_resource path="res://user_interface/topic_panel/topic_panel.tscn" type="PackedScene" id=3] [ext_resource path="res://user_interface/debug_panel/debug_panel.tscn" type="PackedScene" id=4] [ext_resource path="res://user_interface/call_panel/call_panel.tscn" type="PackedScene" id=5] +[ext_resource path="res://user_interface/settings_menu/settings_menu.tscn" type="PackedScene" id=6] [ext_resource path="res://user_interface/main.theme" type="Theme" id=9] [ext_resource path="res://user_interface/main.gd" type="Script" id=13] @@ -69,4 +70,9 @@ margin_bottom = 560.0 [node name="ChatPanel" parent="Panel/MarginContainer/VBoxContainer/HBoxContainer" instance=ExtResource( 1 )] margin_bottom = 560.0 +[node name="SettingsCanvasLayer" type="CanvasLayer" parent="."] + +[node name="SettingsMenu" parent="SettingsCanvasLayer" instance=ExtResource( 6 )] +visible = false + [connection signal="resized" from="." to="." method="_on_resized"] diff --git a/user_interface/settings_menu/debug_settings/debug_settings.tscn b/user_interface/settings_menu/debug_settings/debug_settings.tscn new file mode 100644 index 0000000..f48feef --- /dev/null +++ b/user_interface/settings_menu/debug_settings/debug_settings.tscn @@ -0,0 +1,123 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://user_interface/utility_controls/line_separator.tscn" type="PackedScene" id=1] +[ext_resource path="res://user_interface/settings_menu/debug_settings/time_offset.gd" type="Script" id=2] +[ext_resource path="res://user_interface/settings_menu/debug_settings/restart.gd" type="Script" id=3] + +[node name="DebugSettings" type="VBoxContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="LineSeparator" parent="." instance=ExtResource( 1 )] +anchor_right = 0.0 +margin_right = 1024.0 +margin_bottom = 15.0 +tag = "Debug Settings" + +[node name="TimeOffset" type="Control" parent="."] +margin_top = 19.0 +margin_right = 1024.0 +margin_bottom = 83.0 +rect_min_size = Vector2( 0, 64 ) +script = ExtResource( 2 ) + +[node name="LabelTimeOffset" type="Label" parent="TimeOffset"] +margin_top = 5.0 +margin_right = 79.0 +margin_bottom = 19.0 +text = "Time Offset:" + +[node name="Hours" type="Label" parent="TimeOffset"] +margin_left = 34.0 +margin_top = 32.0 +margin_right = 76.0 +margin_bottom = 46.0 +text = "Hours:" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="SpinBoxHours" type="SpinBox" parent="TimeOffset"] +margin_left = 86.0 +margin_top = 28.0 +margin_right = 160.0 +margin_bottom = 52.0 +min_value = -48.0 +max_value = 48.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Minutes" type="Label" parent="TimeOffset"] +margin_left = 186.0 +margin_top = 32.0 +margin_right = 242.0 +margin_bottom = 46.0 +text = "Minutes:" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="SpinBoxMinutes" type="SpinBox" parent="TimeOffset"] +margin_left = 253.0 +margin_top = 28.0 +margin_right = 327.0 +margin_bottom = 52.0 +min_value = -59.0 +max_value = 59.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ApplyTimeOffset" type="Button" parent="TimeOffset"] +margin_left = 363.0 +margin_top = 28.0 +margin_right = 490.0 +margin_bottom = 48.0 +text = "Apply Time Offset" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="LabelTO" type="Label" parent="TimeOffset"] +margin_left = 509.0 +margin_top = 32.0 +margin_right = 549.0 +margin_bottom = 46.0 +text = "to:" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Restart" type="Control" parent="."] +margin_top = 87.0 +margin_right = 1024.0 +margin_bottom = 151.0 +rect_min_size = Vector2( 0, 64 ) +script = ExtResource( 3 ) + +[node name="LabelRestart" type="Label" parent="Restart"] +margin_right = 40.0 +margin_bottom = 14.0 +text = "Restart:" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="RestartButton" type="Button" parent="Restart"] +margin_left = 34.0 +margin_top = 29.0 +margin_right = 46.0 +margin_bottom = 49.0 +text = "Restart Application" +__meta__ = { +"_edit_use_anchors_": false +} + +[connection signal="value_changed" from="TimeOffset/SpinBoxHours" to="TimeOffset" method="_update_unapplied_time_offset"] +[connection signal="value_changed" from="TimeOffset/SpinBoxMinutes" to="TimeOffset" method="_update_unapplied_time_offset"] +[connection signal="pressed" from="TimeOffset/ApplyTimeOffset" to="TimeOffset" method="_on_ApplyTimeOffset_pressed"] +[connection signal="pressed" from="Restart/RestartButton" to="Restart" method="_on_RestartButton_pressed"] diff --git a/user_interface/settings_menu/debug_settings/restart.gd b/user_interface/settings_menu/debug_settings/restart.gd new file mode 100644 index 0000000..4f430b3 --- /dev/null +++ b/user_interface/settings_menu/debug_settings/restart.gd @@ -0,0 +1,6 @@ +extends Control + + +func _on_RestartButton_pressed(): +# warning-ignore:return_value_discarded + get_tree().reload_current_scene() diff --git a/user_interface/settings_menu/debug_settings/time_offset.gd b/user_interface/settings_menu/debug_settings/time_offset.gd new file mode 100644 index 0000000..f595fed --- /dev/null +++ b/user_interface/settings_menu/debug_settings/time_offset.gd @@ -0,0 +1,33 @@ +extends Control + +onready var label_t_o = get_node("LabelTO") +onready var spin_box_hours = get_node("SpinBoxHours") +onready var spin_box_minutes = get_node("SpinBoxMinutes") + +var unapplied_time_offset: int + + +func _ready(): +# warning-ignore:integer_division + var offset_hours = Time.offset / 3600 +# warning-ignore:integer_division + var offset_minutes = Time.offset % 3600 / 60 + + spin_box_hours.value = offset_hours + spin_box_minutes.value = offset_minutes + _display_applied_time_offset() + + +func _update_unapplied_time_offset(_value): + var offset_hours = spin_box_hours.value * 3600 + var offset_minutes = spin_box_minutes.value * 60 + unapplied_time_offset = offset_hours + offset_minutes + + +func _on_ApplyTimeOffset_pressed(): + Time.offset = unapplied_time_offset + _display_applied_time_offset() + + +func _display_applied_time_offset(): + label_t_o.text = "Applied Time Offset: " + str(Time.offset) + "s" diff --git a/user_interface/settings_menu/icons/close.png b/user_interface/settings_menu/icons/close.png new file mode 100644 index 0000000..b2c15af Binary files /dev/null and b/user_interface/settings_menu/icons/close.png differ diff --git a/user_interface/settings_menu/icons/close.png.import b/user_interface/settings_menu/icons/close.png.import new file mode 100644 index 0000000..3be8729 --- /dev/null +++ b/user_interface/settings_menu/icons/close.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/close.png-3d17fd8754f6244ca24b7915a06a12bb.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://user_interface/settings_menu/icons/close.png" +dest_files=[ "res://.import/close.png-3d17fd8754f6244ca24b7915a06a12bb.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/user_interface/settings_menu/icons/close_hover.png b/user_interface/settings_menu/icons/close_hover.png new file mode 100644 index 0000000..c2a002f Binary files /dev/null and b/user_interface/settings_menu/icons/close_hover.png differ diff --git a/user_interface/settings_menu/icons/close_hover.png.import b/user_interface/settings_menu/icons/close_hover.png.import new file mode 100644 index 0000000..9b57e2f --- /dev/null +++ b/user_interface/settings_menu/icons/close_hover.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/close_hover.png-50bb62d3aaba3846e79e3db8d1f8a4ad.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://user_interface/settings_menu/icons/close_hover.png" +dest_files=[ "res://.import/close_hover.png-50bb62d3aaba3846e79e3db8d1f8a4ad.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/user_interface/settings_menu/icons/close_pressed.png b/user_interface/settings_menu/icons/close_pressed.png new file mode 100644 index 0000000..688b945 Binary files /dev/null and b/user_interface/settings_menu/icons/close_pressed.png differ diff --git a/user_interface/settings_menu/icons/close_pressed.png.import b/user_interface/settings_menu/icons/close_pressed.png.import new file mode 100644 index 0000000..3d7c68c --- /dev/null +++ b/user_interface/settings_menu/icons/close_pressed.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/close_pressed.png-81e5d53bea00f1f05292aaa00fc94960.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://user_interface/settings_menu/icons/close_pressed.png" +dest_files=[ "res://.import/close_pressed.png-81e5d53bea00f1f05292aaa00fc94960.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/user_interface/settings_menu/settings_menu.gd b/user_interface/settings_menu/settings_menu.gd new file mode 100644 index 0000000..6e0d859 --- /dev/null +++ b/user_interface/settings_menu/settings_menu.gd @@ -0,0 +1,20 @@ +extends Control + + +func _ready(): +# warning-ignore:return_value_discarded + Settings.connect("settings_menu_requested", self, "_on_requested") + + +func _on_requested(): + visible = true + + +func _on_ColorRect_gui_input(event): + if event is InputEventMouseButton: + if event.button_index == BUTTON_LEFT and event.is_pressed(): + visible = false + + +func _on_CloseButton_pressed(): + visible = false diff --git a/user_interface/settings_menu/settings_menu.theme b/user_interface/settings_menu/settings_menu.theme new file mode 100644 index 0000000..2d2a675 Binary files /dev/null and b/user_interface/settings_menu/settings_menu.theme differ diff --git a/user_interface/settings_menu/settings_menu.tscn b/user_interface/settings_menu/settings_menu.tscn new file mode 100644 index 0000000..0b334ce --- /dev/null +++ b/user_interface/settings_menu/settings_menu.tscn @@ -0,0 +1,80 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://user_interface/settings_menu/settings_menu.theme" type="Theme" id=1] +[ext_resource path="res://user_interface/settings_menu/settings_menu.gd" type="Script" id=2] +[ext_resource path="res://user_interface/settings_menu/icons/close_hover.png" type="Texture" id=3] +[ext_resource path="res://user_interface/settings_menu/icons/close_pressed.png" type="Texture" id=4] +[ext_resource path="res://user_interface/settings_menu/icons/close.png" type="Texture" id=5] +[ext_resource path="res://user_interface/settings_menu/debug_settings/debug_settings.tscn" type="PackedScene" id=6] + +[node name="SettingsMenu" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +theme = ExtResource( 1 ) +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ColorRect" type="ColorRect" parent="."] +self_modulate = Color( 0, 0, 0, 0.501961 ) +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MarginContainer" type="MarginContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +custom_constants/margin_right = 32 +custom_constants/margin_top = 32 +custom_constants/margin_left = 32 +custom_constants/margin_bottom = 32 + +[node name="PanelContainer" type="PanelContainer" parent="MarginContainer"] +margin_left = 32.0 +margin_top = 32.0 +margin_right = 992.0 +margin_bottom = 544.0 + +[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/PanelContainer"] +margin_right = 960.0 +margin_bottom = 512.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/PanelContainer/MarginContainer"] +margin_left = 8.0 +margin_top = 8.0 +margin_right = 952.0 +margin_bottom = 504.0 + +[node name="CloseButton" type="TextureButton" parent="MarginContainer/PanelContainer/MarginContainer/VBoxContainer"] +self_modulate = Color( 1, 1, 1, 0.658824 ) +margin_left = 912.0 +margin_right = 944.0 +margin_bottom = 32.0 +size_flags_horizontal = 8 +texture_normal = ExtResource( 5 ) +texture_pressed = ExtResource( 4 ) +texture_hover = ExtResource( 3 ) + +[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/PanelContainer/MarginContainer/VBoxContainer"] +margin_top = 40.0 +margin_right = 944.0 +margin_bottom = 496.0 +size_flags_vertical = 3 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/PanelContainer/MarginContainer/VBoxContainer/ScrollContainer"] +margin_right = 944.0 +margin_bottom = 151.0 +size_flags_horizontal = 3 + +[node name="DebugSettings" parent="MarginContainer/PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" instance=ExtResource( 6 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 944.0 +margin_bottom = 151.0 + +[connection signal="gui_input" from="ColorRect" to="." method="_on_ColorRect_gui_input"] +[connection signal="pressed" from="MarginContainer/PanelContainer/MarginContainer/VBoxContainer/CloseButton" to="." method="_on_CloseButton_pressed"] diff --git a/user_interface/tool_bar/call_button.gd b/user_interface/tool_bar/call_button.gd index c0df45e..b3c6ad7 100644 --- a/user_interface/tool_bar/call_button.gd +++ b/user_interface/tool_bar/call_button.gd @@ -1,5 +1,33 @@ extends TextureButton +const START_CALL_NORMAL = preload("res://user_interface/tool_bar/icons/start_call.png") +const START_CALL_HOVER = preload("res://user_interface/tool_bar/icons/start_call_hover.png") +const START_CALL_PRESSED = preload("res://user_interface/tool_bar/icons/start_call_pressed.png") + +const END_CALL_NORMAL = preload("res://user_interface/tool_bar/icons/end_call.png") +const END_CALL_HOVER = preload("res://user_interface/tool_bar/icons/end_call_hover.png") +const END_CALL_PRESSED = preload("res://user_interface/tool_bar/icons/end_call_pressed.png") + + func _on_toggled(_button_pressed): Call.request_call() + + +func _on_pressed(): + if Call.is_call_active: + Call.is_call_active = false + texture_normal = START_CALL_NORMAL + texture_hover = START_CALL_HOVER + texture_pressed = START_CALL_PRESSED + else: + Call.is_call_active = true + texture_normal = END_CALL_NORMAL + texture_hover = END_CALL_HOVER + texture_pressed = END_CALL_PRESSED + + +func _on_mouse_exited(): + if Call.is_call_active: + #texture_hover = END_CALL_HOVER + pass diff --git a/user_interface/tool_bar/mute_button.gd b/user_interface/tool_bar/mute_button.gd index 340d8d3..088b016 100644 --- a/user_interface/tool_bar/mute_button.gd +++ b/user_interface/tool_bar/mute_button.gd @@ -22,5 +22,10 @@ func _on_pressed(): Call.muted = true mute_dash.visible = true texture_normal = UNMUTE_NORMAL - texture_hover = UNMUTE_HOVER + texture_hover = UNMUTE_NORMAL texture_pressed = UNMUTE_PRESSED + + +func _on_mouse_exited(): + if Call.muted: + texture_hover = UNMUTE_HOVER diff --git a/user_interface/tool_bar/settings_button.gd b/user_interface/tool_bar/settings_button.gd index 447fbc5..607391a 100644 --- a/user_interface/tool_bar/settings_button.gd +++ b/user_interface/tool_bar/settings_button.gd @@ -2,5 +2,4 @@ extends TextureButton # settings_button.gd func _on_pressed(): -# warning-ignore:return_value_discarded - get_tree().reload_current_scene() + Settings.emit_signal("settings_menu_requested") diff --git a/user_interface/tool_bar/tool_bar.tscn b/user_interface/tool_bar/tool_bar.tscn index ab267de..1041415 100644 --- a/user_interface/tool_bar/tool_bar.tscn +++ b/user_interface/tool_bar/tool_bar.tscn @@ -107,7 +107,6 @@ margin_top = 7.0 margin_right = 214.0 margin_bottom = 39.0 size_flags_vertical = 4 -toggle_mode = true texture_normal = ExtResource( 7 ) texture_pressed = ExtResource( 16 ) texture_hover = ExtResource( 4 ) @@ -132,6 +131,7 @@ script = ExtResource( 11 ) visible = false anchor_right = 1.0 anchor_bottom = 1.0 +mouse_filter = 2 texture = ExtResource( 12 ) __meta__ = { "_edit_use_anchors_": false @@ -149,7 +149,9 @@ texture_pressed = ExtResource( 15 ) texture_hover = ExtResource( 14 ) script = ExtResource( 18 ) +[connection signal="mouse_exited" from="Margin/Structure/CallButton" to="Margin/Structure/CallButton" method="_on_mouse_exited"] +[connection signal="pressed" from="Margin/Structure/CallButton" to="Margin/Structure/CallButton" method="_on_pressed"] [connection signal="toggled" from="Margin/Structure/CallButton" to="Margin/Structure/CallButton" method="_on_toggled"] +[connection signal="mouse_exited" from="Margin/Structure/MuteButton" to="Margin/Structure/MuteButton" method="_on_mouse_exited"] [connection signal="pressed" from="Margin/Structure/MuteButton" to="Margin/Structure/MuteButton" method="_on_pressed"] -[connection signal="toggled" from="Margin/Structure/MuteButton" to="Margin/Structure/MuteButton" method="_on_toggled"] [connection signal="pressed" from="Margin/Structure/SettingsButton" to="Margin/Structure/SettingsButton" method="_on_pressed"] diff --git a/user_interface/topic_panel/add_button.tscn b/user_interface/topic_panel/add_button.tscn index 5e35b59..95aa94d 100644 --- a/user_interface/topic_panel/add_button.tscn +++ b/user_interface/topic_panel/add_button.tscn @@ -6,6 +6,7 @@ [ext_resource path="res://user_interface/topic_panel/add_button.gd" type="Script" id=4] [node name="AddButton" type="TextureButton"] +self_modulate = Color( 0.231373, 0.266667, 0.321569, 1 ) rect_min_size = Vector2( 0, 56 ) size_flags_horizontal = 3 texture_normal = ExtResource( 1 ) diff --git a/user_interface/topic_panel/topic_draggable.gd b/user_interface/topic_panel/topic_draggable.gd index 76da79b..f1fec3a 100644 --- a/user_interface/topic_panel/topic_draggable.gd +++ b/user_interface/topic_panel/topic_draggable.gd @@ -33,9 +33,6 @@ func _gui_input(event): if not editable.edit_mode: if event.doubleclick: editable._enable_edit_mode() - editable.text_edit.grab_focus() - yield(get_tree(), "idle_frame") - editable.text_edit.select_all() elif !_in_fit_in_animation: _set_as_grabbed() diff --git a/user_interface/topic_panel/topic_editable.gd b/user_interface/topic_panel/topic_editable.gd index 1daeda2..f07b47f 100644 --- a/user_interface/topic_panel/topic_editable.gd +++ b/user_interface/topic_panel/topic_editable.gd @@ -94,9 +94,6 @@ func _on_popup_menu_id_pressed(id): Data.topics.insert_topic(parent.get_index()) 1: # Edit. _enable_edit_mode() - text_edit.grab_focus() - yield(get_tree(), "idle_frame") - text_edit.select_all() 2: # Change type to CASUAL. if _is_part_of_multi_selection(): parent.topic_feed._change_type_of_selected_topics(TYPE_CASUAL) diff --git a/user_interface/utility_controls/editable_text_block.gd b/user_interface/utility_controls/editable_text_block.gd index 2b0b5dd..5c1d123 100644 --- a/user_interface/utility_controls/editable_text_block.gd +++ b/user_interface/utility_controls/editable_text_block.gd @@ -131,6 +131,10 @@ func _enable_edit_mode(): _post_enable_edit_mode() text_edit.adjust_size() + + text_edit.grab_focus() + yield(get_tree(), "idle_frame") + text_edit.select_all() func _post_enable_edit_mode(): # Virtual. diff --git a/user_interface/utility_controls/line_separator.gd b/user_interface/utility_controls/line_separator.gd new file mode 100644 index 0000000..8725bb2 --- /dev/null +++ b/user_interface/utility_controls/line_separator.gd @@ -0,0 +1,24 @@ +tool +extends HBoxContainer + +export(String) var tag setget _set_tag + +onready var separation_tag = get_node("SeparationTag") + + +func _ready(): + _set_separation_tag_text(tag) + + +func _set_tag(value): + tag = value + if not separation_tag: + return + _set_separation_tag_text(value) + + +func _set_separation_tag_text(text): + if text != "": + separation_tag.text = text + else: + separation_tag.text = "Separation Tag" diff --git a/user_interface/utility_controls/line_separator.tscn b/user_interface/utility_controls/line_separator.tscn new file mode 100644 index 0000000..b70bf96 --- /dev/null +++ b/user_interface/utility_controls/line_separator.tscn @@ -0,0 +1,38 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://user_interface/utility_controls/line_separator.gd" type="Script" id=1] +[ext_resource path="res://user_interface/utility_controls/separation_line.gd" type="Script" id=2] +[ext_resource path="res://user_interface/fonts/separator_font.tres" type="DynamicFont" id=3] + +[node name="LineSeparator" type="HBoxContainer"] +modulate = Color( 1, 1, 1, 0.501961 ) +anchor_right = 1.0 +margin_bottom = 14.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="LeftLine" type="Control" parent="."] +margin_right = 64.0 +margin_bottom = 15.0 +rect_min_size = Vector2( 64, 0 ) +script = ExtResource( 2 ) + +[node name="SeparationTag" type="Label" parent="."] +margin_left = 68.0 +margin_right = 182.0 +margin_bottom = 15.0 +size_flags_horizontal = 4 +custom_fonts/font = ExtResource( 3 ) +text = "[Separation Tag]" + +[node name="RightLine" type="Control" parent="."] +margin_left = 186.0 +margin_right = 1024.0 +margin_bottom = 15.0 +size_flags_horizontal = 3 +script = ExtResource( 2 ) + +[connection signal="resized" from="LeftLine" to="LeftLine" method="_on_resized"] +[connection signal="resized" from="RightLine" to="RightLine" method="_on_resized"] diff --git a/user_interface/utility_controls/separation_line.gd b/user_interface/utility_controls/separation_line.gd new file mode 100644 index 0000000..ff31eec --- /dev/null +++ b/user_interface/utility_controls/separation_line.gd @@ -0,0 +1,13 @@ +tool +extends Control + + +func _draw(): + draw_line( + Vector2(0.0, get_rect().size.y * 0.5), + Vector2(get_rect().size.x, get_rect().size.y * 0.5), + Color.white + ) + +func _on_resized(): + update()