Improve the look of the Settings dialog, displaying the version and help link

This commit is contained in:
Micah Lee 2021-10-15 14:14:12 -07:00
parent 64973a00ec
commit 66a744c9da
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
4 changed files with 47 additions and 35 deletions

View File

@ -392,15 +392,6 @@ class GuiCommon:
QPushButton {
padding: 5px 10px;
}""",
# Settings dialogs
"settings_version": """
QLabel {
font-size: 16px;
}""",
"settings_whats_this": """
QLabel {
font-size: 12px;
}""",
}
def get_tor_paths(self):

View File

@ -67,12 +67,14 @@
"gui_settings_tor_bridges_meek_lite_azure_radio_option": "Use built-in meek-azure bridge",
"gui_settings_tor_bridges_snowflake_radio_option": "Use built-in snowflake bridge",
"gui_settings_meek_lite_expensive_warning": "Warning: The meek-azure bridges are very costly for the Tor Project to run.<br><br>Only use them if unable to connect to Tor directly, via obfs4 transports, or other normal bridges.",
"gui_settings_tor_bridges_custom_radio_option": "Use custom bridges",
"gui_settings_tor_bridges_custom_label": "You can get bridges from <a href=\"https://bridges.torproject.org/options\">https://bridges.torproject.org</a>",
"gui_settings_tor_bridges_moat_radio_option": "Request a bridge from torproject.org",
"gui_settings_tor_bridges_custom_radio_option": "Provide a bridge you learned about from a trusted source",
"gui_settings_tor_bridges_invalid": "None of the bridges you added work.\nDouble-check them or add others.",
"gui_settings_button_save": "Save",
"gui_settings_button_cancel": "Cancel",
"gui_settings_button_help": "Help",
"gui_settings_version_label": "You are using OnionShare {}",
"gui_settings_help_label": "Need help? See <a href='https://docs.onionshare.org'>docs.onionshare.org</a>",
"settings_test_success": "Connected to the Tor controller.\n\nTor version: {}\nSupports ephemeral onion services: {}.\nSupports client authentication: {}.\nSupports next-gen .onion addresses: {}.",
"connecting_to_tor": "Connecting to the Tor network",
"update_available": "New OnionShare out. <a href='{}'>Click here</a> to get it.<br><br>You are using {} and the latest is {}.",

View File

@ -71,17 +71,6 @@ class SettingsDialog(QtWidgets.QDialog):
self.system = platform.system()
# Header
version_label = QtWidgets.QLabel(f"OnionShare {self.common.version}")
version_label.setStyleSheet(self.common.gui.css["settings_version"])
self.help_button = QtWidgets.QPushButton(strings._("gui_settings_button_help"))
self.help_button.clicked.connect(self.help_clicked)
header_layout = QtWidgets.QHBoxLayout()
header_layout.addStretch()
header_layout.addWidget(version_label)
header_layout.addWidget(self.help_button)
header_layout.addStretch()
# Automatic updates options
# Autoupdate
@ -146,6 +135,14 @@ class SettingsDialog(QtWidgets.QDialog):
theme_layout.addWidget(self.theme_combobox)
theme_layout.addStretch()
# Version and help
version_label = QtWidgets.QLabel(
strings._("gui_settings_version_label").format(self.common.version)
)
help_label = QtWidgets.QLabel(strings._("gui_settings_help_label"))
help_label.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)
help_label.setOpenExternalLinks(True)
# Buttons
self.save_button = QtWidgets.QPushButton(strings._("gui_settings_button_save"))
self.save_button.clicked.connect(self.save_clicked)
@ -160,8 +157,6 @@ class SettingsDialog(QtWidgets.QDialog):
# Layout
layout = QtWidgets.QVBoxLayout()
layout.addLayout(header_layout)
layout.addSpacing(20)
layout.addWidget(autoupdate_group)
if autoupdate_group.isVisible():
layout.addSpacing(20)
@ -169,6 +164,9 @@ class SettingsDialog(QtWidgets.QDialog):
layout.addLayout(theme_layout)
layout.addSpacing(20)
layout.addStretch()
layout.addWidget(version_label)
layout.addWidget(help_label)
layout.addSpacing(20)
layout.addLayout(buttons_layout)
self.setLayout(layout)

View File

@ -160,6 +160,38 @@ class TorSettingsDialog(QtWidgets.QDialog):
)
self.tor_bridges_use_snowflake_radio.hide()
# Request a bridge from torproject.org (moat)
# self.tor_bridges_use_moat_radio = QtWidgets.QRadioButton(
# strings._("gui_settings_tor_bridges_moat_radio_option")
# )
# self.tor_bridges_use_moat_radio.toggled.connect(
# self.tor_bridges_use_moat_radio_toggled
# )
# self.tor_bridges_use_moat_label = QtWidgets.QLabel(
# strings._("gui_settings_tor_bridges_moat_label")
# )
# self.tor_bridges_use_custom_label.setOpenExternalLinks(True)
# self.tor_bridges_use_custom_textbox = QtWidgets.QPlainTextEdit()
# self.tor_bridges_use_custom_textbox.setMaximumHeight(200)
# self.tor_bridges_use_custom_textbox.setPlaceholderText(
# "[address:port] [identifier]"
# )
# tor_bridges_use_custom_textbox_options_layout = QtWidgets.QVBoxLayout()
# tor_bridges_use_custom_textbox_options_layout.addWidget(
# self.tor_bridges_use_custom_label
# )
# tor_bridges_use_custom_textbox_options_layout.addWidget(
# self.tor_bridges_use_custom_textbox
# )
# self.tor_bridges_use_custom_textbox_options = QtWidgets.QWidget()
# self.tor_bridges_use_custom_textbox_options.setLayout(
# tor_bridges_use_custom_textbox_options_layout
# )
# self.tor_bridges_use_custom_textbox_options.hide()
# Custom bridges radio and textbox
self.tor_bridges_use_custom_radio = QtWidgets.QRadioButton(
strings._("gui_settings_tor_bridges_custom_radio_option")
@ -167,14 +199,6 @@ class TorSettingsDialog(QtWidgets.QDialog):
self.tor_bridges_use_custom_radio.toggled.connect(
self.tor_bridges_use_custom_radio_toggled
)
self.tor_bridges_use_custom_label = QtWidgets.QLabel(
strings._("gui_settings_tor_bridges_custom_label")
)
self.tor_bridges_use_custom_label.setTextInteractionFlags(
QtCore.Qt.TextBrowserInteraction
)
self.tor_bridges_use_custom_label.setOpenExternalLinks(True)
self.tor_bridges_use_custom_textbox = QtWidgets.QPlainTextEdit()
self.tor_bridges_use_custom_textbox.setMaximumHeight(200)
self.tor_bridges_use_custom_textbox.setPlaceholderText(
@ -182,9 +206,6 @@ class TorSettingsDialog(QtWidgets.QDialog):
)
tor_bridges_use_custom_textbox_options_layout = QtWidgets.QVBoxLayout()
tor_bridges_use_custom_textbox_options_layout.addWidget(
self.tor_bridges_use_custom_label
)
tor_bridges_use_custom_textbox_options_layout.addWidget(
self.tor_bridges_use_custom_textbox
)