Skip to content

Commit

Permalink
feat(Login): Add a tooltip and WhatsThis for the password field.
Browse files Browse the repository at this point in the history
This explains that passwords are optional, local, can't be recovered,
and aren't sent to servers.

Fixes #299.
  • Loading branch information
iphydf committed Jan 3, 2025
1 parent c05e04b commit 04efcf8
Show file tree
Hide file tree
Showing 57 changed files with 703 additions and 37 deletions.
42 changes: 25 additions & 17 deletions src/loginscreen.ui
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@
<item>
<layout class="QFormLayout" name="formLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
<enum>QLayout::SizeConstraint::SetMaximumSize</enum>
</property>
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
<enum>QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow</enum>
</property>
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
</property>
<property name="formAlignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
<property name="horizontalSpacing">
<number>9</number>
Expand All @@ -108,7 +108,7 @@
<string>Username:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand All @@ -128,12 +128,20 @@
<string>Password:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="PasswordEdit" name="newPass">
<property name="toolTip">
<string>This optional password is used to encrypt local message data and your profile.
If you lose this password, there is no way to recover it.
Press Shift+F1 for more information.</string>
</property>
<property name="whatsThis">
<string>The password you enter here is optional and encrypts message data and your Tox secret key. It does not encrypt files received. Your profile data is never sent to any servers. This is not a remote login, it's local to your computer only. qTox developers won't be able to recover your password if lost.</string>
</property>
<property name="accessibleDescription">
<string>Password input field, you can leave it empty (no password), or type at least 6 characters</string>
</property>
Expand All @@ -145,7 +153,7 @@
<string>Confirm:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand All @@ -171,7 +179,7 @@
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -196,7 +204,7 @@
<item row="8" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -209,7 +217,7 @@
<item row="0" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -274,7 +282,7 @@
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -290,7 +298,7 @@
<string>Username:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand All @@ -310,7 +318,7 @@
<string>Password:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand All @@ -337,7 +345,7 @@
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -362,7 +370,7 @@
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -404,10 +412,10 @@
</rect>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
<widget class="QPushButton" name="newProfilePgbtn">
Expand Down
35 changes: 20 additions & 15 deletions tools/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from lib import stage

_VALIDATE_LANG = False
_AUTOMATED_TRANSLATION = "Automated translation."


@dataclass
Expand Down Expand Up @@ -101,6 +102,7 @@ def __init__(
)

_BAIDU_LANGUAGES = ("jbo", )
_IGNORE_LANGUAGES = ("pr", )

LOCK = multiprocessing.Lock()

