summaryrefslogtreecommitdiff
path: root/onionshare_gui/settings_dialog.py
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2019-05-06 18:06:14 -0700
committerGitHub <noreply@github.com>2019-05-06 18:06:14 -0700
commitbbf6c02da645fcd4fc50db18dd341178ad4fa2e6 (patch)
treec1e2757c56f517e051c9f905f8a7a12e1b8d66ae /onionshare_gui/settings_dialog.py
parenta8201593ec0bfe7596ef530e80aa30e5172ef71d (diff)
parent9e9c29b189cb91ea495a85ed749730395926e07b (diff)
downloadonionshare-bbf6c02da645fcd4fc50db18dd341178ad4fa2e6.tar.gz
onionshare-bbf6c02da645fcd4fc50db18dd341178ad4fa2e6.zip
Merge pull request #980 from micahflee/developv2.1
Version 2.1
Diffstat (limited to 'onionshare_gui/settings_dialog.py')
-rw-r--r--onionshare_gui/settings_dialog.py69
1 files changed, 47 insertions, 22 deletions
diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py
index 2933784c..3c0b83f4 100644
--- a/onionshare_gui/settings_dialog.py
+++ b/onionshare_gui/settings_dialog.py
@@ -71,27 +71,45 @@ class SettingsDialog(QtWidgets.QDialog):
self.public_mode_widget = QtWidgets.QWidget()
self.public_mode_widget.setLayout(public_mode_layout)
- # Whether or not to use a shutdown ('auto-stop') timer
- self.shutdown_timeout_checkbox = QtWidgets.QCheckBox()
- self.shutdown_timeout_checkbox.setCheckState(QtCore.Qt.Checked)
- self.shutdown_timeout_checkbox.setText(strings._("gui_settings_shutdown_timeout_checkbox"))
- shutdown_timeout_label = QtWidgets.QLabel(strings._("gui_settings_whats_this").format("https://github.com/micahflee/onionshare/wiki/Using-the-Auto-Stop-Timer"))
- shutdown_timeout_label.setStyleSheet(self.common.css['settings_whats_this'])
- shutdown_timeout_label.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)
- shutdown_timeout_label.setOpenExternalLinks(True)
- shutdown_timeout_label.setMinimumSize(public_mode_label.sizeHint())
- shutdown_timeout_layout = QtWidgets.QHBoxLayout()
- shutdown_timeout_layout.addWidget(self.shutdown_timeout_checkbox)
- shutdown_timeout_layout.addWidget(shutdown_timeout_label)
- shutdown_timeout_layout.addStretch()
- shutdown_timeout_layout.setContentsMargins(0,0,0,0)
- self.shutdown_timeout_widget = QtWidgets.QWidget()
- self.shutdown_timeout_widget.setLayout(shutdown_timeout_layout)
+ # Whether or not to use an auto-start timer
+ self.autostart_timer_checkbox = QtWidgets.QCheckBox()
+ self.autostart_timer_checkbox.setCheckState(QtCore.Qt.Checked)
+ self.autostart_timer_checkbox.setText(strings._("gui_settings_autostart_timer_checkbox"))
+ autostart_timer_label = QtWidgets.QLabel(strings._("gui_settings_whats_this").format("https://github.com/micahflee/onionshare/wiki/Using-the-Auto-Start-Timer"))
+ autostart_timer_label.setStyleSheet(self.common.css['settings_whats_this'])
+ autostart_timer_label.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)
+ autostart_timer_label.setOpenExternalLinks(True)
+ autostart_timer_label.setMinimumSize(public_mode_label.sizeHint())
+ autostart_timer_layout = QtWidgets.QHBoxLayout()
+ autostart_timer_layout.addWidget(self.autostart_timer_checkbox)
+ autostart_timer_layout.addWidget(autostart_timer_label)
+ autostart_timer_layout.addStretch()
+ autostart_timer_layout.setContentsMargins(0,0,0,0)
+ self.autostart_timer_widget = QtWidgets.QWidget()
+ self.autostart_timer_widget.setLayout(autostart_timer_layout)
+
+ # Whether or not to use an auto-stop timer
+ self.autostop_timer_checkbox = QtWidgets.QCheckBox()
+ self.autostop_timer_checkbox.setCheckState(QtCore.Qt.Checked)
+ self.autostop_timer_checkbox.setText(strings._("gui_settings_autostop_timer_checkbox"))
+ autostop_timer_label = QtWidgets.QLabel(strings._("gui_settings_whats_this").format("https://github.com/micahflee/onionshare/wiki/Using-the-Auto-Stop-Timer"))
+ autostop_timer_label.setStyleSheet(self.common.css['settings_whats_this'])
+ autostop_timer_label.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)
+ autostop_timer_label.setOpenExternalLinks(True)
+ autostop_timer_label.setMinimumSize(public_mode_label.sizeHint())
+ autostop_timer_layout = QtWidgets.QHBoxLayout()
+ autostop_timer_layout.addWidget(self.autostop_timer_checkbox)
+ autostop_timer_layout.addWidget(autostop_timer_label)
+ autostop_timer_layout.addStretch()
+ autostop_timer_layout.setContentsMargins(0,0,0,0)
+ self.autostop_timer_widget = QtWidgets.QWidget()
+ self.autostop_timer_widget.setLayout(autostop_timer_layout)
# General settings layout
general_group_layout = QtWidgets.QVBoxLayout()
general_group_layout.addWidget(self.public_mode_widget)
- general_group_layout.addWidget(self.shutdown_timeout_widget)
+ general_group_layout.addWidget(self.autostart_timer_widget)
+ general_group_layout.addWidget(self.autostop_timer_widget)
general_group = QtWidgets.QGroupBox(strings._("gui_settings_general_label"))
general_group.setLayout(general_group_layout)
@@ -488,11 +506,17 @@ class SettingsDialog(QtWidgets.QDialog):
else:
self.close_after_first_download_checkbox.setCheckState(QtCore.Qt.Unchecked)
- shutdown_timeout = self.old_settings.get('shutdown_timeout')
- if shutdown_timeout:
- self.shutdown_timeout_checkbox.setCheckState(QtCore.Qt.Checked)
+ autostart_timer = self.old_settings.get('autostart_timer')
+ if autostart_timer:
+ self.autostart_timer_checkbox.setCheckState(QtCore.Qt.Checked)
else:
- self.shutdown_timeout_checkbox.setCheckState(QtCore.Qt.Unchecked)
+ self.autostart_timer_checkbox.setCheckState(QtCore.Qt.Unchecked)
+
+ autostop_timer = self.old_settings.get('autostop_timer')
+ if autostop_timer:
+ self.autostop_timer_checkbox.setCheckState(QtCore.Qt.Checked)
+ else:
+ self.autostop_timer_checkbox.setCheckState(QtCore.Qt.Unchecked)
save_private_key = self.old_settings.get('save_private_key')
if save_private_key:
@@ -932,7 +956,8 @@ class SettingsDialog(QtWidgets.QDialog):
settings.load() # To get the last update timestamp
settings.set('close_after_first_download', self.close_after_first_download_checkbox.isChecked())
- settings.set('shutdown_timeout', self.shutdown_timeout_checkbox.isChecked())
+ settings.set('autostart_timer', self.autostart_timer_checkbox.isChecked())
+ settings.set('autostop_timer', self.autostop_timer_checkbox.isChecked())
# Complicated logic here to force v2 onion mode on or off depending on other settings
if self.use_legacy_v2_onions_checkbox.isChecked():