Skip to content

Commit

Permalink
@mbridak Add rtc settings to dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbridak committed Dec 5, 2024
1 parent cdb476d commit 74c0b89
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
70 changes: 70 additions & 0 deletions not1mm/data/configuration.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2173,6 +2173,76 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="send_rtc_scores">
<property name="text">
<string>Use RTC score reporting</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="rtc_url">
<item>
<property name="text">
<string>https://hamscore.com/postxml/</string>
</property>
</item>
<item>
<property name="text">
<string>https://contestonlinescore.com/post/</string>
</property>
</item>
<item>
<property name="text">
<string>http://contest.run</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLineEdit" name="rtc_user">
<property name="placeholderText">
<string>username</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="rtc_pass">
<property name="echoMode">
<enum>QLineEdit::EchoMode::Password</enum>
</property>
<property name="placeholderText">
<string>password</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_28">
<property name="text">
<string>Score posting interval (minutes)</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="rtc_interval">
<property name="text">
<string>2</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_8">
<property name="orientation">
Expand Down
22 changes: 22 additions & 0 deletions not1mm/lib/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ def __init__(self, app_data_path, pref, parent=None):
def setup(self):
"""setup dialog"""

self.send_rtc_scores.setChecked(
bool(self.preference.get("send_rtc_scores", False))
)

value = self.preference.get("rtc_url", "")
index = self.rtc_url.findText(value)
if index != -1:
self.rtc_url.setCurrentIndex(index)

self.rtc_user.setText(str(self.preference.get("rtc_user", "")))
self.rtc_pass.setText(str(self.preference.get("rtc_pass", "")))
self.rtc_interval.setText(str(self.preference.get("rtc_interval", "2")))

self.use_call_history.setChecked(
bool(self.preference.get("use_call_history", False))
)
Expand Down Expand Up @@ -195,6 +208,15 @@ def save_changes(self):
"""
Write preferences to json file.
"""
self.preference["send_rtc_scores"] = self.send_rtc_scores.isChecked()
self.preference["rtc_url"] = self.rtc_url.currentText()
self.preference["rtc_user"] = self.rtc_user.text()
self.preference["rtc_pass"] = self.rtc_pass.text()
try:
self.preference["rtc_interval"] = int(self.rtc_interval.text())
except ValueError:
self.preference["rtc_interval"] = 2

self.preference["use_call_history"] = self.use_call_history.isChecked()
self.preference["use_esm"] = self.use_esm.isChecked()
self.preference["esm_cq"] = self.esm_cq.currentText()
Expand Down

0 comments on commit 74c0b89

Please sign in to comment.