Expand Down Expand Up @@ -259,6 +261,8 @@ def _translate(lang: Language, current: int, total: int, text: str) -> str:
The source language is English.
"""
_progress_ts(lang.weblate_code, current, total, text)
if lang.weblate_code in _IGNORE_LANGUAGES:
return ""
if lang.weblate_code in _BAIDU_LANGUAGES:
return _fix_translation(lang, text, _baidu_translate(lang, text))
response = requests.get(
Expand Down Expand Up @@ -296,7 +300,7 @@ def _need_translation(lang: Language, source: str,
translatorcomment = message.getElementsByTagName("translatorcomment")
if (translatorcomment
and isinstance(translatorcomment[0].firstChild, minidom.Text) and
translatorcomment[0].firstChild.data != "Automated translation."):
translatorcomment[0].firstChild.data != _AUTOMATED_TRANSLATION):
# Skip messages with translator comments. These are probably
# not meant to be translated.
return []
Expand Down Expand Up @@ -373,28 +377,29 @@ def _translate_ts_file(lang: Language, file: str) -> None:
translation = _need_translation(lang, source.data, message)
if not translation:
continue
todo.append((source.data, translation[0]))
# Add a <translatorcomment> node to the message to indicate
# that the translation was automated.
if not message.getElementsByTagName("translatorcomment"):
# Skip messages with translator comments. These are
# probably not meant to be translated.
# continue
comment = dom.createElement("translatorcomment")
comment.appendChild(
dom.createTextNode("Automated translation."))
message.appendChild(comment)
todo.append((source.data, translation[0], message))
try:
# Write out changes we may have made in the loop above.
with open(file, "w") as f:
dom.writexml(f)
for i, (source, translation) in enumerate(todo):
for i, (source, translation, message) in enumerate(todo):
translated = _translate(lang, i, len(todo), source)
if not translated:
continue
# Clear the translation node of any existing text.
for child in translation.childNodes:
translation.removeChild(child)
# Add the translation to the translation node.
translation.appendChild(
dom.createTextNode(_translate(lang, i, len(todo), source)))
translation.appendChild(dom.createTextNode(translated))
# Add a <translatorcomment> node to the message to indicate
# that the translation was automated.
if not message.getElementsByTagName("translatorcomment"):
# Skip messages with translator comments. These are
# probably not meant to be translated.
# continue
comment = dom.createElement("translatorcomment")
comment.appendChild(dom.createTextNode(_AUTOMATED_TRANSLATION))
message.appendChild(comment)
# Commit to disk every time a translation is done so that we don't
# lose progress if the script is interrupted.
with open(file, "w") as f:
Expand Down
13 changes: 8 additions & 5 deletions tools/translate_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import xml.dom.minidom as minidom # nosec
from functools import cache as memoize

# <TS version="2.1" language="en_PR" sourcelanguage="en_US">
# <TS version="2.1" language="pr" sourcelanguage="en_US">
# <context>
# <name>AVForm</name>
# <message>
Expand Down Expand Up @@ -59,7 +59,7 @@ def accept_ai_response(response_file: str):
If the translation is the same as the source, we ignore it.
"""
xml = minidom.parse("translations/en_PR.ts") # nosec
xml = minidom.parse("translations/pr.ts") # nosec
with open(response_file, "r") as f:
response = f.read()
translations = {}
Expand All @@ -68,6 +68,9 @@ def accept_ai_response(response_file: str):
response,
re.DOTALL,
):
if source == "LTR":
# Ignore special string.
continue
if source == translation:
continue
translations[source] = translation
Expand All @@ -82,7 +85,7 @@ def accept_ai_response(response_file: str):
translation.appendChild(
xml.createTextNode(translations[source.data]))

with open("translations/en_PR.ts", "w") as f:
with open("translations/pr.ts", "w") as f:
xml.writexml(f)

subprocess.check_output( # nosec
Expand All @@ -94,7 +97,7 @@ def accept_ai_response(response_file: str):
"-locations",
"none",
"-ts",
"translations/en_PR.ts",
"translations/pr.ts",
])


