add todos app

This commit is contained in:
Fabien Freling 2026-04-28 13:47:29 +02:00
parent 25a62f9c43
commit dfff9d383c
28 changed files with 648 additions and 1 deletions

2
todos/.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

2
todos/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/

57
todos/NewEntry.tscn Normal file
View file

@ -0,0 +1,57 @@
[gd_scene format=3 uid="uid://dutnsmmhm8px6"]
[node name="PopupPanel" type="PopupPanel" unique_id=1480508047]
oversampling_override = 1.0
size = Vector2i(100, 389)
visible = true
[node name="GridContainer" type="GridContainer" parent="." unique_id=545204867]
offset_left = 4.0
offset_top = 4.0
offset_right = 96.0
offset_bottom = 385.0
columns = 3
[node name="0" type="Button" parent="GridContainer" unique_id=1587740652]
layout_mode = 2
text = "0"
[node name="1" type="Button" parent="GridContainer" unique_id=196215655]
layout_mode = 2
text = "1"
[node name="2" type="Button" parent="GridContainer" unique_id=1297712196]
layout_mode = 2
text = "2"
[node name="3" type="Button" parent="GridContainer" unique_id=1489651124]
layout_mode = 2
text = "3"
[node name="4" type="Button" parent="GridContainer" unique_id=122086073]
layout_mode = 2
text = "4"
[node name="5" type="Button" parent="GridContainer" unique_id=1573844743]
layout_mode = 2
text = "5"
[node name="6" type="Button" parent="GridContainer" unique_id=2138965382]
layout_mode = 2
text = "6"
[node name="7" type="Button" parent="GridContainer" unique_id=144644283]
layout_mode = 2
text = "7"
[node name="8" type="Button" parent="GridContainer" unique_id=763780230]
layout_mode = 2
text = "8"
[node name="9" type="Button" parent="GridContainer" unique_id=1318253977]
layout_mode = 2
text = "9"
[node name="dot" type="Button" parent="GridContainer" unique_id=985510428]
layout_mode = 2
text = "."

1
todos/addons Symbolic link
View file

@ -0,0 +1 @@
../godot-addons

201
todos/export_presets.cfg Normal file
View file

