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
8f452420
Commit
8f452420
authored
Jun 09, 2022
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a setting to show both name and uri in call history
GH-2
parent
a9ddfd06
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
10 deletions
+100
-10
settings.py
blink/configuration/settings.py
+5
-0
history.py
blink/history.py
+17
-10
preferences.py
blink/preferences.py
+10
-0
preferences.ui
resources/preferences.ui
+68
-0
No files found.
blink/configuration/settings.py
View file @
8f452420
...
...
@@ -123,12 +123,17 @@ class BlinkPresenceSettings(SettingsGroup):
icon
=
Setting
(
type
=
IconDescriptor
,
nillable
=
True
)
class
BlinkInterfaceSettings
(
SettingsGroup
):
show_history_name_and_uri
=
Setting
(
type
=
bool
,
default
=
False
)
class
BlinkSettings
(
SettingsObject
):
__id__
=
'BlinkSettings'
chat_window
=
ChatWindowSettings
presence
=
BlinkPresenceSettings
screen_sharing
=
BlinkScreenSharingSettings
interface
=
BlinkInterfaceSettings
screenshots_directory
=
Setting
(
type
=
Path
,
default
=
Path
(
'~/Downloads'
))
transfers_directory
=
Setting
(
type
=
Path
,
default
=
Path
(
'~/Downloads'
))
...
...
blink/history.py
View file @
8f452420
...
...
@@ -19,6 +19,7 @@ from sipsimple.addressbook import AddressbookManager
from
sipsimple.threading
import
run_in_thread
from
sipsimple.util
import
ISOTimestamp
from
blink.configuration.settings
import
BlinkSettings
from
blink.resources
import
ApplicationData
,
Resources
from
blink.messages
import
BlinkMessage
from
blink.util
import
run_in_gui_thread
...
...
@@ -38,19 +39,11 @@ class HistoryManager(object, metaclass=Singleton):
sip_prefix_re
=
re
.
compile
(
'^sips?:'
)
def
__init__
(
self
):
try
:
data
=
pickle
.
load
(
open
(
ApplicationData
.
get
(
'calls_history'
),
"rb"
))
if
not
isinstance
(
data
,
list
)
or
not
all
(
isinstance
(
item
,
HistoryEntry
)
and
item
.
text
and
isinstance
(
item
.
call_time
,
ISOTimestamp
)
for
item
in
data
):
raise
ValueError
(
"invalid save data"
)
except
Exception
as
e
:
traceback
.
print_exc
()
self
.
calls
=
[]
else
:
self
.
calls
=
data
[
-
self
.
history_size
:]
self
.
calls
=
[]
self
.
message_history
=
MessageHistory
()
notification_center
=
NotificationCenter
()
notification_center
.
add_observer
(
self
,
name
=
'SIPApplicationDidStart'
)
notification_center
.
add_observer
(
self
,
name
=
'SIPSessionDidEnd'
)
notification_center
.
add_observer
(
self
,
name
=
'SIPSessionDidFail'
)
notification_center
.
add_observer
(
self
,
name
=
'ChatStreamGotMessage'
)
...
...
@@ -81,6 +74,16 @@ class HistoryManager(object, metaclass=Singleton):
handler
=
getattr
(
self
,
'_NH_
%
s'
%
notification
.
name
,
Null
)
handler
(
notification
)
def
_NH_SIPApplicationDidStart
(
self
,
notification
):
try
:
data
=
pickle
.
load
(
open
(
ApplicationData
.
get
(
'calls_history'
),
"rb"
))
if
not
isinstance
(
data
,
list
)
or
not
all
(
isinstance
(
item
,
HistoryEntry
)
and
item
.
text
and
isinstance
(
item
.
call_time
,
ISOTimestamp
)
for
item
in
data
):
raise
ValueError
(
"invalid save data"
)
except
Exception
as
e
:
traceback
.
print_exc
()
else
:
self
.
calls
=
data
[
-
self
.
history_size
:]
def
_NH_SIPSessionDidEnd
(
self
,
notification
):
if
notification
.
sender
.
account
is
BonjourAccount
():
return
...
...
@@ -466,6 +469,10 @@ class HistoryEntry(object):
@
property
def
text
(
self
):
result
=
str
(
self
.
name
or
self
.
uri
)
blink_settings
=
BlinkSettings
()
if
blink_settings
.
interface
.
show_history_name_and_uri
:
result
=
f
'{str(self.name)} ({str(self.uri)})'
if
self
.
call_time
:
call_time
=
self
.
call_time
.
astimezone
(
tzlocal
())
call_date
=
call_time
.
date
()
...
...
blink/preferences.py
View file @
8f452420
...
...
@@ -346,6 +346,9 @@ class PreferencesWindow(base_class, ui_class, metaclass=QSingleton):
self
.
auto_answer_interval
.
valueChanged
[
int
]
.
connect
(
self
.
_SH_AutoAnswerIntervalChanged
)
self
.
account_auto_answer
.
clicked
.
connect
(
self
.
_SH_AccountAutoAnswerChanged
)
# Interface
self
.
history_name_and_uri_button
.
clicked
.
connect
(
self
.
_SH_HistoryNameAndUriButtonClicked
)
# Setup initial state (show the accounts page right after start)
self
.
accounts_action
.
trigger
()
self
.
account_tab_widget
.
setCurrentIndex
(
0
)
...
...
@@ -767,6 +770,8 @@ class PreferencesWindow(base_class, ui_class, metaclass=QSingleton):
self
.
tls_cert_file_editor
.
setText
(
settings
.
tls
.
certificate
or
''
)
self
.
tls_verify_server_button
.
setChecked
(
settings
.
tls
.
verify_server
)
self
.
history_name_and_uri_button
.
setChecked
(
blink_settings
.
interface
.
show_history_name_and_uri
)
def
load_account_settings
(
self
,
account
):
"""Load the account settings from configuration into the UI controls"""
settings
=
SIPSimpleSettings
()
...
...
@@ -1792,6 +1797,11 @@ class PreferencesWindow(base_class, ui_class, metaclass=QSingleton):
settings
.
tls
.
ca_list
=
ca_path
settings
.
save
()
def
_SH_HistoryNameAndUriButtonClicked
(
self
,
checked
):
settings
=
BlinkSettings
()
settings
.
interface
.
show_history_name_and_uri
=
checked
settings
.
save
()
@
run_in_gui_thread
def
handle_notification
(
self
,
notification
):
handler
=
getattr
(
self
,
'_NH_
%
s'
%
notification
.
name
,
Null
)
...
...
resources/preferences.ui
View file @
8f452420
...
...
@@ -3652,6 +3652,74 @@
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
"interface_tab"
>
<attribute
name=
"title"
>
<string>
Interface
</string>
</attribute>
<layout
class=
"QGridLayout"
name=
"gridLayout_6"
>
<property
name=
"leftMargin"
>
<number>
10
</number>
</property>
<property
name=
"topMargin"
>
<number>
10
</number>
</property>
<property
name=
"rightMargin"
>
<number>
10
</number>
</property>
<property
name=
"bottomMargin"
>
<number>
10
</number>
</property>
<property
name=
"spacing"
>
<number>
5
</number>
</property>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_6"
>
<property
name=
"font"
>
<font>
<weight>
75
</weight>
<bold>
true
</bold>
</font>
</property>
<property
name=
"text"
>
<string>
History menu
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
>
<spacer
name=
"verticalSpacer_5"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QCheckBox"
name=
"history_name_and_uri_button"
>
<property
name=
"text"
>
<string>
Show both name and URI
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"Line"
name=
"line_14"
>
<property
name=
"baseSize"
>
<size>
<width>
0
</width>
<height>
10
</height>
</size>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
...
...
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