Skip to content

Commit

Permalink
Merge pull request #28 from ninstar/beta
Browse files Browse the repository at this point in the history
1.2.3 Beta changes
  • Loading branch information
ninstar authored Oct 21, 2023
2 parents a0bd08c + bea7a56 commit ca67b0f
Show file tree
Hide file tree
Showing 22 changed files with 520 additions and 33 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ If you are interested in contributing by translating the project into other lang
```bash
git clone https://github.com/ninstar/Rich-Presence-U.git
```

2. Get Godot binary [here][godot] (3.5.1 or later LTS version).
2. Get Godot binary [here][godot] (3.5.3 or later LTS version).
3. Open Godot, click **Import ➜ Browse**, navigate to ``/source/project.godot``, open the file and click **Import & Edit**.
4. With the project open, go to **Editor ➜ Manage Export Templates** and click **Download and Install**.
5. After the installation is done, go to **Project ➜ Export**, click **Add** and select **Linux/X11**, **Mac OSX** or **Windows Desktop**.
Expand All @@ -59,8 +58,11 @@ godot --export "Windows Desktop" RichPresenceU.exe
- **Art, Code & Design** - NinStar
- **Database** - [All contributors](https://github.com/ninstar/Rich-Presence-U-DB#credits)
- **Translations**
- **Português** - NinStar
- **Deutsch** - DeeKay-Deluxe
- **Español** - JhoanLsuper
- **Magyar** - Feeniheelo
- **Nederlands** - Thomanski
- **Português** - NinStar

# Third-party code

Expand Down
22 changes: 14 additions & 8 deletions source/code/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ signal timer_ended()

const METADATA = "https://gist.github.com/ninstar/19c664a823d3a0312f47f5ac5e52a915/raw"
const CONFIG = "user://settings.cfg"
const VERSION = "1.1.3"
const BUILD = 1130
const VERSION = "1.2.3"
const BUILD = 1230
const CLIENT = 985449859299565649

var logger: Array
Expand Down Expand Up @@ -49,11 +49,12 @@ var metadata: Dictionary = {
}
var settings: Dictionary = {

"system": "WUP",
"system": "HAC",
"language": "",
"refresh": 86400,
"refresh": 604800,
"refresh_last": 0,
"auto_connect": false,
"keep_on": true,
"debug_log": true,
"activity": true,
"timer": 0,
Expand Down Expand Up @@ -695,6 +696,9 @@ func activity_push() -> void:
if Main.settings["activity"]:
discord_api.get_module("RichPresence").update_presence(discord_rpc)
debug_log("Pushing Discord activity: "+str(discord_rpc))

# Enable/disable screensaver
OS.keep_screen_on = settings["keep_on"]

emit_signal("status_changed")

Expand Down Expand Up @@ -722,7 +726,7 @@ func activity_push() -> void:
data_system["history"].append(data_system["game"])

# Remove last entry
if data_system["history"].size() > 5:
if data_system["history"].size() > 8:
data_system["history"].pop_front()

# Description history
Expand All @@ -737,7 +741,7 @@ func activity_push() -> void:
data_game["history"].append(_description)

# Remove last entry
if data_game["history"].size() > 5:
if data_game["history"].size() > 8:
data_game["history"].pop_front()

emit_signal("history_changed")
Expand All @@ -747,9 +751,11 @@ func activity_toggle() -> void:
if Main.settings["activity"]:
discord_api.get_module("RichPresence").update_presence(discord_rpc)
debug_log("Toggling Discord activity: "+str(discord_rpc))
OS.keep_screen_on = Main.settings["keep_on"]
else:
discord_api.get_module("RichPresence").update_presence(-1)
debug_log("Toggling Discord activity: -1")
OS.keep_screen_on = false
func clear_data(temporary_data_only: bool) -> void:

if temporary_data_only:
Expand Down Expand Up @@ -829,7 +835,6 @@ func debug_export() -> void:

# Make a copy to the executable directory
if not OS.has_feature("AppImage"):

var _binary_path: String = OS.get_executable_path().get_base_dir()
var _dir: = Directory.new()
if _dir.open(_binary_path) == OK:
Expand Down Expand Up @@ -877,7 +882,7 @@ func _on_Timer_timeout() -> void:
emit_signal("timer_ended")
emit_signal("timer_changed", 0)
OS.request_attention()

OS.keep_screen_on = false
func _on_Metadata_download_completed(result, response_code, _headers, _body) -> void:

debug_log("HTTP request completed: "+str(result)+" ("+str(response_code)+")")
Expand Down Expand Up @@ -924,3 +929,4 @@ func _on_Discord_disconnected() -> void:
emit_signal("discord_disconnected")
emit_signal("dialog_added", "res://code/ui/dialogs/popups/connection.tscn")
OS.request_attention()
OS.keep_screen_on = false
7 changes: 6 additions & 1 deletion source/code/ui/components/scripts/splash.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ func _ready() -> void:
# Connect signals
get_node("/root").connect("size_changed", self, "_on_Window_resize")
Main.connect("metadata_imported", self, "_on_Metadata_imported")
Main.connect("theme_changed", self, "_on_Theme_changed")

# Splash
visible = true
Expand All @@ -16,7 +17,6 @@ func _on_Window_resize() -> void:
$Logo.rect_pivot_offset = Vector2(rect_size.x/2, rect_size.y)

func _on_Metadata_imported() -> void:

# Animation
var _rng = RandomNumberGenerator.new()
_rng.randomize()
Expand Down Expand Up @@ -55,3 +55,8 @@ func _on_Tween_tween_started(_object: Object, _key: NodePath) -> void:
OS.get_unix_time()-Main.settings["refresh_last"] > Main.settings["refresh"]
):
Main.emit_signal("dialog_added", "res://code/ui/components/updater.tscn")

func _on_Theme_changed(new_theme: String) -> void:
# Match background and logo color
color = Color("f2f3f5") if new_theme == "light" else Color("2b2d31")
$Logo.modulate = Color("25262a") if new_theme == "light" else Color("ffffff")
2 changes: 1 addition & 1 deletion source/code/ui/components/scripts/status.gd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func _on_Discord_connect(user: Dictionary) -> void:
else:

# Display username
node_name.text = user["username"]
node_name.text = user["global_name"]
node_name.visible = true

# Connected
Expand Down
2 changes: 0 additions & 2 deletions source/code/ui/components/scripts/submit.gd
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func button_mode() -> void:
node_toggle.disabled = false
node_toggle.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
_icon.modulate.a = 1.0

else:

# Enable button
Expand Down Expand Up @@ -133,7 +132,6 @@ func _on_Button_pressed() -> void:

alert_status = true
Main.emit_signal("dialog_added", "res://code/ui/dialogs/popups/visibility.tscn")

else:

# Connect to Discord
Expand Down
17 changes: 12 additions & 5 deletions source/code/ui/pages/settings.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]