@ -0,0 +1,201 @@
[preset.0]
name="Android"
platform="Android"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.0.options]
custom_template/debug=""
custom_template/release=""
gradle_build/use_gradle_build=false
gradle_build/export_format=0
gradle_build/min_sdk=""
gradle_build/target_sdk=""
architectures/armeabi-v7a=false
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
version/code=1
version/name=""
package/unique_name="com.example.$genname"
package/name=""
package/signed=true
package/app_category=6
package/retain_data_on_uninstall=false
package/exclude_from_recents=false
package/show_in_android_tv=false
package/show_in_app_library=true
package/show_as_launcher_app=false
launcher_icons/main_192x192=""
launcher_icons/adaptive_foreground_432x432=""
launcher_icons/adaptive_background_432x432=""
graphics/opengl_debug=false
xr_features/xr_mode=0
screen/immersive_mode=true
screen/support_small=true
screen/support_normal=true
screen/support_large=true
screen/support_xlarge=true
user_data_backup/allow=false
command_line/extra_args=""
apk_expansion/enable=false
apk_expansion/SALT=""
apk_expansion/public_key=""
permissions/custom_permissions=PackedStringArray()
permissions/access_checkin_properties=false
permissions/access_coarse_location=false
permissions/access_fine_location=false
permissions/access_location_extra_commands=false
permissions/access_mock_location=false
permissions/access_network_state=false
permissions/access_surface_flinger=false
permissions/access_wifi_state=false
permissions/account_manager=false
permissions/add_voicemail=false
permissions/authenticate_accounts=false
permissions/battery_stats=false
permissions/bind_accessibility_service=false
permissions/bind_appwidget=false
permissions/bind_device_admin=false
permissions/bind_input_method=false
permissions/bind_nfc_service=false
permissions/bind_notification_listener_service=false
permissions/bind_print_service=false
permissions/bind_remoteviews=false
permissions/bind_text_service=false
permissions/bind_vpn_service=false
permissions/bind_wallpaper=false
permissions/bluetooth=false
permissions/bluetooth_admin=false
permissions/bluetooth_privileged=false
permissions/brick=false
permissions/broadcast_package_removed=false
permissions/broadcast_sms=false
permissions/broadcast_sticky=false
permissions/broadcast_wap_push=false
permissions/call_phone=false
permissions/call_privileged=false
permissions/camera=false
permissions/capture_audio_output=false
permissions/capture_secure_video_output=false
permissions/capture_video_output=false
permissions/change_component_enabled_state=false
permissions/change_configuration=false
permissions/change_network_state=false
permissions/change_wifi_multicast_state=false
permissions/change_wifi_state=false
permissions/clear_app_cache=false
permissions/clear_app_user_data=false
permissions/control_location_updates=false
permissions/delete_cache_files=false
permissions/delete_packages=false
permissions/device_power=false
permissions/diagnostic=false
permissions/disable_keyguard=false
permissions/dump=false
permissions/expand_status_bar=false
permissions/factory_test=false
permissions/flashlight=false
permissions/force_back=false
permissions/get_accounts=false
permissions/get_package_size=false
permissions/get_tasks=false
permissions/get_top_activity_info=false
permissions/global_search=false
permissions/hardware_test=false
permissions/inject_events=false
permissions/install_location_provider=false
permissions/install_packages=false
permissions/install_shortcut=false
permissions/internal_system_window=false
permissions/internet=false
permissions/kill_background_processes=false
permissions/location_hardware=false
permissions/manage_accounts=false
permissions/manage_app_tokens=false
permissions/manage_documents=false
permissions/manage_external_storage=true
permissions/master_clear=false
permissions/media_content_control=false
permissions/modify_audio_settings=false
permissions/modify_phone_state=false
permissions/mount_format_filesystems=false
permissions/mount_unmount_filesystems=false
permissions/nfc=false
permissions/persistent_activity=false
permissions/process_outgoing_calls=false
permissions/read_calendar=false
permissions/read_call_log=false
permissions/read_contacts=false
permissions/read_external_storage=false
permissions/read_frame_buffer=false
permissions/read_history_bookmarks=false
permissions/read_input_state=false
permissions/read_logs=false
permissions/read_phone_state=false
permissions/read_profile=false
permissions/read_sms=false
permissions/read_social_stream=false
permissions/read_sync_settings=false
permissions/read_sync_stats=false
permissions/read_user_dictionary=false
permissions/reboot=false
permissions/receive_boot_completed=false
permissions/receive_mms=false
permissions/receive_sms=false
permissions/receive_wap_push=false
permissions/record_audio=false
permissions/reorder_tasks=false
permissions/restart_packages=false
permissions/send_respond_via_message=false
permissions/send_sms=false
permissions/set_activity_watcher=false
permissions/set_alarm=false
permissions/set_always_finish=false
permissions/set_animation_scale=false
permissions/set_debug_app=false
permissions/set_orientation=true
permissions/set_pointer_speed=false
permissions/set_preferred_applications=false
permissions/set_process_limit=false
permissions/set_time=false
permissions/set_time_zone=false
permissions/set_wallpaper=false
permissions/set_wallpaper_hints=false
permissions/signal_persistent_processes=false
permissions/status_bar=false
permissions/subscribed_feeds_read=false
permissions/subscribed_feeds_write=false
permissions/system_alert_window=false
permissions/transmit_ir=false
permissions/uninstall_shortcut=false
permissions/update_device_stats=false
permissions/use_credentials=false
permissions/use_sip=false
permissions/vibrate=false
permissions/wake_lock=false
permissions/write_apn_settings=false
permissions/write_calendar=false
permissions/write_call_log=false
permissions/write_contacts=false
permissions/write_external_storage=false
permissions/write_gservices=false
permissions/write_history_bookmarks=false
permissions/write_profile=false
permissions/write_secure_settings=false
permissions/write_settings=false
permissions/write_sms=false
permissions/write_social_stream=false
permissions/write_sync_settings=false
permissions/write_user_dictionary=false

