Commit 1752d1af authored by Dan Pascu's avatar Dan Pascu

Added chat preferences

parent 2ca9570e
This diff is collapsed.
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
"""Definitions for datatypes used in configuration extensions.""" """Definitions for datatypes used in configuration extensions."""
__all__ = ['ApplicationDataPath', 'DefaultPath', 'SoundFile', 'CustomSoundFile', 'HTTPURL', 'FileURL', 'AuthorizationToken', 'InvalidToken', 'IconDescriptor', 'PresenceState', 'PresenceStateList'] __all__ = ['ApplicationDataPath', 'DefaultPath', 'SoundFile', 'CustomSoundFile', 'HTTPURL', 'FileURL', 'AuthorizationToken', 'InvalidToken',
'IconDescriptor', 'PresenceState', 'PresenceStateList', 'GraphTimeScale']
import os import os
import re import re
...@@ -223,3 +224,14 @@ class PresenceStateList(List): ...@@ -223,3 +224,14 @@ class PresenceStateList(List):
type = PresenceState type = PresenceState
class GraphTimeScale(int):
min_value = 2
max_value = 4
def __new__(cls, value):
value = int(value)
if not (cls.min_value <= value <= cls.max_value):
raise ValueError("expected an integer number between %d and %d, found %d" % (cls.min_value, cls.max_value, value))
return value
...@@ -14,7 +14,7 @@ from sipsimple.configuration.datatypes import AudioCodecList, NonNegativeInteger ...@@ -14,7 +14,7 @@ from sipsimple.configuration.datatypes import AudioCodecList, NonNegativeInteger
from sipsimple.configuration.settings import AudioSettings, ChatSettings, EchoCancellerSettings, FileTransferSettings, LogsSettings, RTPSettings, TLSSettings from sipsimple.configuration.settings import AudioSettings, ChatSettings, EchoCancellerSettings, FileTransferSettings, LogsSettings, RTPSettings, TLSSettings
from blink import __version__ from blink import __version__
from blink.configuration.datatypes import ApplicationDataPath, AuthorizationToken, HTTPURL, IconDescriptor, SoundFile, PresenceState, PresenceStateList from blink.configuration.datatypes import ApplicationDataPath, AuthorizationToken, GraphTimeScale, HTTPURL, IconDescriptor, SoundFile, PresenceState, PresenceStateList
from blink.resources import Resources from blink.resources import Resources
...@@ -98,6 +98,22 @@ class SIPSimpleSettingsExtension(SettingsObjectExtension): ...@@ -98,6 +98,22 @@ class SIPSimpleSettingsExtension(SettingsObjectExtension):
user_agent = Setting(type=str, default='Blink %s (%s)' % (__version__, platform.system() if sys.platform!='darwin' else 'MacOSX Qt')) user_agent = Setting(type=str, default='Blink %s (%s)' % (__version__, platform.system() if sys.platform!='darwin' else 'MacOSX Qt'))
class SessionInfoSettings(SettingsGroup):
alternate_style = Setting(type=bool, default=False)
bytes_per_second = Setting(type=bool, default=False)
graph_time_scale = Setting(type=GraphTimeScale, default=3)
class ChatWindowSettings(SettingsGroup):
session_info = SessionInfoSettings
style = Setting(type=str, default='Stockholm')
style_variant = Setting(type=str, default=None, nillable=True)
show_user_icons = Setting(type=bool, default=True)
font = Setting(type=str, default=None, nillable=True)
font_size = Setting(type=int, default=None, nillable=True)
class BlinkPresenceSettings(SettingsGroup): class BlinkPresenceSettings(SettingsGroup):
current_state = Setting(type=PresenceState, default=PresenceState('Available')) current_state = Setting(type=PresenceState, default=PresenceState('Available'))
state_history = Setting(type=PresenceStateList, default=PresenceStateList()) state_history = Setting(type=PresenceStateList, default=PresenceStateList())
...@@ -108,5 +124,6 @@ class BlinkPresenceSettings(SettingsGroup): ...@@ -108,5 +124,6 @@ class BlinkPresenceSettings(SettingsGroup):
class BlinkSettings(SettingsObject): class BlinkSettings(SettingsObject):
__id__ = 'BlinkSettings' __id__ = 'BlinkSettings'
chat_window = ChatWindowSettings
presence = BlinkPresenceSettings presence = BlinkPresenceSettings
This diff is collapsed.
This diff is collapsed.
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