[ext_resource path="res://code/ui/pages/settings/language.tscn" type="PackedScene" id=1]
[ext_resource path="res://code/ui/pages/settings/debug.tscn" type="PackedScene" id=2]
Expand All @@ -7,6 +7,7 @@
[ext_resource path="res://code/ui/pages/settings/theme.tscn" type="PackedScene" id=5]
[ext_resource path="res://code/ui/pages/settings/data.tscn" type="PackedScene" id=6]
[ext_resource path="res://code/ui/pages/settings/autoconnnect.tscn" type="PackedScene" id=7]
[ext_resource path="res://code/ui/pages/settings/keep_on.tscn" type="PackedScene" id=8]

[node name="Settings" type="VBoxContainer"]
margin_right = 512.0
Expand Down Expand Up @@ -43,14 +44,20 @@ margin_top = 538.0
margin_right = 512.0
margin_bottom = 627.0

[node name="Debug" parent="." instance=ExtResource( 2 )]
[node name="KeepOn" parent="." instance=ExtResource( 8 )]
anchor_right = 0.0
margin_top = 631.0
margin_right = 512.0
margin_bottom = 720.0
margin_bottom = 740.0

[node name="Debug" parent="." instance=ExtResource( 2 )]
anchor_right = 0.0
margin_top = 744.0
margin_right = 512.0
margin_bottom = 833.0