72
todos/global.gd Normal file
View file

@ -0,0 +1,72 @@
extends Node
# https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html
signal state_changed(previous, new)
enum State {UNLOADED, LOADED}
const config_path = "user://logue.cfg"
var config = ConfigFile.new()
var db = SQLite.new()
var current_scene = null
var current_state = State.UNLOADED
func _ready():
var root = get_tree().root
current_scene = root.get_child(root.get_child_count() - 1)
db.verbosity_level = SQLite.VERBOSE
var err = config.load(config_path)
if err == OK:
var db_path = config.get_value("general", "db_path")
var db_success = load_db(db_path)
if not db_success:
# HACK: File picker on Android is broken
const possible_cfg_paths = ["/foo/bar/logue.cfg"]
for possible_path in possible_cfg_paths:
if FileAccess.file_exists(possible_path):
db_success = load_db(possible_path)
if db_success:
break
func switch_state(new: State):
var old = current_state
if old == new:
return
current_state = new
emit_signal("state_changed", old, new)
#signal state_changed(old, new)
func load_db(path: String):
db.path = path
var success = db.open_db()
if success:
config.set_value("general", "db_path", path)
config.save(config_path)
switch_state(State.LOADED)
else:
db.path = ""
switch_state(State.UNLOADED)
func goto_scene(path):
call_deferred("_deferred_goto_scene", path)
func _deferred_goto_scene(path):
# It is now safe to remove the current scene.
current_scene.free()
# Load the new scene.
var s = ResourceLoader.load(path)
# Instance the new scene.
current_scene = s.instantiate()
# Add it to the active scene, as child of root.
get_tree().root.add_child(current_scene)
# Optionally, to make it compatible with the SceneTree.change_scene_to_file() API.
get_tree().current_scene = current_scene

1
todos/global.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://capir2jpo8qoj

1
todos/icon.svg Normal file
View file

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 950 B

37
todos/icon.svg.import Normal file
View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bt8enetdrugnl"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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

9
todos/loaded.gd Normal file
View file

@ -0,0 +1,9 @@
extends VBoxContainer
func _on_button_2_pressed():
var p = ResourceLoader.load("res://NewEntry.tscn")
var pop_up: PopupPanel = p.instantiate()
add_child(pop_up)
#pop_up.transient = true
#pop_up.exclusive = true
pop_up.show()

1
todos/loaded.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://bis23k16mjft3

60
todos/loaded.tscn Normal file
View file

@ -0,0 +1,60 @@
[gd_scene load_steps=3 format=3 uid="uid://h1sdn3cjclqi"]
[ext_resource type="Script" path="res://loaded.gd" id="1_ntmjw"]
[ext_resource type="Theme" uid="uid://bgc6fej502w0h" path="res://theme.tres" id="2_bnfav"]
[node name="VBoxContainer" type="VBoxContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_ntmjw")
[node name="Label" type="Label" parent="."]
layout_mode = 2
text = "Loaded !"
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer"]
layout_mode = 2
alignment = 1
[node name="Label" type="Label" parent="PanelContainer/HBoxContainer"]
layout_mode = 2
text = "Foobar"
[node name="Label2" type="Label" parent="PanelContainer/HBoxContainer"]
layout_mode = 2
text = "another one"
[node name="CheckBox" type="CheckBox" parent="PanelContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 10
theme_override_font_sizes/font_size = 1
[node name="PanelContainer2" type="PanelContainer" parent="."]
layout_mode = 2
theme = ExtResource("2_bnfav")
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer2"]
layout_mode = 2
alignment = 1
[node name="TextureButton" type="TextureButton" parent="PanelContainer2/HBoxContainer"]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
size_flags_horizontal = 0
[node name="Label" type="Label" parent="PanelContainer2/HBoxContainer"]
layout_mode = 2
text = "Foobar"
[node name="Button2" type="Button" parent="PanelContainer2/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 10
text = "+ NEW"
[connection signal="pressed" from="PanelContainer2/HBoxContainer/Button2" to="." method="_on_button_2_pressed"]

21
todos/main.gd Normal file
View file

@ -0,0 +1,21 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready():
const margin_value = 25
$MarginContainer.add_theme_constant_override("margin_top", margin_value)
$MarginContainer.add_theme_constant_override("margin_left", margin_value)
$MarginContainer.add_theme_constant_override("margin_bottom", margin_value)
$MarginContainer.add_theme_constant_override("margin_right", margin_value)
Global.state_changed.connect(_update_state)
if Global.current_state == Global.State.UNLOADED:
pass
elif Global.current_state == Global.State.LOADED:
$MarginContainer.remove_child($MarginContainer/Unloaded)
var s = ResourceLoader.load("res://loaded.tscn")
var current_scene = s.instantiate()
$MarginContainer.add_child(current_scene)
func _update_state(_old: Global.State, _new: Global.State):
print("updated state")

1
todos/main.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://bc6fmmhbe0ebm

29
todos/main.tscn Normal file
View file

@ -0,0 +1,29 @@
[gd_scene load_steps=3 format=3 uid="uid://y5v0kmse8n10"]
[ext_resource type="Script" path="res://main.gd" id="1_2tuu3"]
[ext_resource type="PackedScene" uid="uid://b71wpb1vts86r" path="res://unloaded.tscn" id="2_diny5"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 1.0
offset_top = 1.0
offset_right = 1.0
offset_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_2tuu3")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_use_anchors_ = true
[node name="Unloaded" parent="MarginContainer" instance=ExtResource("2_diny5")]
layout_mode = 2

42
todos/project.godot Normal file
View file

@ -0,0 +1,42 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[animation]
compatibility/default_parent_skeleton_in_mesh_instance_3d=true
[application]
config/name="Todos"
run/main_scene="res://main.tscn"
config/features=PackedStringArray("4.6", "GL Compatibility")
config/icon="res://icon.svg"
[autoload]
Global="*res://global.gd"
[display]
window/size/viewport_width=600
window/size/viewport_height=900
window/stretch/mode="canvas_items"
window/handheld/orientation=1
[editor_plugins]
enabled=PackedStringArray()
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
textures/vram_compression/import_etc2_astc=true
environment/defaults/default_clear_color=Color(0.941176, 0.964706, 0.909804, 1)

3
todos/theme.tres Normal file
View file

@ -0,0 +1,3 @@
[gd_resource type="Theme" format=3 uid="uid://bgc6fej502w0h"]
[resource]

12
todos/unloaded.gd Normal file
View file

@ -0,0 +1,12 @@
extends CenterContainer
func _ready():
$FileDialog.mode = FileDialog.FILE_MODE_OPEN_FILE
$FileDialog.access = FileDialog.ACCESS_FILESYSTEM
$FileDialog.use_native_dialog = true
func _on_button_pressed():
$FileDialog.show()
func _on_file_dialog_file_selected(path):
Global.load_db(path)

1
todos/unloaded.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://vgg3y5l0sxkp

16
todos/unloaded.tscn Normal file
View file

@ -0,0 +1,16 @@
[gd_scene load_steps=2 format=3 uid="uid://b71wpb1vts86r"]
[ext_resource type="Script" path="res://unloaded.gd" id="1_ibvef"]
[node name="CenterContainer" type="CenterContainer"]
script = ExtResource("1_ibvef")
[node name="Button" type="Button" parent="."]
custom_minimum_size = Vector2(200, 200)
layout_mode = 2
text = "Load database"
[node name="FileDialog" type="FileDialog" parent="."]
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
[connection signal="file_selected" from="FileDialog" to="." method="_on_file_dialog_file_selected"]