Commit 63a3dd7e authored by Dan Pascu's avatar Dan Pascu

Added quick setting for playing message alerts

parent ae481c48
...@@ -179,6 +179,7 @@ class MainWindow(base_class, ui_class): ...@@ -179,6 +179,7 @@ class MainWindow(base_class, ui_class):
self.help_action.triggered.connect(partial(QDesktopServices.openUrl, QUrl(u'http://icanblink.com/help-qt.phtml'))) self.help_action.triggered.connect(partial(QDesktopServices.openUrl, QUrl(u'http://icanblink.com/help-qt.phtml')))
self.preferences_action.triggered.connect(self.preferences_window.show) self.preferences_action.triggered.connect(self.preferences_window.show)
self.auto_accept_chat_action.triggered.connect(self._AH_AutoAcceptChatActionTriggered) self.auto_accept_chat_action.triggered.connect(self._AH_AutoAcceptChatActionTriggered)
self.received_messages_sound_action.triggered.connect(self._AH_ReceivedMessagesSoundActionTriggered)
self.answering_machine_action.triggered.connect(self._AH_EnableAnsweringMachineActionTriggered) self.answering_machine_action.triggered.connect(self._AH_EnableAnsweringMachineActionTriggered)
self.release_notes_action.triggered.connect(partial(QDesktopServices.openUrl, QUrl(u'http://icanblink.com/changelog-qt.phtml'))) self.release_notes_action.triggered.connect(partial(QDesktopServices.openUrl, QUrl(u'http://icanblink.com/changelog-qt.phtml')))
self.quit_action.triggered.connect(self._AH_QuitActionTriggered) self.quit_action.triggered.connect(self._AH_QuitActionTriggered)
...@@ -328,6 +329,11 @@ class MainWindow(base_class, ui_class): ...@@ -328,6 +329,11 @@ class MainWindow(base_class, ui_class):
settings.chat.auto_accept = checked settings.chat.auto_accept = checked
settings.save() settings.save()
def _AH_ReceivedMessagesSoundActionTriggered(self, checked):
settings = SIPSimpleSettings()
settings.sounds.play_message_alerts = checked
settings.save()
def _AH_EnableAnsweringMachineActionTriggered(self, checked): def _AH_EnableAnsweringMachineActionTriggered(self, checked):
settings = SIPSimpleSettings() settings = SIPSimpleSettings()
settings.answering_machine.enabled = checked settings.answering_machine.enabled = checked
...@@ -661,6 +667,7 @@ class MainWindow(base_class, ui_class): ...@@ -661,6 +667,7 @@ class MainWindow(base_class, ui_class):
self.silent_button.setChecked(settings.audio.silent) self.silent_button.setChecked(settings.audio.silent)
self.answering_machine_action.setChecked(settings.answering_machine.enabled) self.answering_machine_action.setChecked(settings.answering_machine.enabled)
self.auto_accept_chat_action.setChecked(settings.chat.auto_accept) self.auto_accept_chat_action.setChecked(settings.chat.auto_accept)
self.received_messages_sound_action.setChecked(settings.sounds.play_message_alerts)
if settings.google_contacts.authorization_token is None: if settings.google_contacts.authorization_token is None:
self.google_contacts_action.setText(u'Enable &Google Contacts...') self.google_contacts_action.setText(u'Enable &Google Contacts...')
else: else:
...@@ -726,6 +733,8 @@ class MainWindow(base_class, ui_class): ...@@ -726,6 +733,8 @@ class MainWindow(base_class, ui_class):
self.answering_machine_action.setChecked(settings.answering_machine.enabled) self.answering_machine_action.setChecked(settings.answering_machine.enabled)
if 'chat.auto_accept' in notification.data.modified: if 'chat.auto_accept' in notification.data.modified:
self.auto_accept_chat_action.setChecked(settings.chat.auto_accept) self.auto_accept_chat_action.setChecked(settings.chat.auto_accept)
if 'sounds.play_message_alerts' in notification.data.modified:
self.received_messages_sound_action.setChecked(settings.sounds.play_message_alerts)
if 'google_contacts.authorization_token' in notification.data.modified: if 'google_contacts.authorization_token' in notification.data.modified:
authorization_token = notification.sender.google_contacts.authorization_token authorization_token = notification.sender.google_contacts.authorization_token
if authorization_token is None: if authorization_token is None:
......
...@@ -1473,6 +1473,8 @@ class PreferencesWindow(base_class, ui_class): ...@@ -1473,6 +1473,8 @@ class PreferencesWindow(base_class, ui_class):
self.enable_answering_machine_button.setChecked(settings.answering_machine.enabled) self.enable_answering_machine_button.setChecked(settings.answering_machine.enabled)
if 'chat.auto_accept' in notification.data.modified: if 'chat.auto_accept' in notification.data.modified:
self.auto_accept_chat_button.setChecked(settings.chat.auto_accept) self.auto_accept_chat_button.setChecked(settings.chat.auto_accept)
if 'sounds.play_message_alerts' in notification.data.modified:
self.chat_message_alert_button.setChecked(settings.sounds.play_message_alerts)
elif notification.sender is self.selected_account is not None: elif notification.sender is self.selected_account is not None:
account = notification.sender account = notification.sender
if 'enabled' in notification.data.modified: if 'enabled' in notification.data.modified:
......
...@@ -949,6 +949,7 @@ padding: 2px;</string> ...@@ -949,6 +949,7 @@ padding: 2px;</string>
</property> </property>
<addaction name="auto_accept_chat_action"/> <addaction name="auto_accept_chat_action"/>
<addaction name="answering_machine_action"/> <addaction name="answering_machine_action"/>
<addaction name="received_messages_sound_action"/>
</widget> </widget>
<addaction name="about_action"/> <addaction name="about_action"/>
<addaction name="check_for_updates_action"/> <addaction name="check_for_updates_action"/>
...@@ -1253,6 +1254,14 @@ padding: 2px;</string> ...@@ -1253,6 +1254,14 @@ padding: 2px;</string>
<enum>Qt::ApplicationShortcut</enum> <enum>Qt::ApplicationShortcut</enum>
</property> </property>
</action> </action>
<action name="received_messages_sound_action">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Play a sound for &amp;received messages</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment