initial shell work
This commit is contained in:
@ -2,10 +2,8 @@ extends Node
|
||||
|
||||
var _connection
|
||||
|
||||
onready var n_Connection := get_node("Connections")
|
||||
|
||||
func _ready():
|
||||
_connection = n_Connection.establish_new_connection("poto.cafe", "veclavtalica", "-")
|
||||
_connection = Connections.establish_new_connection("poto.cafe", "veclavtalica", "-")
|
||||
if _connection == null:
|
||||
push_error("Connection failed")
|
||||
return
|
||||
|
@ -1,14 +1,9 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/Connections.gd" type="Script" id=1]
|
||||
[ext_resource path="res://scenes/App.gd" type="Script" id=2]
|
||||
[ext_resource path="res://scenes/shell/Shell.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="App" type="Node"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Shell" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
[node name="Connections" type="Node" parent="."]
|
||||
script = ExtResource( 1 )
|
||||
[node name="Shell" parent="." instance=ExtResource( 3 )]
|
||||
|
@ -1,5 +1,4 @@
|
||||
extends Node
|
||||
class_name Connections
|
||||
|
||||
# todo: Settle on whether connection should send Sums.Result or receiver should check stanza errors by itself.
|
||||
|
||||
|
9
scenes/Shell.gd
Normal file
9
scenes/Shell.gd
Normal file
@ -0,0 +1,9 @@
|
||||
extends Control
|
||||
class_name Shell
|
||||
|
||||
static func get_shell(node: Node) -> Node:
|
||||
if node == node.get_tree().root:
|
||||
assert(false)
|
||||
if node.name == "Shell":
|
||||
return node
|
||||
return get_shell(node.get_parent())
|
16
scenes/shell/ConnectionPopup.gd
Normal file
16
scenes/shell/ConnectionPopup.gd
Normal file
@ -0,0 +1,16 @@
|
||||
extends WindowDialog
|
||||
|
||||
signal auth_entered(user, password)
|
||||
|
||||
func _ready() -> void:
|
||||
if connect("hide", self, "_on_hidden") != OK:
|
||||
assert(false)
|
||||
if find_node("Connect").connect("pressed", self, "_on_connect_pressed") != OK:
|
||||
assert(false)
|
||||
|
||||
func _on_hidden() -> void:
|
||||
find_node("UserEdit").text = "user"
|
||||
find_node("PasswordEdit").text = "password"
|
||||
|
||||
func _on_connect_pressed() -> void:
|
||||
emit_signal("auth_entered", find_node("UserEdit").text, find_node("PasswordEdit").text)
|
57
scenes/shell/ConnectionPopup.tscn
Normal file
57
scenes/shell/ConnectionPopup.tscn
Normal file
@ -0,0 +1,57 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/shell/ConnectionPopup.gd" type="Script" id=1]
|
||||
|
||||
[node name="PopupPanel" type="WindowDialog"]
|
||||
margin_left = 128.0
|
||||
margin_top = 136.0
|
||||
margin_right = 448.0
|
||||
margin_bottom = 320.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
window_title = "New Connection"
|
||||
resizable = true
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="UserEdit" type="LineEdit" parent="VBoxContainer"]
|
||||
margin_right = 320.0
|
||||
margin_bottom = 26.0
|
||||
text = "user"
|
||||
clear_button_enabled = true
|
||||
caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="PasswordEdit" type="LineEdit" parent="VBoxContainer"]
|
||||
margin_top = 30.0
|
||||
margin_right = 320.0
|
||||
margin_bottom = 56.0
|
||||
size_flags_vertical = 2
|
||||
text = "password"
|
||||
secret = true
|
||||
clear_button_enabled = true
|
||||
caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="Feedback" type="Label" parent="VBoxContainer"]
|
||||
margin_top = 146.0
|
||||
margin_right = 320.0
|
||||
margin_bottom = 160.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 164.0
|
||||
margin_right = 320.0
|
||||
margin_bottom = 184.0
|
||||
|
||||
[node name="Connect" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_right = 64.0
|
||||
margin_bottom = 20.0
|
||||
text = "Connect"
|
56
scenes/shell/Groupchat.tscn
Normal file
56
scenes/shell/Groupchat.tscn
Normal file
@ -0,0 +1,56 @@
|
||||
[gd_scene format=2]
|
||||
|
||||
[node name="VBoxContainer" type="MarginContainer"]
|
||||
margin_left = 12.0
|
||||
margin_right = 436.0
|
||||
margin_bottom = 320.0
|
||||
mouse_filter = 1
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="MarginContainer" type="VSplitContainer" parent="."]
|
||||
margin_right = 424.0
|
||||
margin_bottom = 320.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
margin_right = 424.0
|
||||
margin_bottom = 156.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="MarginContainer/VBoxContainer"]
|
||||
margin_right = 424.0
|
||||
margin_bottom = 23.0
|
||||
focus_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "[right][color=gray]User0[/color]: What's up, dog?"
|
||||
text = "User0: What's up, dog?"
|
||||
fit_content_height = true
|
||||
selection_enabled = true
|
||||
|
||||
[node name="RichTextLabel2" type="RichTextLabel" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 27.0
|
||||
margin_right = 424.0
|
||||
margin_bottom = 50.0
|
||||
focus_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "[color=red]me[/color]: Not much."
|
||||
text = "me: Not much."
|
||||
fit_content_height = true
|
||||
selection_enabled = true
|
||||
|
||||
[node name="TextEdit" type="TextEdit" parent="MarginContainer"]
|
||||
margin_top = 164.0
|
||||
margin_right = 424.0
|
||||
margin_bottom = 320.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "message"
|
||||
highlight_all_occurrences = true
|
||||
drag_and_drop_selection_enabled = false
|
||||
smooth_scrolling = true
|
||||
wrap_enabled = true
|
19
scenes/shell/Input.gd
Normal file
19
scenes/shell/Input.gd
Normal file
@ -0,0 +1,19 @@
|
||||
extends Node2D
|
||||
|
||||
onready var n_DetachedViews := get_parent().find_node("DetachedViews")
|
||||
|
||||
func _input(event):
|
||||
if not event is InputEventMouseButton:
|
||||
return
|
||||
|
||||
var stack := []
|
||||
for view in n_DetachedViews.get_children():
|
||||
view.get_node("WindowDialog").hide()
|
||||
if view.get_node("WindowDialog").get_rect().has_point(event.position):
|
||||
stack.push_back(view)
|
||||
|
||||
if stack.size() > 0:
|
||||
var front = stack.pop_back()
|
||||
for view in stack:
|
||||
view.get_node("WindowDialog").popup()
|
||||
front.get_node("WindowDialog").popup()
|
26
scenes/shell/ResourceView.gd
Normal file
26
scenes/shell/ResourceView.gd
Normal file
@ -0,0 +1,26 @@
|
||||
extends Tree
|
||||
|
||||
var _root: TreeItem
|
||||
|
||||
onready var n_DropMenu = Shell.get_shell(self).get_node("DropMenu")
|
||||
|
||||
func _ready() -> void:
|
||||
# todo: Selection via keys.
|
||||
if connect("item_rmb_selected", self, "_on_mouse_selected") != OK:
|
||||
assert(false)
|
||||
|
||||
_root = create_item()
|
||||
var server = create_item(_root)
|
||||
server.set_text(0, "user@poto.cafe")
|
||||
var muc = create_item(server)
|
||||
muc.set_text(0, "muc@poto.cafe")
|
||||
muc.set_tooltip(0, "Conference")
|
||||
var room = create_item(muc)
|
||||
room.set_text(0, "room.muc@poto.cafe")
|
||||
var button = room.add_button(0, Texture.new())
|
||||
var members = create_item(room)
|
||||
members.set_text(0, "8 participants")
|
||||
|
||||
func _on_mouse_selected(position: Vector2) -> void:
|
||||
n_DropMenu.popup(Rect2(position, Vector2.ZERO))
|
||||
n_DropMenu.rect_position = rect_global_position + position
|
19
scenes/shell/ServerResources.gd
Normal file
19
scenes/shell/ServerResources.gd
Normal file
@ -0,0 +1,19 @@
|
||||
extends Node
|
||||
|
||||
var n_Popup: Node
|
||||
|
||||
func _enter_tree() -> void:
|
||||
n_Popup = preload("res://scenes/shell/ConnectionPopup.tscn").instance()
|
||||
get_parent().call_deferred("add_child", n_Popup)
|
||||
if n_Popup.connect("auth_entered", self, "_on_auth_entered") != OK:
|
||||
assert(false)
|
||||
|
||||
func _on_auth_entered(user, password) -> void:
|
||||
print(user, password)
|
||||
|
||||
func _ready() -> void:
|
||||
if find_node("AddConnection").connect("pressed", self, "_on_add_new_server_pressed") != OK:
|
||||
assert(false)
|
||||
|
||||
func _on_add_new_server_pressed() -> void:
|
||||
n_Popup.popup()
|
1
scenes/shell/Shell.gd
Normal file
1
scenes/shell/Shell.gd
Normal file
@ -0,0 +1 @@
|
||||
extends Shell
|
135
scenes/shell/Shell.tscn
Normal file
135
scenes/shell/Shell.tscn
Normal file
@ -0,0 +1,135 @@
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/shell/ResourceView.gd" type="Script" id=1]
|
||||
[ext_resource path="res://scenes/shell/ServerResources.gd" type="Script" id=2]
|
||||
[ext_resource path="res://scenes/shell/View.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://themes/jc.godot.plane-editor-theme-main/Themes/Dark/Default/DarkPlane.tres" type="Theme" id=4]
|
||||
[ext_resource path="res://scenes/shell/Shell.gd" type="Script" id=5]
|
||||
[ext_resource path="res://scenes/shell/Groupchat.tscn" type="PackedScene" id=6]
|
||||
|
||||
[sub_resource type="Gradient" id=1]
|
||||
interpolation_mode = 2
|
||||
offsets = PoolRealArray( 0, 0.818182, 1 )
|
||||
colors = PoolColorArray( 1, 0.429688, 0.429688, 1, 0.791634, 0.590696, 0.807972, 1, 1, 0.675781, 0.736572, 1 )
|
||||
|
||||
[sub_resource type="GradientTexture2D" id=2]
|
||||
gradient = SubResource( 1 )
|
||||
width = 256
|
||||
height = 256
|
||||
fill_from = Vector2( 1, 0 )
|
||||
fill_to = Vector2( 0, 0 )
|
||||
|
||||
[node name="Shell" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme = ExtResource( 4 )
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
texture = SubResource( 2 )
|
||||
expand = true
|
||||
|
||||
[node name="Views" type="PanelContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="HBoxContainer" type="HSplitContainer" parent="Views"]
|
||||
margin_left = 6.0
|
||||
margin_top = 4.0
|
||||
margin_right = 1018.0
|
||||
margin_bottom = 596.0
|
||||
mouse_filter = 1
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="View" parent="Views/HBoxContainer" instance=ExtResource( 3 )]
|
||||
margin_right = 502.0
|
||||
margin_bottom = 592.0
|
||||
title = "server resources"
|
||||
|
||||
[node name="ServerResources" type="VBoxContainer" parent="Views/HBoxContainer/View"]
|
||||
margin_left = 6.0
|
||||
margin_top = 4.0
|
||||
margin_right = 496.0
|
||||
margin_bottom = 588.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="ResourceView" type="Tree" parent="Views/HBoxContainer/View/ServerResources"]
|
||||
margin_right = 490.0
|
||||
margin_bottom = 558.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
allow_rmb_select = true
|
||||
hide_root = true
|
||||
select_mode = 1
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Views/HBoxContainer/View/ServerResources"]
|
||||
margin_top = 562.0
|
||||
margin_right = 490.0
|
||||
margin_bottom = 584.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="AddConnection" type="Button" parent="Views/HBoxContainer/View/ServerResources/HBoxContainer"]
|
||||
margin_right = 112.0
|
||||
margin_bottom = 22.0
|
||||
size_flags_horizontal = 5
|
||||
text = "Add connection"
|
||||
|
||||
[node name="VSplitContainer" type="VSplitContainer" parent="Views/HBoxContainer"]
|
||||
margin_left = 510.0
|
||||
margin_right = 1012.0
|
||||
margin_bottom = 592.0
|
||||
mouse_filter = 1
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="View2" parent="Views/HBoxContainer/VSplitContainer" instance=ExtResource( 3 )]
|
||||
margin_right = 502.0
|
||||
margin_bottom = 292.0
|
||||
title = "muc.poto@cafe/facade"
|
||||
closable = true
|
||||
|
||||
[node name="VBoxContainer" parent="Views/HBoxContainer/VSplitContainer/View2" instance=ExtResource( 6 )]
|
||||
margin_left = 6.0
|
||||
margin_top = 4.0
|
||||
margin_right = 496.0
|
||||
margin_bottom = 288.0
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="View3" parent="Views/HBoxContainer/VSplitContainer" instance=ExtResource( 3 )]
|
||||
margin_top = 300.0
|
||||
margin_right = 502.0
|
||||
margin_bottom = 592.0
|
||||
title = "muc.poto@cafe/facade"
|
||||
closable = true
|
||||
|
||||
[node name="VBoxContainer2" parent="Views/HBoxContainer/VSplitContainer/View3" instance=ExtResource( 6 )]
|
||||
margin_left = 6.0
|
||||
margin_top = 4.0
|
||||
margin_right = 496.0
|
||||
margin_bottom = 288.0
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="DropMenu" type="PopupMenu" parent="."]
|
||||
margin_left = 192.0
|
||||
margin_top = 208.0
|
||||
margin_right = 384.0
|
||||
margin_bottom = 352.0
|
||||
items = [ "Join", null, 0, false, false, 0, 0, null, "", false ]
|
||||
hide_on_checkable_item_selection = false
|
||||
allow_search = true
|
21
scenes/shell/View.gd
Normal file
21
scenes/shell/View.gd
Normal file
@ -0,0 +1,21 @@
|
||||
extends Control
|
||||
|
||||
enum {
|
||||
STATE_DETACHED,
|
||||
STATE_ATTACHED,
|
||||
}
|
||||
|
||||
var _state := STATE_DETACHED
|
||||
|
||||
onready var n_Shell = Shell.get_shell(self)
|
||||
|
||||
export var title: String
|
||||
export var closable: bool
|
||||
|
||||
func _ready() -> void:
|
||||
$VBoxContainer/Bar/HBoxContainer/Title.text = title
|
||||
|
||||
var child = get_children()[-1]
|
||||
remove_child(child)
|
||||
$VBoxContainer/ScrollableConent.add_child(child)
|
||||
rect_size = child.rect_size
|
93
scenes/shell/View.tscn
Normal file
93
scenes/shell/View.tscn
Normal file
@ -0,0 +1,93 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/shell/View.gd" type="Script" id=1]
|
||||
[ext_resource path="res://assets/icons/Close.svg" type="Texture" id=2]
|
||||
[ext_resource path="res://assets/icons/Collapse.svg" type="Texture" id=3]
|
||||
|
||||
[node name="View" type="PanelContainer"]
|
||||
margin_right = 510.0
|
||||
margin_bottom = 600.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
margin_left = 6.0
|
||||
margin_top = 4.0
|
||||
margin_right = 504.0
|
||||
margin_bottom = 596.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_left = 6.0
|
||||
margin_top = 4.0
|
||||
margin_right = 504.0
|
||||
margin_bottom = 596.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Bar" type="PanelContainer" parent="VBoxContainer"]
|
||||
margin_right = 498.0
|
||||
margin_bottom = 30.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Panel" type="Panel" parent="VBoxContainer/Bar"]
|
||||
margin_left = 6.0
|
||||
margin_top = 4.0
|
||||
margin_right = 492.0
|
||||
margin_bottom = 26.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Bar"]
|
||||
margin_left = 6.0
|
||||
margin_top = 4.0
|
||||
margin_right = 492.0
|
||||
margin_bottom = 26.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Title" type="Label" parent="VBoxContainer/Bar/HBoxContainer"]
|
||||
margin_right = 446.0
|
||||
margin_bottom = 22.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Window"
|
||||
|
||||
[node name="Minimize" type="TextureButton" parent="VBoxContainer/Bar/HBoxContainer"]
|
||||
margin_left = 450.0
|
||||
margin_right = 466.0
|
||||
margin_bottom = 22.0
|
||||
texture_normal = ExtResource( 3 )
|
||||
texture_pressed = ExtResource( 3 )
|
||||
texture_hover = ExtResource( 3 )
|
||||
texture_disabled = ExtResource( 3 )
|
||||
texture_focused = ExtResource( 3 )
|
||||
|
||||
[node name="Close" type="TextureButton" parent="VBoxContainer/Bar/HBoxContainer"]
|
||||
margin_left = 470.0
|
||||
margin_right = 486.0
|
||||
margin_bottom = 22.0
|
||||
texture_normal = ExtResource( 2 )
|
||||
texture_pressed = ExtResource( 2 )
|
||||
texture_hover = ExtResource( 2 )
|
||||
texture_disabled = ExtResource( 2 )
|
||||
texture_focused = ExtResource( 2 )
|
||||
|
||||
[node name="ScrollableConent" type="ScrollContainer" parent="VBoxContainer"]
|
||||
margin_top = 34.0
|
||||
margin_right = 498.0
|
||||
margin_bottom = 592.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="."]
|
||||
margin_left = 6.0
|
||||
margin_top = 4.0
|
||||
margin_right = 504.0
|
||||
margin_bottom = 596.0
|
||||
mouse_filter = 2
|
||||
border_color = Color( 0.647059, 0.647059, 0.647059, 1 )
|
||||
editor_only = false
|
Reference in New Issue
Block a user