Expand All @@ -120,7 +123,7 @@ def main():
# 2. get all source/translation pairs where the translation is not empty. Give them to the AI
# as example translations.
examples = []
dom = minidom.parse("translations/en_PR.ts") # nosec
dom = minidom.parse("translations/pr.ts") # nosec
for context in dom.getElementsByTagName("context"):
for message in context.getElementsByTagName("message"):
source = message.getElementsByTagName("source")[0].firstChild
Expand Down
12 changes: 12 additions & 0 deletions translations/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,18 @@ Please make sure to enter the same password twice.</source>
<translation type="unfinished">كلمات المرور التي أدخلتها مختلفة.
يرجى التأكد من إدخال نفس كلمة المرور مرتين.</translation>
</message>
<message>
<source>This optional password is used to encrypt local message data and your profile.
If you lose this password, there is no way to recover it.
Press Shift+F1 for more information.</source>
<translation type="unfinished">يتم استخدام كلمة المرور الاختيارية هذه لتشفير بيانات الرسائل المحلية وملفك الشخصي.
إذا فقدت كلمة المرور هذه، فلا توجد طريقة لاستعادتها.
اضغط على Shift+F1 لمزيد من المعلومات.</translation>
</message>
<message>
<source>The password you enter here is optional and encrypts message data and your Tox secret key. It does not encrypt files received. Your profile data is never sent to any servers. This is not a remote login, it&apos;s local to your computer only. qTox developers won&apos;t be able to recover your password if lost.</source>
<translation type="unfinished">كلمة المرور التي تدخلها هنا اختيارية وتقوم بتشفير بيانات الرسالة ومفتاح Tox السري الخاص بك. لا يقوم بتشفير الملفات المستلمة. لا يتم إرسال بيانات ملفك الشخصي مطلقًا إلى أي خوادم. هذا ليس تسجيل دخول عن بعد، بل هو محلي لجهاز الكمبيوتر الخاص بك فقط. لن يتمكن مطورو qTox من استعادة كلمة المرور الخاصة بك في حالة فقدانها.</translation>
</message>
</context>
<context>
<name>MainWindow</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/be.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,18 @@ Please make sure to enter the same password twice.</source>
<translation type="unfinished">Паролі, якія вы ўвялі, розныя.
Не забудзьцеся ўвесці адзін і той жа пароль двойчы.</translation>
</message>
<message>
<source>This optional password is used to encrypt local message data and your profile.
If you lose this password, there is no way to recover it.
Press Shift+F1 for more information.</source>
<translation type="unfinished">Гэты дадатковы пароль выкарыстоўваецца для шыфравання дадзеных лакальных паведамленняў і вашага профілю.
Калі вы страціце гэты пароль, аднавіць яго немагчыма.
Каб атрымаць дадатковую інфармацыю, націсніце Shift+F1.</translation>
</message>
<message>
<source>The password you enter here is optional and encrypts message data and your Tox secret key. It does not encrypt files received. Your profile data is never sent to any servers. This is not a remote login, it&apos;s local to your computer only. qTox developers won&apos;t be able to recover your password if lost.</source>
<translation type="unfinished">Пароль, які вы ўводзіце тут, не з&apos;яўляецца абавязковым і шыфруе даныя паведамлення і ваш сакрэтны ключ Tox. Ён не шыфруе атрыманыя файлы. Даныя вашага профілю ніколі не адпраўляюцца ні на якія серверы. Гэта не аддалены ўваход, ён толькі лакальны для вашага кампутара. Распрацоўшчыкі qTox не змогуць аднавіць ваш пароль у выпадку страты.</translation>
</message>
</context>
<context>
<name>MainWindow</name>
Expand Down
14 changes: 14 additions & 0 deletions translations/ber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,20 @@ Please make sure to enter the same password twice.</source>
<translation type="unfinished">ⴰⵡⴰⵍⴻⵏ ⵓⴼⴼⵉⵔⴻⵏ ⵉ ⵜⴻⵙⵙⴻⴽⵛⴻⵎⴹ ⵎⵅⴰⵍⵍⴰⴼⴻⵏ.
ⵜⵜⵅⵉⵍ ⴹⴻⵎⵏⴻⴹ ⴰⴷ ⵜⴻⵙⵙⴻⴽⵛⴻⵎⴹ ⵢⵉⵡⴻⵏ ⵡⴰⵡⴰⵍ ⵓⴼⴼⵉⵔ ⵙⵏⴰⵜ ⵏ ⵜⵉⴽⴽⴰⵍ.</translation>
</message>
<message>
<source>This optional password is used to encrypt local message data and your profile.
If you lose this password, there is no way to recover it.
Press Shift+F1 for more information.</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">ⴰⵡⴰⵍ ⵓⴼⴼⵉⵔⴰⴳⵉ ⵏ ⵜⴼⴻⵔⴽⵉⵜ ⵢⴻⵜⵜⵡⴰⵙⴻⵇⴷⴻⵛ ⵉ ⵓⵙⴻⴽⵍⴻⵙ ⵏ ⵢⵉⵙⴻⴼⴽⴰ ⵏ ⵢⵉⵣⴻⵏ ⴰⴷⵉⴳⴰⵏ ⴷ ⵓⴼⴻⵔⴷⵉⵙⵉⴽ.
ⵎⴰ ⵜⴻⵙⵄⴻⴷⴷⴰⴹ ⴰⵡⴰⵍ ⵓⴼⴼⵉⵔⴰⴳⵉ, ⵓⵍⴰⵛ ⴰⵎⴻⴽ ⴰⵔⴰ ⵜⵉⴷⵜⴻⵔⵔⴻⴹ.
ⵜⵜⴹⴻⴳⴳⵉⵔ Shift+F1 ⵉ ⵓⴳⴰⵔ ⵏ ⵢⵉⵙⴰⵍⵍⴻⵏ.</translation>
</message>
<message>
<source>The password you enter here is optional and encrypts message data and your Tox secret key. It does not encrypt files received. Your profile data is never sent to any servers. This is not a remote login, it&apos;s local to your computer only. qTox developers won&apos;t be able to recover your password if lost.</source>
<translatorcomment>Automated translation.</translatorcomment>
<translation type="unfinished">ⴰⵡⴰⵍ ⵓⴼⴼⵉⵔ ⴰⵔⴰ ⵜⴻⵙⵙⴻⴽⵛⴻⵎⴹ ⴷⴰⴳⵉ ⴷ ⴰⴼⴻⵔⴷⵉⵙ ⵢⴻⵔⵏⴰ ⵢⴻⵜⵜⵚⴻⵔⵔⵉⴼ ⵉⵙⴻⴼⴽⴰ ⵏ ⵢⵉⵣⴻⵏ ⴷ ⵜⵎⴻⵥⴷⵉⵜⵉⴽ ⵏ ⵜⵓⴼⴼⵔⴰ ⵏ Tox. ⵓⵔ ⵢⴻⵜⵜⵛⴻⴳⴳⵉⵄ ⴰⵔⴰ ⵉⴼⵓⵢⵍⴰ ⵉ ⴷⵢⴻⵜⵜⵡⴰⵙⵇⴻⴷⵛⴻⵏ. ⵉⵙⴻⴼⴽⴰ ⵏ ⵓⴼⴻⵔⴷⵉⵙⵉⴽ ⵓⵔ ⵜⵜⵡⴰⵣⴻⵏ ⴰⵔⴰ ⵖⴻⵔ ⴽⵔⴰ ⵏ ⵢⵉⵇⴻⴷⴷⴰⵛⴻⵏ. ⵡⴰⴳⵉ ⵎⴰⵞⵞⵉ ⴷ ⴰⵙⴻⴽⵛⴻⵎ ⵙ ⵜⵖⴻⵔⵖⴻⵔⵜ, ⴷ ⴰⴷⵉⴳⴰⵏ ⵉ ⵓⵙⴻⵍⴽⵉⵎⵉⴽ ⴽⴰⵏ. ⵉⵎⵙⵓⴷⴷⵙⴻⵏ ⵏ qTox ⵓⵔ ⵣⵎⵉⵔⴻⵏ ⴰⵔⴰ ⴰⴷ ⴷⵙⴼⴰⵢⴷⵉⵏ ⵙⴻⴳ ⵡⴰⵡⴰⵍ ⵓⴼⴼⵉⵔⵉⴽ ⵎⴰ ⵢⴻⵍⵍⴰ ⵢⴻⵖⵍⵉ.</translation>
</message>
</context>
<context>
<name>MainWindow</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/bg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,18 @@ Please make sure to enter the same password twice.</source>
<translation>Въведените пароли са различни.
Уверете се, че сте въвели една и съща парола два пъти.</translation>
</message>
<message>
<source>This optional password is used to encrypt local message data and your profile.
If you lose this password, there is no way to recover it.
Press Shift+F1 for more information.</source>
<translation type="unfinished">Тази незадължителна парола се използва за криптиране на локални данни за съобщения и вашия профил.
Ако загубите тази парола, няма начин да я възстановите.
Натиснете Shift+F1 за повече информация.</translation>
</message>
<message>
<source>The password you enter here is optional and encrypts message data and your Tox secret key. It does not encrypt files received. Your profile data is never sent to any servers. This is not a remote login, it&apos;s local to your computer only. qTox developers won&apos;t be able to recover your password if lost.</source>
<translation type="unfinished">Паролата, която въвеждате тук, не е задължителна и криптира данните от съобщението и вашия секретен ключ за Tox. Не криптира получените файлове. Данните от вашия профил никога не се изпращат до сървъри. Това не е отдалечено влизане, то е само локално за вашия компютър. Разработчиците на qTox няма да могат да възстановят вашата парола, ако я загубите.</translation>
</message>
</context>
<context>
<name>MainWindow</name>
Expand Down
Loading

0 comments on commit 04efcf8

Please sign in to comment.