mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 08:17:34 -04:00
search status
This commit is contained in:
parent
c2daf2a98d
commit
ef9d268dae
4 changed files with 105 additions and 18 deletions
|
@ -1,12 +1,15 @@
|
||||||
[gd_scene load_steps=11 format=3 uid="uid://ctam0fxigbefk"]
|
[gd_scene load_steps=14 format=3 uid="uid://ctam0fxigbefk"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/ui/search.gd" id="1_7ivk2"]
|
[ext_resource type="Script" path="res://scripts/ui/search.gd" id="1_7ivk2"]
|
||||||
[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_13io8"]
|
[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_13io8"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c28surtqjf4st" path="res://textures/search.svg" id="3_1rllf"]
|
[ext_resource type="Texture2D" uid="uid://c28surtqjf4st" path="res://textures/search.svg" id="3_1rllf"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/ui/search/search_status.gd" id="3_3p1re"]
|
||||||
[ext_resource type="Script" path="res://scripts/ui/search_go.gd" id="3_eayvw"]
|
[ext_resource type="Script" path="res://scripts/ui/search_go.gd" id="3_eayvw"]
|
||||||
[ext_resource type="Texture2D" uid="uid://byvigfpu44dnu" path="res://textures/arrow.svg" id="5_dqxpp"]
|
[ext_resource type="Texture2D" uid="uid://byvigfpu44dnu" path="res://textures/arrow.svg" id="5_dqxpp"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://8wvea7j0v0rx" path="res://textures/Reload.svg" id="5_yhqf5"]
|
||||||
[ext_resource type="Script" path="res://scripts/ui/menu/star.gd" id="6_iyikx"]
|
[ext_resource type="Script" path="res://scripts/ui/menu/star.gd" id="6_iyikx"]
|
||||||
[ext_resource type="Resource" uid="uid://bewhdj6jugt6q" path="res://resources/bookmarks.tres" id="7_2mijb"]
|
[ext_resource type="Resource" uid="uid://bewhdj6jugt6q" path="res://resources/bookmarks.tres" id="7_2mijb"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dystd8vvbqwo2" path="res://textures/exit.svg" id="7_jllve"]
|
||||||
[ext_resource type="Texture2D" uid="uid://btn6ytky782a2" path="res://textures/star.svg" id="8_b00p6"]
|
[ext_resource type="Texture2D" uid="uid://btn6ytky782a2" path="res://textures/star.svg" id="8_b00p6"]
|
||||||
[ext_resource type="Texture2D" uid="uid://lxx36xkotvh1" path="res://textures/star_filled.svg" id="9_2en0l"]
|
[ext_resource type="Texture2D" uid="uid://lxx36xkotvh1" path="res://textures/star_filled.svg" id="9_2en0l"]
|
||||||
|
|
||||||
|
@ -50,7 +53,7 @@ placeholder_text = "Search or enter address"
|
||||||
script = ExtResource("1_7ivk2")
|
script = ExtResource("1_7ivk2")
|
||||||
gate_events = ExtResource("2_13io8")
|
gate_events = ExtResource("2_13io8")
|
||||||
|
|
||||||
[node name="SearchTexture" type="TextureRect" parent="."]
|
[node name="SearchStatus" type="Control" parent="." node_paths=PackedStringArray("search_line_edit", "search", "downloading", "success", "error")]
|
||||||
self_modulate = Color(1, 1, 1, 0.8)
|
self_modulate = Color(1, 1, 1, 0.8)
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 4
|
anchors_preset = 4
|
||||||
|
@ -61,9 +64,62 @@ offset_top = -10.0
|
||||||
offset_right = 30.0
|
offset_right = 30.0
|
||||||
offset_bottom = 10.0
|
offset_bottom = 10.0
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
mouse_filter = 1
|
||||||
|
script = ExtResource("3_3p1re")
|
||||||
|
gate_events = ExtResource("2_13io8")
|
||||||
|
search_line_edit = NodePath("..")
|
||||||
|
search = NodePath("Search")
|
||||||
|
downloading = NodePath("Downloading")
|
||||||
|
success = NodePath("Success")
|
||||||
|
error = NodePath("Error")
|
||||||
|
|
||||||
|
[node name="Search" type="TextureRect" parent="SearchStatus"]
|
||||||
|
self_modulate = Color(1, 1, 1, 0.8)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
texture = ExtResource("3_1rllf")
|
texture = ExtResource("3_1rllf")
|
||||||
expand_mode = 1
|
expand_mode = 1
|
||||||
|
|
||||||
|
[node name="Downloading" type="TextureRect" parent="SearchStatus"]
|
||||||
|
visible = false
|
||||||
|
self_modulate = Color(1, 1, 1, 0.8)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = ExtResource("5_yhqf5")
|
||||||
|
expand_mode = 1
|
||||||
|
|
||||||
|
[node name="Success" type="TextureRect" parent="SearchStatus"]
|
||||||
|
visible = false
|
||||||
|
self_modulate = Color(1, 1, 1, 0.8)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = ExtResource("5_dqxpp")
|
||||||
|
expand_mode = 1
|
||||||
|
|
||||||
|
[node name="Error" type="TextureRect" parent="SearchStatus"]
|
||||||
|
visible = false
|
||||||
|
self_modulate = Color(1, 1, 1, 0.8)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = ExtResource("7_jllve")
|
||||||
|
expand_mode = 1
|
||||||
|
|
||||||
[node name="Go" type="BaseButton" parent="."]
|
[node name="Go" type="BaseButton" parent="."]
|
||||||
_import_path = NodePath("")
|
_import_path = NodePath("")
|
||||||
unique_name_in_owner = false
|
unique_name_in_owner = false
|
||||||
|
|
|
@ -35,7 +35,7 @@ tracks/0/keys = {
|
||||||
tracks/1/type = "value"
|
tracks/1/type = "value"
|
||||||
tracks/1/imported = false
|
tracks/1/imported = false
|
||||||
tracks/1/enabled = true
|
tracks/1/enabled = true
|
||||||
tracks/1/path = NodePath("VBoxContainer/Top/HBoxContainer:modulate")
|
tracks/1/path = NodePath("VBoxContainer/Top/MenuNavigation:modulate")
|
||||||
tracks/1/interp = 1
|
tracks/1/interp = 1
|
||||||
tracks/1/loop_wrap = true
|
tracks/1/loop_wrap = true
|
||||||
tracks/1/keys = {
|
tracks/1/keys = {
|
||||||
|
@ -76,7 +76,7 @@ tracks/0/keys = {
|
||||||
tracks/1/type = "value"
|
tracks/1/type = "value"
|
||||||
tracks/1/imported = false
|
tracks/1/imported = false
|
||||||
tracks/1/enabled = true
|
tracks/1/enabled = true
|
||||||
tracks/1/path = NodePath("VBoxContainer/Top/HBoxContainer:modulate")
|
tracks/1/path = NodePath("VBoxContainer/Top/MenuNavigation:modulate")
|
||||||
tracks/1/interp = 1
|
tracks/1/interp = 1
|
||||||
tracks/1/loop_wrap = true
|
tracks/1/loop_wrap = true
|
||||||
tracks/1/keys = {
|
tracks/1/keys = {
|
||||||
|
@ -117,7 +117,7 @@ tracks/0/keys = {
|
||||||
tracks/1/type = "value"
|
tracks/1/type = "value"
|
||||||
tracks/1/imported = false
|
tracks/1/imported = false
|
||||||
tracks/1/enabled = true
|
tracks/1/enabled = true
|
||||||
tracks/1/path = NodePath("VBoxContainer/Top/HBoxContainer:modulate")
|
tracks/1/path = NodePath("VBoxContainer/Top/MenuNavigation:modulate")
|
||||||
tracks/1/interp = 1
|
tracks/1/interp = 1
|
||||||
tracks/1/loop_wrap = true
|
tracks/1/loop_wrap = true
|
||||||
tracks/1/keys = {
|
tracks/1/keys = {
|
||||||
|
@ -184,7 +184,7 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_re7ca")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_re7ca")
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Top" node_paths=PackedStringArray("go_back", "go_forw", "reload", "home")]
|
[node name="MenuNavigation" type="HBoxContainer" parent="VBoxContainer/Top" node_paths=PackedStringArray("go_back", "go_forw", "reload", "home")]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 13
|
anchors_preset = 13
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
@ -204,7 +204,7 @@ go_forw = NodePath("GoForward")
|
||||||
reload = NodePath("Reload")
|
reload = NodePath("Reload")
|
||||||
home = NodePath("Home")
|
home = NodePath("Home")
|
||||||
|
|
||||||
[node name="GoBack" type="BaseButton" parent="VBoxContainer/Top/HBoxContainer"]
|
[node name="GoBack" type="BaseButton" parent="VBoxContainer/Top/MenuNavigation"]
|
||||||
_import_path = NodePath("")
|
_import_path = NodePath("")
|
||||||
unique_name_in_owner = false
|
unique_name_in_owner = false
|
||||||
process_mode = 0
|
process_mode = 0
|
||||||
|
@ -259,7 +259,7 @@ shortcut_feedback = true
|
||||||
shortcut_in_tooltip = true
|
shortcut_in_tooltip = true
|
||||||
script = null
|
script = null
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Top/HBoxContainer/GoBack"]
|
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Top/MenuNavigation/GoBack"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
@ -273,7 +273,7 @@ size_flags_vertical = 4
|
||||||
texture = ExtResource("1_wkgtd")
|
texture = ExtResource("1_wkgtd")
|
||||||
expand_mode = 1
|
expand_mode = 1
|
||||||
|
|
||||||
[node name="GoForward" type="BaseButton" parent="VBoxContainer/Top/HBoxContainer"]
|
[node name="GoForward" type="BaseButton" parent="VBoxContainer/Top/MenuNavigation"]
|
||||||
_import_path = NodePath("")
|
_import_path = NodePath("")
|
||||||
unique_name_in_owner = false
|
unique_name_in_owner = false
|
||||||
process_mode = 0
|
process_mode = 0
|
||||||
|
@ -328,7 +328,7 @@ shortcut_feedback = true
|
||||||
shortcut_in_tooltip = true
|
shortcut_in_tooltip = true
|
||||||
script = null
|
script = null
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Top/HBoxContainer/GoForward"]
|
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Top/MenuNavigation/GoForward"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
@ -340,7 +340,7 @@ size_flags_vertical = 4
|
||||||
texture = ExtResource("1_wkgtd")
|
texture = ExtResource("1_wkgtd")
|
||||||
expand_mode = 1
|
expand_mode = 1
|
||||||
|
|
||||||
[node name="Reload" type="BaseButton" parent="VBoxContainer/Top/HBoxContainer"]
|
[node name="Reload" type="BaseButton" parent="VBoxContainer/Top/MenuNavigation"]
|
||||||
_import_path = NodePath("")
|
_import_path = NodePath("")
|
||||||
unique_name_in_owner = false
|
unique_name_in_owner = false
|
||||||
process_mode = 0
|
process_mode = 0
|
||||||
|
@ -395,7 +395,7 @@ shortcut_feedback = true
|
||||||
shortcut_in_tooltip = true
|
shortcut_in_tooltip = true
|
||||||
script = null
|
script = null
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Top/HBoxContainer/Reload"]
|
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Top/MenuNavigation/Reload"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
@ -407,12 +407,12 @@ size_flags_vertical = 4
|
||||||
texture = ExtResource("1_d6dhb")
|
texture = ExtResource("1_d6dhb")
|
||||||
expand_mode = 1
|
expand_mode = 1
|
||||||
|
|
||||||
[node name="Search" parent="VBoxContainer/Top/HBoxContainer" instance=ExtResource("5_li2do")]
|
[node name="Search" parent="VBoxContainer/Top/MenuNavigation" instance=ExtResource("5_li2do")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
|
|
||||||
[node name="Home" type="BaseButton" parent="VBoxContainer/Top/HBoxContainer"]
|
[node name="Home" type="BaseButton" parent="VBoxContainer/Top/MenuNavigation"]
|
||||||
_import_path = NodePath("")
|
_import_path = NodePath("")
|
||||||
unique_name_in_owner = false
|
unique_name_in_owner = false
|
||||||
process_mode = 0
|
process_mode = 0
|
||||||
|
@ -467,7 +467,7 @@ shortcut_feedback = true
|
||||||
shortcut_in_tooltip = true
|
shortcut_in_tooltip = true
|
||||||
script = null
|
script = null
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Top/HBoxContainer/Home"]
|
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Top/MenuNavigation/Home"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
|
|
@ -10,7 +10,7 @@ signal gate_entered
|
||||||
signal exit_gate
|
signal exit_gate
|
||||||
|
|
||||||
signal download_progress(url: String, body_size: int, downloaded_bytes: int)
|
signal download_progress(url: String, body_size: int, downloaded_bytes: int)
|
||||||
signal gate_error(type: GateError)
|
signal gate_error(code: GateError)
|
||||||
|
|
||||||
enum GateError
|
enum GateError
|
||||||
{
|
{
|
||||||
|
@ -68,5 +68,5 @@ func download_progress_emit(url: String, body_size: int, downloaded_bytes: int)
|
||||||
download_progress.emit(url, body_size, downloaded_bytes)
|
download_progress.emit(url, body_size, downloaded_bytes)
|
||||||
|
|
||||||
|
|
||||||
func gate_error_emit(type: GateError) -> void:
|
func gate_error_emit(code: GateError) -> void:
|
||||||
gate_error.emit(type)
|
gate_error.emit(code)
|
||||||
|
|
31
project/scripts/ui/search/search_status.gd
Normal file
31
project/scripts/ui/search/search_status.gd
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
@export var gate_events: GateEvents
|
||||||
|
@export var search_line_edit: LineEdit
|
||||||
|
|
||||||
|
@export var search: Control
|
||||||
|
@export var downloading: Control
|
||||||
|
@export var success: Control
|
||||||
|
@export var error: Control
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
search_line_edit.text_changed.connect(func(_text): switch_to(search))
|
||||||
|
gate_events.exit_gate.connect(func(): switch_to(search))
|
||||||
|
gate_events.open_gate.connect(func(_url): switch_to(downloading))
|
||||||
|
gate_events.gate_entered.connect(func(): switch_to(success))
|
||||||
|
gate_events.gate_error.connect(func(_code): switch_to(error))
|
||||||
|
|
||||||
|
switch_to(search)
|
||||||
|
|
||||||
|
|
||||||
|
func switch_to(_state: Control) -> void:
|
||||||
|
disable([search, downloading, success, error])
|
||||||
|
_state.visible = true
|
||||||
|
_state.process_mode = Node.PROCESS_MODE_INHERIT
|
||||||
|
|
||||||
|
|
||||||
|
func disable(states: Array[Control]) -> void:
|
||||||
|
for state in states:
|
||||||
|
state.visible = false
|
||||||
|
state.process_mode = Node.PROCESS_MODE_DISABLED
|
Loading…
Add table
Add a link
Reference in a new issue