Skip to content

Commit

Permalink
refacto: rename into nickname to make it generic
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Jul 24, 2024
1 parent f491f77 commit cc8795b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions qtribu/gui/dck_qchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def load_settings(self) -> None:
self.grb_instance.setTitle(
self.tr("Instance: {uri}").format(uri=self.settings.qchat_instance_uri)
)
self.lbl_nickname.setText(self.settings.qchat_nickname)
self.lbl_nickname.setText(self.settings.author_nickname)

def on_widget_opened(self) -> None:
"""
Expand Down Expand Up @@ -194,12 +194,12 @@ def on_settings_button_clicked(self) -> None:
"""
# save current instance and nickname to check afterwards if they have changed
old_instance = self.settings.qchat_instance_uri
old_nickname = self.settings.qchat_nickname
old_nickname = self.settings.author_nickname
self.iface.showOptionsDialog(currentPage=f"mOptionsPage{__title__}")

# get new instance and nickname settings
new_instance = self.settings.qchat_instance_uri
new_nickname = self.settings.qchat_nickname
new_nickname = self.settings.author_nickname

# disconnect if instance or nickname have changed
if old_instance != new_instance or old_nickname != new_nickname:
Expand Down Expand Up @@ -319,7 +319,7 @@ def on_ws_message_received(self, message: str) -> None:
return

# check if message mentions current user
if f"@{self.settings.qchat_nickname}" in message["message"]:
if f"@{self.settings.author_nickname}" in message["message"]:
item = self.create_message_item(
self.current_room,
message["author"],
Expand All @@ -334,7 +334,7 @@ def on_ws_message_received(self, message: str) -> None:
push=PlgOptionsManager().get_plg_settings().notify_push_info,
duration=PlgOptionsManager().get_plg_settings().notify_push_duration,
)
elif message["author"] == self.settings.qchat_nickname:
elif message["author"] == self.settings.author_nickname:
item = self.create_message_item(
self.current_room,
message["author"],
Expand All @@ -350,7 +350,7 @@ def on_ws_message_received(self, message: str) -> None:
# check if a notification sound should be played
if (
self.settings.qchat_play_sounds
and message["author"] != self.settings.qchat_nickname
and message["author"] != self.settings.author_nickname
):
play_resource_sound(
self.settings.qchat_ring_tone, self.settings.qchat_sound_volume
Expand Down Expand Up @@ -381,7 +381,7 @@ def on_send_button_clicked(self) -> None:
"""

# retrieve nickname and message
nickname = self.settings.qchat_nickname
nickname = self.settings.author_nickname
message_text = self.lne_message.text()

if not nickname:
Expand Down
4 changes: 2 additions & 2 deletions qtribu/gui/wdg_authoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def load_settings(self) -> dict:
settings = self.plg_settings.get_plg_settings()

# author
self.lne_qchat_nickname.setText(settings.qchat_nickname)
self.lne_qchat_nickname.setText(settings.author_nickname)
self.lne_firstname.setText(settings.author_firstname)
self.lne_lastname.setText(settings.author_lastname)
self.lne_email.setText(settings.author_email)
Expand All @@ -52,7 +52,7 @@ def save_settings(self) -> None:
settings = self.plg_settings.get_plg_settings()

# store user inputs
settings.qchat_nickname = self.lne_qchat_nickname.text()
settings.author_nickname = self.lne_qchat_nickname.text()
settings.author_firstname = self.lne_firstname.text()
settings.author_lastname = self.lne_lastname.text()
settings.author_email = self.lne_email.text()
Expand Down
2 changes: 1 addition & 1 deletion qtribu/toolbelt/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class PlgSettingsStructure:

# QChat
qchat_instance_uri: str = "https://gischat.geotribu.net"
qchat_nickname: str = "J.D."
qchat_activate_cheatcode: bool = True
qchat_play_sounds: bool = True
qchat_sound_volume: int = 33
Expand All @@ -55,6 +54,7 @@ class PlgSettingsStructure:
)

# authoring
author_nickname: str = ""
author_firstname: str = ""
author_lastname: str = ""
author_email: str = ""
Expand Down

0 comments on commit cc8795b

Please sign in to comment.