Add desktop notification messages on download events (via systray)

This commit is contained in:
Miguel Jacq 2017-05-22 16:47:12 +10:00
parent d3eeda887b
commit 3766a6048d
No known key found for this signature in database
GPG key ID: EEA4341C6D97A0B6
4 changed files with 40 additions and 0 deletions

View file

@ -52,9 +52,15 @@ class SettingsDialog(QtWidgets.QDialog):
self.close_after_first_download_checkbox.setCheckState(QtCore.Qt.Checked)
self.close_after_first_download_checkbox.setText(strings._("gui_settings_close_after_first_download_option", True))
# Whether or not to show systray notifications
self.systray_notifications_checkbox = QtWidgets.QCheckBox()
self.systray_notifications_checkbox.setCheckState(QtCore.Qt.Checked)
self.systray_notifications_checkbox.setText(strings._("gui_settings_systray_notifications", True))
# Sharing options layout
sharing_group_layout = QtWidgets.QVBoxLayout()
sharing_group_layout.addWidget(self.close_after_first_download_checkbox)
sharing_group_layout.addWidget(self.systray_notifications_checkbox)
sharing_group = QtWidgets.QGroupBox(strings._("gui_settings_sharing_label", True))
sharing_group.setLayout(sharing_group_layout)
@ -257,6 +263,12 @@ class SettingsDialog(QtWidgets.QDialog):
else:
self.close_after_first_download_checkbox.setCheckState(QtCore.Qt.Unchecked)
systray_notifications = self.old_settings.get('systray_notifications')
if systray_notifications:
self.systray_notifications_checkbox.setCheckState(QtCore.Qt.Checked)
else:
self.systray_notifications_checkbox.setCheckState(QtCore.Qt.Unchecked)
use_stealth = self.old_settings.get('use_stealth')
if use_stealth:
self.stealth_checkbox.setCheckState(QtCore.Qt.Checked)
@ -499,6 +511,7 @@ 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('systray_notifications', self.systray_notifications_checkbox.isChecked())
settings.set('use_stealth', self.stealth_checkbox.isChecked())
if self.connection_type_bundled_radio.isChecked():