Rename "Title" to "Custom title", move it into advanced settings, and make whitespace title default to not setting a title

This commit is contained in:
Micah Lee 2021-04-25 17:49:06 -04:00
parent 3c76f3403d
commit e48878e558
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 15 additions and 14 deletions

View File

@ -165,7 +165,7 @@
"gui_quit_warning_cancel": "Cancel",
"mode_settings_advanced_toggle_show": "Show advanced settings",
"mode_settings_advanced_toggle_hide": "Hide advanced settings",
"mode_settings_title_label": "Title",
"mode_settings_title_label": "Custom title",
"mode_settings_persistent_checkbox": "Save this tab, and automatically open it when I open OnionShare",
"mode_settings_public_checkbox": "Don't use a password",
"mode_settings_autostart_timer_checkbox": "Start onion service at scheduled time",

View File

@ -39,16 +39,6 @@ class ModeSettingsWidget(QtWidgets.QWidget):
# Downstream Mode need to fill in this layout with its settings
self.mode_specific_layout = QtWidgets.QVBoxLayout()
# Title
title_label = QtWidgets.QLabel(strings._("mode_settings_title_label"))
self.title_lineedit = QtWidgets.QLineEdit()
self.title_lineedit.editingFinished.connect(self.title_editing_finished)
if self.settings.get("general", "title"):
self.title_lineedit.setText(self.settings.get("general", "title"))
title_layout = QtWidgets.QHBoxLayout()
title_layout.addWidget(title_label)
title_layout.addWidget(self.title_lineedit)
# Persistent
self.persistent_checkbox = QtWidgets.QCheckBox()
self.persistent_checkbox.clicked.connect(self.persistent_checkbox_clicked)
@ -67,6 +57,16 @@ class ModeSettingsWidget(QtWidgets.QWidget):
else:
self.public_checkbox.setCheckState(QtCore.Qt.Unchecked)
# Title
title_label = QtWidgets.QLabel(strings._("mode_settings_title_label"))
self.title_lineedit = QtWidgets.QLineEdit()
self.title_lineedit.editingFinished.connect(self.title_editing_finished)
if self.settings.get("general", "title"):
self.title_lineedit.setText(self.settings.get("general", "title"))
title_layout = QtWidgets.QHBoxLayout()
title_layout.addWidget(title_label)
title_layout.addWidget(self.title_lineedit)
# Whether or not to use an auto-start timer
self.autostart_timer_checkbox = QtWidgets.QCheckBox()
self.autostart_timer_checkbox.clicked.connect(
@ -162,6 +162,7 @@ class ModeSettingsWidget(QtWidgets.QWidget):
# Advanced group itself
advanced_layout = QtWidgets.QVBoxLayout()
advanced_layout.setContentsMargins(0, 0, 0, 0)
advanced_layout.addLayout(title_layout)
advanced_layout.addLayout(autostart_timer_layout)
advanced_layout.addLayout(autostop_timer_layout)
advanced_layout.addWidget(self.legacy_checkbox)
@ -171,9 +172,8 @@ class ModeSettingsWidget(QtWidgets.QWidget):
self.advanced_widget.hide()
layout = QtWidgets.QVBoxLayout()
layout.addLayout(title_layout)
layout.addWidget(self.persistent_checkbox)
layout.addLayout(self.mode_specific_layout)
layout.addWidget(self.persistent_checkbox)
layout.addWidget(self.public_checkbox)
layout.addWidget(self.advanced_widget)
layout.addWidget(self.toggle_advanced_button)
@ -215,7 +215,8 @@ class ModeSettingsWidget(QtWidgets.QWidget):
self.client_auth_checkbox.hide()
def title_editing_finished(self):
if self.title_lineedit.text() == "":
if self.title_lineedit.text().strip() == "":
self.title_lineedit.setText("")
self.settings.set("general", "title", None)
if self.tab.mode == self.common.gui.MODE_SHARE:
self.tab.change_title.emit(