[node name="Data" parent="." instance=ExtResource( 6 )]
anchor_right = 0.0
margin_top = 724.0
margin_top = 837.0
margin_right = 512.0
margin_bottom = 866.0
margin_bottom = 979.0
6 changes: 3 additions & 3 deletions source/code/ui/pages/settings/autoconnnect.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ title = "Auto connect on start"
description = "When launched, the application will automatically attempt to connect to Discord."

[node name="Title" parent="Button/Box" index="0"]
text = "Debug log"
text = "Auto connect on start"

[node name="Hint" parent="." index="1"]
text = "Generates a log file for troubleshooting."
text = "When launched, the application will automatically attempt to connect to Discord."

[connection signal="toggled" from="Button" to="." method="_on_Debug_toggled"]
[connection signal="toggled" from="Button" to="." method="_on_AutoConnect_toggled"]
22 changes: 22 additions & 0 deletions source/code/ui/pages/settings/keep_on.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://code/ui/pages/settings/scripts/keep_on.gd" type="Script" id=1]
[ext_resource path="res://code/ui/common/buttons/toggle.tscn" type="PackedScene" id=2]

[node name="KeepOn" instance=ExtResource( 2 )]
script = ExtResource( 1 )
title = "Keep screen on"
description = "Prevents the screensaver from taking over while your status is visible. Useful if you want to keep the application always active without having to change your system settings."

[node name="Title" parent="Button/Box" index="0"]
text = "Keep screen on"

[node name="Hint" parent="." index="1"]
margin_bottom = 89.0
text = "Prevents the screensaver from taking over while your status is visible. Useful if you want to keep the application always active without having to change your system settings."

[node name="Separator" parent="." index="2"]
margin_top = 97.0
margin_bottom = 129.0

[connection signal="toggled" from="Button" to="." method="_on_KeepOn_toggled"]
2 changes: 1 addition & 1 deletion source/code/ui/pages/settings/scripts/autoconnect.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ func _ready() -> void:
set_check(Main.settings["auto_connect"])

# Signals
func _on_Debug_toggled(button_pressed: bool) -> void:
func _on_AutoConnect_toggled(button_pressed: bool) -> void:
Main.settings["auto_connect"] = button_pressed
18 changes: 18 additions & 0 deletions source/code/ui/pages/settings/scripts/keep_on.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
extends "res://code/ui/common/buttons/toggle.gd"

func _ready() -> void:

# Locale keys
set_title("KEEPON_TITLE")
set_hint("KEEPON_HINT")

# Update configurations on UI
set_check(Main.settings["keep_on"])

# Signals
func _on_KeepOn_toggled(button_pressed: bool) -> void:
Main.settings["keep_on"] = button_pressed
if button_pressed:
OS.keep_screen_on = Main.discord_connected and Main.settings["activity"]
else:
OS.keep_screen_on = false
14 changes: 10 additions & 4 deletions source/code/ui/pages/settings/scripts/language.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ func _ready() -> void:
# Fill list
node_list.clear()
node_list.add_item("LANGUAGE_AUTO", 0)
node_list.add_item("English", 1)
node_list.add_item("Português", 2)
node_list.add_item("Deutsch", 1)
node_list.add_item("English", 2)
node_list.add_item("Español", 3)
node_list.add_item("Magyar", 4)
node_list.add_item("Nederlands", 5)
node_list.add_item("Português", 6)
node_list.set_item_metadata(0, "")
node_list.set_item_metadata(1, "en")
node_list.set_item_metadata(2, "pt")
node_list.set_item_metadata(1, "de")
node_list.set_item_metadata(2, "en")
node_list.set_item_metadata(3, "es")
node_list.set_item_metadata(4, "hu")
node_list.set_item_metadata(5, "nl")
node_list.set_item_metadata(6, "pt")

# Find previously selected option
for i in node_list.get_item_count():
Expand Down
7 changes: 5 additions & 2 deletions source/credits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ NinStar
[url=https://github.com/ninstar/Rich-Presence-U-DB#credits]All contributors[/url]

[b]Translations[/b]
Português: NinStar
Español: JhoanLsuper[/center]
Deutsch: DeeKay-Deluxe
Español: JhoanLsuper
Magyar: Feeniheelo
Nederlands: Thomanski
Português: NinStar[/center]
Loading

0 comments on commit ca67b0f

Please sign in to comment.