Change some Tor settings language, and combine various settings into a single "Tor settings" group box

This commit is contained in:
Micah Lee 2021-10-13 19:49:51 -07:00
parent 17beca1692
commit c4a038720b
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 27 additions and 44 deletions

View File

@ -50,18 +50,18 @@
"gui_settings_connection_type_label": "How should OnionShare connect to Tor?", "gui_settings_connection_type_label": "How should OnionShare connect to Tor?",
"gui_settings_connection_type_bundled_option": "Use the Tor version built into OnionShare", "gui_settings_connection_type_bundled_option": "Use the Tor version built into OnionShare",
"gui_settings_connection_type_automatic_option": "Attempt auto-configuration with Tor Browser", "gui_settings_connection_type_automatic_option": "Attempt auto-configuration with Tor Browser",
"gui_settings_controller_extras_label": "Tor settings",
"gui_settings_connection_type_control_port_option": "Connect using control port", "gui_settings_connection_type_control_port_option": "Connect using control port",
"gui_settings_connection_type_socket_file_option": "Connect using socket file", "gui_settings_connection_type_socket_file_option": "Connect using socket file",
"gui_settings_connection_type_test_button": "Test Connection to Tor", "gui_settings_connection_type_test_button": "Test Connection to Tor",
"gui_settings_control_port_label": "Control port", "gui_settings_control_port_label": "Control port",
"gui_settings_socket_file_label": "Socket file", "gui_settings_socket_file_label": "Socket file",
"gui_settings_socks_label": "SOCKS port", "gui_settings_socks_label": "SOCKS port",
"gui_settings_authenticate_label": "Tor authentication settings",
"gui_settings_authenticate_no_auth_option": "No authentication, or cookie authentication", "gui_settings_authenticate_no_auth_option": "No authentication, or cookie authentication",
"gui_settings_authenticate_password_option": "Password", "gui_settings_authenticate_password_option": "Password",
"gui_settings_password_label": "Password", "gui_settings_password_label": "Password",
"gui_settings_tor_bridges": "Tor bridge support", "gui_settings_tor_bridges": "Would you like to Use a Tor bridge?",
"gui_settings_tor_bridges_no_bridges_radio_option": "Don't use bridges", "gui_settings_tor_bridges_no_bridges_radio_option": "Don't use a bridge",
"gui_settings_tor_bridges_obfs4_radio_option": "Use built-in obfs4 pluggable transports", "gui_settings_tor_bridges_obfs4_radio_option": "Use built-in obfs4 pluggable transports",
"gui_settings_tor_bridges_obfs4_radio_option_no_obfs4proxy": "Use built-in obfs4 pluggable transports (requires obfs4proxy)", "gui_settings_tor_bridges_obfs4_radio_option_no_obfs4proxy": "Use built-in obfs4 pluggable transports (requires obfs4proxy)",
"gui_settings_tor_bridges_meek_lite_azure_radio_option": "Use built-in meek_lite (Azure) pluggable transports", "gui_settings_tor_bridges_meek_lite_azure_radio_option": "Use built-in meek_lite (Azure) pluggable transports",

View File

