Skip to content

Commit

Permalink
feature(qchat): set user registration optional
Browse files Browse the repository at this point in the history
  • Loading branch information
gounux committed Oct 8, 2024
1 parent c97b041 commit 1f47493
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
12 changes: 7 additions & 5 deletions qtribu/gui/dck_qchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,14 @@ def on_ws_connected(self, room: str) -> None:
self.add_admin_message(
self.tr("Connected to room '{room}'").format(room=room)
)

# send newcomer message to websocket
message = {
"author": INTERNAL_MESSAGE_AUTHOR,
"newcomer": self.settings.author_nickname,
}
self.ws_client.sendTextMessage(json.dumps(message))
if self.settings.qchat_register_user:
message = {
"author": INTERNAL_MESSAGE_AUTHOR,
"newcomer": self.settings.author_nickname,
}
self.ws_client.sendTextMessage(json.dumps(message))

def disconnect_from_room(self, log: bool = True, close_ws: bool = True) -> None:
"""
Expand Down
2 changes: 2 additions & 0 deletions qtribu/gui/dlg_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def apply(self):
self.ckb_display_admin_messages.isChecked()
)
settings.qchat_show_avatars = self.ckb_show_avatars.isChecked()
settings.qchat_register_user = self.ckb_register_nickname.isChecked()
settings.qchat_play_sounds = self.ckb_play_sounds.isChecked()
settings.qchat_sound_volume = self.hsl_sound_volume.value()
settings.qchat_ring_tone = self.cbb_ring_tone.currentText()
Expand Down Expand Up @@ -164,6 +165,7 @@ def load_settings(self) -> None:
settings.qchat_display_admin_messages
)
self.ckb_show_avatars.setChecked(settings.qchat_show_avatars)
self.ckb_register_nickname.setChecked(settings.qchat_register_user)
self.ckb_play_sounds.setChecked(settings.qchat_play_sounds)
self.hsl_sound_volume.setValue(settings.qchat_sound_volume)
beep_index = self.cbb_ring_tone.findText(
Expand Down
10 changes: 10 additions & 0 deletions qtribu/gui/dlg_settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ckb_register_nickname">
<property name="text">
<string>Register nickname</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ckb_display_admin_messages">
<property name="text">
Expand Down
1 change: 1 addition & 0 deletions qtribu/toolbelt/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class PlgSettingsStructure:
qchat_activate_cheatcode: bool = True
qchat_display_admin_messages: bool = False
qchat_show_avatars: bool = True
qchat_register_user: bool = True
qchat_play_sounds: bool = True
qchat_sound_volume: int = 33
qchat_ring_tone: str = "beep_1"
Expand Down

0 comments on commit 1f47493

Please sign in to comment.