Improve layout of SettingsDialog

This commit is contained in:
Micah Lee 2021-10-13 20:34:11 -07:00
parent 67d61d2c53
commit f2dbc97285
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
3 changed files with 15 additions and 9 deletions

View File

@ -395,7 +395,7 @@ class GuiCommon:
# Settings dialogs
"settings_version": """
QLabel {
color: #666666;
font-size: 16px;
}""",
"settings_whats_this": """
QLabel {

View File

@ -126,7 +126,7 @@
"error_cannot_create_data_dir": "Could not create OnionShare data folder: {}",
"gui_receive_mode_warning": "Receive mode lets people upload files to your computer.<br><br><b>Some files can potentially take control of your computer if you open them. Only open things from people you trust, or if you know what you are doing.</b>",
"gui_open_folder_error": "Failed to open folder with xdg-open. The file is here: {}",
"gui_settings_language_label": "Preferred language",
"gui_settings_language_label": "Language",
"gui_settings_theme_label": "Theme",
"gui_settings_theme_auto": "Auto",
"gui_settings_theme_light": "Light",

View File

@ -71,6 +71,17 @@ 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
@ -142,24 +153,19 @@ class SettingsDialog(QtWidgets.QDialog):
strings._("gui_settings_button_cancel")
)
self.cancel_button.clicked.connect(self.cancel_clicked)
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)
buttons_layout = QtWidgets.QHBoxLayout()
buttons_layout.addWidget(version_label)
buttons_layout.addWidget(self.help_button)
buttons_layout.addStretch()
buttons_layout.addWidget(self.save_button)
buttons_layout.addWidget(self.cancel_button)
# Layout
layout = QtWidgets.QVBoxLayout()
layout.addLayout(header_layout)
layout.addSpacing(20)
layout.addWidget(autoupdate_group)
if autoupdate_group.isVisible():
layout.addSpacing(20)
layout.addLayout(language_layout)
layout.addSpacing(20)
layout.addLayout(theme_layout)
layout.addSpacing(20)
layout.addStretch()