@ -267,23 +267,13 @@ class TorSettingsDialog(QtWidgets.QDialog):
self.connection_type_socks.hide() self.connection_type_socks.hide()
# Authentication options # Authentication options
self.authenticate_no_auth_checkbox = QtWidgets.QCheckBox(
# No authentication
self.authenticate_no_auth_radio = QtWidgets.QRadioButton(
strings._("gui_settings_authenticate_no_auth_option") strings._("gui_settings_authenticate_no_auth_option")
) )
self.authenticate_no_auth_radio.toggled.connect( self.authenticate_no_auth_checkbox.toggled.connect(
self.authenticate_no_auth_toggled self.authenticate_no_auth_toggled
) )
# Password
self.authenticate_password_radio = QtWidgets.QRadioButton(
strings._("gui_settings_authenticate_password_option")
)
self.authenticate_password_radio.toggled.connect(
self.authenticate_password_toggled
)
authenticate_password_extras_label = QtWidgets.QLabel( authenticate_password_extras_label = QtWidgets.QLabel(
strings._("gui_settings_password_label") strings._("gui_settings_password_label")
) )
@ -300,15 +290,18 @@ class TorSettingsDialog(QtWidgets.QDialog):
self.authenticate_password_extras.setLayout(authenticate_password_extras_layout) self.authenticate_password_extras.setLayout(authenticate_password_extras_layout)
self.authenticate_password_extras.hide() self.authenticate_password_extras.hide()
# Authentication options layout # Group for Tor settings
authenticate_group_layout = QtWidgets.QVBoxLayout() tor_settings_layout = QtWidgets.QVBoxLayout()
authenticate_group_layout.addWidget(self.authenticate_no_auth_radio) tor_settings_layout.addWidget(self.connection_type_control_port_extras)
authenticate_group_layout.addWidget(self.authenticate_password_radio) tor_settings_layout.addWidget(self.connection_type_socket_file_extras)
authenticate_group_layout.addWidget(self.authenticate_password_extras) tor_settings_layout.addWidget(self.connection_type_socks)
self.authenticate_group = QtWidgets.QGroupBox( tor_settings_layout.addWidget(self.authenticate_no_auth_checkbox)
strings._("gui_settings_authenticate_label") tor_settings_layout.addWidget(self.authenticate_password_extras)
self.tor_settings_group = QtWidgets.QGroupBox(
strings._("gui_settings_controller_extras_label")
) )
self.authenticate_group.setLayout(authenticate_group_layout) self.tor_settings_group.setLayout(tor_settings_layout)
self.tor_settings_group.hide()
# Put the radios into their own group so they are exclusive # Put the radios into their own group so they are exclusive
connection_type_radio_group_layout = QtWidgets.QVBoxLayout() connection_type_radio_group_layout = QtWidgets.QVBoxLayout()
@ -349,10 +342,7 @@ class TorSettingsDialog(QtWidgets.QDialog):
# Connection type layout # Connection type layout
connection_type_layout = QtWidgets.QVBoxLayout() connection_type_layout = QtWidgets.QVBoxLayout()
connection_type_layout.addWidget(self.connection_type_control_port_extras) connection_type_layout.addWidget(self.tor_settings_group)
connection_type_layout.addWidget(self.connection_type_socket_file_extras)
connection_type_layout.addWidget(self.connection_type_socks)
connection_type_layout.addWidget(self.authenticate_group)
connection_type_layout.addWidget(self.connection_type_bridges_radio_group) connection_type_layout.addWidget(self.connection_type_bridges_radio_group)
connection_type_layout.addLayout(connection_type_test_button_layout) connection_type_layout.addLayout(connection_type_test_button_layout)
@ -421,9 +411,9 @@ class TorSettingsDialog(QtWidgets.QDialog):
) )
auth_type = self.old_settings.get("auth_type") auth_type = self.old_settings.get("auth_type")
if auth_type == "no_auth": if auth_type == "no_auth":
self.authenticate_no_auth_radio.setChecked(True) self.authenticate_no_auth_checkbox.setCheckState(QtCore.Qt.Checked)
elif auth_type == "password": else:
self.authenticate_password_radio.setChecked(True) self.authenticate_no_auth_checkbox.setChecked(QtCore.Qt.Unchecked)
self.authenticate_password_extras_password.setText( self.authenticate_password_extras_password.setText(
self.old_settings.get("auth_password") self.old_settings.get("auth_password")
) )
@ -458,11 +448,11 @@ class TorSettingsDialog(QtWidgets.QDialog):
def connection_type_bundled_toggled(self, checked): def connection_type_bundled_toggled(self, checked):
""" """
Connection type bundled was toggled. If checked, hide authentication fields. Connection type bundled was toggled
""" """
self.common.log("TorSettingsDialog", "connection_type_bundled_toggled") self.common.log("TorSettingsDialog", "connection_type_bundled_toggled")
if checked: if checked:
self.authenticate_group.hide() self.tor_settings_group.hide()
self.connection_type_socks.hide() self.connection_type_socks.hide()
self.connection_type_bridges_radio_group.show() self.connection_type_bridges_radio_group.show()
@ -507,7 +497,7 @@ class TorSettingsDialog(QtWidgets.QDialog):
""" """
self.common.log("TorSettingsDialog", "connection_type_automatic_toggled") self.common.log("TorSettingsDialog", "connection_type_automatic_toggled")
if checked: if checked:
self.authenticate_group.hide() self.tor_settings_group.hide()
self.connection_type_socks.hide() self.connection_type_socks.hide()
self.connection_type_bridges_radio_group.hide() self.connection_type_bridges_radio_group.hide()
@ -518,7 +508,7 @@ class TorSettingsDialog(QtWidgets.QDialog):
""" """
self.common.log("TorSettingsDialog", "connection_type_control_port_toggled") self.common.log("TorSettingsDialog", "connection_type_control_port_toggled")
if checked: if checked:
self.authenticate_group.show() self.tor_settings_group.show()
self.connection_type_control_port_extras.show() self.connection_type_control_port_extras.show()
self.connection_type_socks.show() self.connection_type_socks.show()
self.connection_type_bridges_radio_group.hide() self.connection_type_bridges_radio_group.hide()
@ -532,7 +522,7 @@ class TorSettingsDialog(QtWidgets.QDialog):
""" """
self.common.log("TorSettingsDialog", "connection_type_socket_file_toggled") self.common.log("TorSettingsDialog", "connection_type_socket_file_toggled")
if checked: if checked:
self.authenticate_group.show() self.tor_settings_group.show()
self.connection_type_socket_file_extras.show() self.connection_type_socket_file_extras.show()
self.connection_type_socks.show() self.connection_type_socks.show()
self.connection_type_bridges_radio_group.hide() self.connection_type_bridges_radio_group.hide()
@ -544,17 +534,10 @@ class TorSettingsDialog(QtWidgets.QDialog):
Authentication option no authentication was toggled. Authentication option no authentication was toggled.
""" """
self.common.log("TorSettingsDialog", "authenticate_no_auth_toggled") self.common.log("TorSettingsDialog", "authenticate_no_auth_toggled")
def authenticate_password_toggled(self, checked):
"""
Authentication option password was toggled. If checked, show extra fields
for password auth. If unchecked, hide those extra fields.
"""
self.common.log("TorSettingsDialog", "authenticate_password_toggled")
if checked: if checked:
self.authenticate_password_extras.show()
else:
self.authenticate_password_extras.hide() self.authenticate_password_extras.hide()
else:
self.authenticate_password_extras.show()
def test_tor_clicked(self): def test_tor_clicked(self):
""" """