Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
6ceff169
Commit
6ceff169
authored
Mar 02, 2021
by
Adrian Georgescu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show sip account registrar address in preferences panel
parent
d336f427
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
3 deletions
+57
-3
accounts.py
blink/accounts.py
+31
-1
preferences.py
blink/preferences.py
+26
-2
No files found.
blink/accounts.py
View file @
6ceff169
...
...
@@ -65,6 +65,7 @@ class AccountInfo(object):
def
__init__
(
self
,
account
):
self
.
account
=
account
self
.
registration_state
=
None
self
.
registrar
=
None
@
property
def
name
(
self
):
...
...
@@ -105,6 +106,7 @@ class AccountModel(QAbstractListModel):
notification_center
.
add_observer
(
self
,
name
=
'SIPAccountRegistrationDidSucceed'
)
notification_center
.
add_observer
(
self
,
name
=
'SIPAccountRegistrationDidFail'
)
notification_center
.
add_observer
(
self
,
name
=
'SIPAccountRegistrationDidEnd'
)
notification_center
.
add_observer
(
self
,
name
=
'SIPAccountDidDeactivate'
)
notification_center
.
add_observer
(
self
,
name
=
'BonjourAccountWillRegister'
)
notification_center
.
add_observer
(
self
,
name
=
'BonjourAccountRegistrationDidSucceed'
)
notification_center
.
add_observer
(
self
,
name
=
'BonjourAccountRegistrationDidFail'
)
...
...
@@ -154,6 +156,7 @@ class AccountModel(QAbstractListModel):
except
ValueError
:
return
self
.
accounts
[
position
]
.
registration_state
=
'started'
self
.
accounts
[
position
]
.
registrar
=
None
self
.
dataChanged
.
emit
(
self
.
index
(
position
),
self
.
index
(
position
))
def
_NH_SIPAccountRegistrationDidSucceed
(
self
,
notification
):
...
...
@@ -162,15 +165,41 @@ class AccountModel(QAbstractListModel):
except
ValueError
:
return
self
.
accounts
[
position
]
.
registration_state
=
'succeeded'
if
notification
.
sender
is
not
BonjourAccount
():
registrar
=
notification
.
data
.
registrar
self
.
accounts
[
position
]
.
registrar
=
"
%
s:
%
s:
%
s"
%
(
registrar
.
transport
,
registrar
.
address
,
registrar
.
port
)
self
.
dataChanged
.
emit
(
self
.
index
(
position
),
self
.
index
(
position
))
notification
.
center
.
post_notification
(
'SIPRegistrationInfoDidChange'
,
sender
=
notification
.
sender
)
def
_NH_SIPAccountDidDeactivate
(
self
,
notification
):
try
:
position
=
self
.
accounts
.
index
(
notification
.
sender
)
except
ValueError
:
return
self
.
accounts
[
position
]
.
registration_state
=
None
self
.
accounts
[
position
]
.
registrar
=
None
self
.
dataChanged
.
emit
(
self
.
index
(
position
),
self
.
index
(
position
))
notification
.
center
.
post_notification
(
'SIPRegistrationInfoDidChange'
,
sender
=
notification
.
sender
)
def
_NH_SIPAccountRegistrationDidFail
(
self
,
notification
):
try
:
position
=
self
.
accounts
.
index
(
notification
.
sender
)
except
ValueError
:
return
self
.
accounts
[
position
]
.
registration_state
=
'failed'
reason
=
'Unknown reason'
if
hasattr
(
notification
.
data
,
'error'
):
reason
=
notification
.
data
.
error
elif
hasattr
(
notification
.
data
,
'reason'
):
reason
=
notification
.
data
.
reason
self
.
accounts
[
position
]
.
registration_state
=
'failed (
%
s)'
%
(
reason
.
decode
()
if
isinstance
(
reason
,
bytes
)
else
reason
)
self
.
accounts
[
position
]
.
registrar
=
None
self
.
dataChanged
.
emit
(
self
.
index
(
position
),
self
.
index
(
position
))
notification
.
center
.
post_notification
(
'SIPRegistrationInfoDidChange'
,
sender
=
notification
.
sender
)
def
_NH_SIPAccountRegistrationDidEnd
(
self
,
notification
):
try
:
...
...
@@ -178,6 +207,7 @@ class AccountModel(QAbstractListModel):
except
ValueError
:
return
self
.
accounts
[
position
]
.
registration_state
=
'ended'
self
.
accounts
[
position
]
.
registrar
=
None
self
.
dataChanged
.
emit
(
self
.
index
(
position
),
self
.
index
(
position
))
_NH_BonjourAccountWillRegister
=
_NH_SIPAccountWillRegister
...
...
blink/preferences.py
View file @
6ceff169
...
...
@@ -465,7 +465,6 @@ class PreferencesWindow(base_class, ui_class, metaclass=QSingleton):
combo_box
.
initStyleOption
(
option
)
wide_padding
=
(
combo_box
.
height
()
-
combo_box
.
style
()
.
subControlRect
(
QStyle
.
CC_ComboBox
,
option
,
QStyle
.
SC_ComboBoxEditField
,
combo_box
)
.
height
()
>=
10
)
if
False
and
wide_padding
:
# TODO: review later and decide if its worth or not -Dan
print
(
"found wide padding"
)
self
.
audio_alert_device_button
.
setStyleSheet
(
"""QComboBox { padding: 4px 4px 4px 4px; }"""
)
self
.
audio_input_device_button
.
setStyleSheet
(
"""QComboBox { padding: 4px 4px 4px 4px; }"""
)
self
.
audio_output_device_button
.
setStyleSheet
(
"""QComboBox { padding: 4px 4px 4px 4px; }"""
)
...
...
@@ -763,8 +762,15 @@ class PreferencesWindow(base_class, ui_class, metaclass=QSingleton):
self
.
password_editor
.
setText
(
account
.
auth
.
password
)
selected_index
=
self
.
account_list
.
selectionModel
()
.
selectedIndexes
()[
0
]
selected_account_info
=
self
.
account_list
.
model
()
.
data
(
selected_index
,
Qt
.
UserRole
)
if
not
account
.
enabled
:
selected_account_info
.
registration_state
=
None
selected_account_info
.
registrar
=
None
if
selected_account_info
.
registration_state
:
self
.
account_registration_label
.
setText
(
'Registration
%
s'
%
selected_account_info
.
registration_state
.
title
())
if
selected_account_info
.
registration_state
==
'succeeded'
and
selected_account_info
.
registrar
is
not
None
:
self
.
account_registration_label
.
setText
(
'Registered at
%
s'
%
selected_account_info
.
registrar
)
else
:
self
.
account_registration_label
.
setText
(
'Registration
%
s'
%
selected_account_info
.
registration_state
.
title
())
else
:
self
.
account_registration_label
.
setText
(
'Not Registered'
)
else
:
...
...
@@ -969,6 +975,21 @@ class PreferencesWindow(base_class, ui_class, metaclass=QSingleton):
self
.
_update_logs_size_label
()
self
.
pages
.
setCurrentIndex
(
action
.
index
)
def
_NH_SIPRegistrationInfoDidChange
(
self
,
notification
):
self
.
refresh_account_registration_widgets
(
notification
.
sender
)
def
refresh_account_registration_widgets
(
self
,
account
):
try
:
selected_index
=
self
.
account_list
.
selectionModel
()
.
selectedIndexes
()[
0
]
except
IndexError
:
return
selected_account
=
selected_index
.
data
(
Qt
.
UserRole
)
.
account
if
account
.
id
!=
selected_account
.
id
:
return
self
.
load_account_settings
(
selected_account
)
def
_SH_AccountListSelectionChanged
(
self
,
selected
,
deselected
):
try
:
selected_index
=
self
.
account_list
.
selectionModel
()
.
selectedIndexes
()[
0
]
...
...
@@ -1668,6 +1689,7 @@ class PreferencesWindow(base_class, ui_class, metaclass=QSingleton):
notification
.
center
.
add_observer
(
self
,
name
=
'VideoDevicesDidChange'
)
notification
.
center
.
add_observer
(
self
,
name
=
'VideoDeviceDidChangeCamera'
)
notification
.
center
.
add_observer
(
self
,
name
=
'CFGSettingsObjectDidChange'
)
notification
.
center
.
add_observer
(
self
,
name
=
'SIPRegistrationInfoDidChange'
)
def
_NH_AudioDevicesDidChange
(
self
,
notification
):
self
.
load_audio_devices
()
...
...
@@ -1707,6 +1729,8 @@ class PreferencesWindow(base_class, ui_class, metaclass=QSingleton):
account
=
notification
.
sender
if
'enabled'
in
notification
.
data
.
modified
:
self
.
account_enabled_button
.
setChecked
(
account
.
enabled
)
if
not
account
.
enabled
:
self
.
refresh_account_registration_widgets
(
account
)
self
.
reregister_button
.
setEnabled
(
account
.
enabled
)
if
'display_name'
in
notification
.
data
.
modified
:
self
.
display_name_editor
.
setText
(
account
.
display_name
or
''
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment