Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
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
Administrator
linphone-desktop
Commits
fc9e8b68
Commit
fc9e8b68
authored
Apr 28, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(src/components/calls/CallsListModel): handle getData exception and code refactoring
parent
69f114e5
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
126 additions
and
115 deletions
+126
-115
CallModel.cpp
linphone-desktop/src/components/call/CallModel.cpp
+56
-56
CallModel.hpp
linphone-desktop/src/components/call/CallModel.hpp
+6
-6
CallsListModel.cpp
linphone-desktop/src/components/calls/CallsListModel.cpp
+33
-24
CallsListModel.hpp
linphone-desktop/src/components/calls/CallsListModel.hpp
+4
-4
Camera.cpp
linphone-desktop/src/components/camera/Camera.cpp
+14
-14
Camera.hpp
linphone-desktop/src/components/camera/Camera.hpp
+6
-6
ChatModel.cpp
linphone-desktop/src/components/chat/ChatModel.cpp
+1
-0
VcardModel.hpp
linphone-desktop/src/components/contact/VcardModel.hpp
+2
-2
Notifier.cpp
linphone-desktop/src/components/notifier/Notifier.cpp
+3
-3
ContactEdit.js
linphone-desktop/ui/views/App/Main/ContactEdit.js
+1
-0
No files found.
linphone-desktop/src/components/call/CallModel.cpp
View file @
fc9e8b68
...
...
@@ -36,10 +36,10 @@ using namespace std;
// =============================================================================
CallModel
::
CallModel
(
shared_ptr
<
linphone
::
Call
>
linphoneC
all
)
{
Q_ASSERT
(
linphoneC
all
!=
nullptr
);
m
LinphoneCall
=
linphoneC
all
;
m
Linphone
Call
->
setData
(
"call-model"
,
*
this
);
CallModel
::
CallModel
(
shared_ptr
<
linphone
::
Call
>
c
all
)
{
Q_ASSERT
(
c
all
!=
nullptr
);
m
Call
=
c
all
;
mCall
->
setData
(
"call-model"
,
*
this
);
// Deal with auto-answer.
{
...
...
@@ -59,7 +59,7 @@ CallModel::CallModel (shared_ptr<linphone::Call> linphoneCall) {
QObject
::
connect
(
&
(
*
CoreManager
::
getInstance
()
->
getHandlers
()),
&
CoreHandlers
::
callStateChanged
,
this
,
[
this
](
const
shared_ptr
<
linphone
::
Call
>
&
call
,
linphone
::
CallState
state
)
{
if
(
call
!=
m
Linphone
Call
)
if
(
call
!=
mCall
)
return
;
switch
(
state
)
{
...
...
@@ -90,10 +90,10 @@ CallModel::CallModel (shared_ptr<linphone::Call> linphoneCall) {
case
linphone
:
:
CallStateUpdatedByRemote
:
if
(
!
m
Linphone
Call
->
getCurrentParams
()
->
videoEnabled
()
&&
m
Linphone
Call
->
getRemoteParams
()
->
videoEnabled
()
!
mCall
->
getCurrentParams
()
->
videoEnabled
()
&&
mCall
->
getRemoteParams
()
->
videoEnabled
()
)
{
m
Linphone
Call
->
deferUpdate
();
mCall
->
deferUpdate
();
emit
videoRequested
();
}
...
...
@@ -109,7 +109,7 @@ CallModel::CallModel (shared_ptr<linphone::Call> linphoneCall) {
}
CallModel
::~
CallModel
()
{
m
Linphone
Call
->
unsetData
(
"call-model"
);
mCall
->
unsetData
(
"call-model"
);
}
// -----------------------------------------------------------------------------
...
...
@@ -123,13 +123,13 @@ void CallModel::setRecordFile (shared_ptr<linphone::CallParams> &callParams) {
);
}
void
CallModel
::
updateStats
(
const
shared_ptr
<
const
linphone
::
CallStats
>
&
s
tats
)
{
switch
(
s
tats
->
getType
())
{
void
CallModel
::
updateStats
(
const
shared_ptr
<
const
linphone
::
CallStats
>
&
callS
tats
)
{
switch
(
callS
tats
->
getType
())
{
case
linphone
:
:
StreamTypeAudio
:
updateStats
(
s
tats
,
mAudioStats
);
updateStats
(
callS
tats
,
mAudioStats
);
break
;
case
linphone
:
:
StreamTypeVideo
:
updateStats
(
s
tats
,
mVideoStats
);
updateStats
(
callS
tats
,
mVideoStats
);
break
;
default:
break
;
...
...
@@ -144,31 +144,31 @@ void CallModel::accept () {
stopAutoAnswerTimer
();
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
shared_ptr
<
linphone
::
CallParams
>
params
=
core
->
createCallParams
(
m
Linphone
Call
);
shared_ptr
<
linphone
::
CallParams
>
params
=
core
->
createCallParams
(
mCall
);
params
->
enableVideo
(
false
);
setRecordFile
(
params
);
App
::
smartShowWindow
(
App
::
getInstance
()
->
getCallsWindow
());
m
Linphone
Call
->
acceptWithParams
(
params
);
mCall
->
acceptWithParams
(
params
);
}
void
CallModel
::
acceptWithVideo
()
{
stopAutoAnswerTimer
();
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
shared_ptr
<
linphone
::
CallParams
>
params
=
core
->
createCallParams
(
m
Linphone
Call
);
shared_ptr
<
linphone
::
CallParams
>
params
=
core
->
createCallParams
(
mCall
);
params
->
enableVideo
(
true
);
setRecordFile
(
params
);
App
::
smartShowWindow
(
App
::
getInstance
()
->
getCallsWindow
());
m
Linphone
Call
->
acceptWithParams
(
params
);
mCall
->
acceptWithParams
(
params
);
}
void
CallModel
::
terminate
()
{
CoreManager
*
core
=
CoreManager
::
getInstance
();
core
->
lockVideoRender
();
m
Linphone
Call
->
terminate
();
mCall
->
terminate
();
core
->
unlockVideoRender
();
}
...
...
@@ -178,14 +178,14 @@ void CallModel::transfer () {
void
CallModel
::
acceptVideoRequest
()
{
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
shared_ptr
<
linphone
::
CallParams
>
params
=
core
->
createCallParams
(
m
Linphone
Call
);
shared_ptr
<
linphone
::
CallParams
>
params
=
core
->
createCallParams
(
mCall
);
params
->
enableVideo
(
true
);
m
Linphone
Call
->
acceptUpdate
(
params
);
mCall
->
acceptUpdate
(
params
);
}
void
CallModel
::
rejectVideoRequest
()
{
m
LinphoneCall
->
acceptUpdate
(
mLinphone
Call
->
getCurrentParams
());
m
Call
->
acceptUpdate
(
m
Call
->
getCurrentParams
());
}
void
CallModel
::
takeSnapshot
()
{
...
...
@@ -199,9 +199,9 @@ void CallModel::takeSnapshot () {
oldName
=
newName
;
qInfo
()
<<
"Take snapshot of call:"
<<
&
m
Linphone
Call
;
qInfo
()
<<
"Take snapshot of call:"
<<
&
mCall
;
m
Linphone
Call
->
takeVideoSnapshot
(
mCall
->
takeVideoSnapshot
(
::
Utils
::
qStringToLinphoneString
(
CoreManager
::
getInstance
()
->
getSettingsModel
()
->
getSavedScreenshotsFolder
()
+
newName
)
...
...
@@ -212,9 +212,9 @@ void CallModel::startRecording () {
if
(
mRecording
)
return
;
qInfo
()
<<
"Start recording call:"
<<
&
m
Linphone
Call
;
qInfo
()
<<
"Start recording call:"
<<
&
mCall
;
m
Linphone
Call
->
startRecording
();
mCall
->
startRecording
();
mRecording
=
true
;
emit
recordingChanged
(
true
);
...
...
@@ -222,10 +222,10 @@ void CallModel::startRecording () {
void
CallModel
::
stopRecording
()
{
if
(
mRecording
)
{
qInfo
()
<<
"Stop recording call:"
<<
&
m
Linphone
Call
;
qInfo
()
<<
"Stop recording call:"
<<
&
mCall
;
mRecording
=
false
;
m
Linphone
Call
->
stopRecording
();
mCall
->
stopRecording
();
emit
recordingChanged
(
false
);
}
...
...
@@ -242,11 +242,11 @@ void CallModel::stopAutoAnswerTimer () const {
}
QString
CallModel
::
getSipAddress
()
const
{
return
::
Utils
::
linphoneStringToQString
(
m
Linphone
Call
->
getRemoteAddress
()
->
asStringUriOnly
());
return
::
Utils
::
linphoneStringToQString
(
mCall
->
getRemoteAddress
()
->
asStringUriOnly
());
}
CallModel
::
CallStatus
CallModel
::
getStatus
()
const
{
switch
(
m
Linphone
Call
->
getState
())
{
switch
(
mCall
->
getState
())
{
case
linphone
:
:
CallStateConnected
:
case
linphone
:
:
CallStateStreamsRunning
:
return
CallStatusConnected
;
...
...
@@ -279,17 +279,17 @@ CallModel::CallStatus CallModel::getStatus () const {
break
;
}
return
m
Linphone
Call
->
getDir
()
==
linphone
::
CallDirIncoming
?
CallStatusIncoming
:
CallStatusOutgoing
;
return
mCall
->
getDir
()
==
linphone
::
CallDirIncoming
?
CallStatusIncoming
:
CallStatusOutgoing
;
}
// -----------------------------------------------------------------------------
int
CallModel
::
getDuration
()
const
{
return
m
Linphone
Call
->
getDuration
();
return
mCall
->
getDuration
();
}
float
CallModel
::
getQuality
()
const
{
return
m
Linphone
Call
->
getCurrentQuality
();
return
mCall
->
getCurrentQuality
();
}
// -----------------------------------------------------------------------------
...
...
@@ -307,11 +307,11 @@ inline float computeVu (float volume) {
}
float
CallModel
::
getMicroVu
()
const
{
return
computeVu
(
m
Linphone
Call
->
getRecordVolume
());
return
computeVu
(
mCall
->
getRecordVolume
());
}
float
CallModel
::
getSpeakerVu
()
const
{
return
computeVu
(
m
Linphone
Call
->
getPlayVolume
());
return
computeVu
(
mCall
->
getPlayVolume
());
}
// -----------------------------------------------------------------------------
...
...
@@ -336,7 +336,7 @@ bool CallModel::getPausedByUser () const {
}
void
CallModel
::
setPausedByUser
(
bool
status
)
{
switch
(
m
Linphone
Call
->
getState
())
{
switch
(
mCall
->
getState
())
{
case
linphone
:
:
CallStateConnected
:
case
linphone
:
:
CallStateStreamsRunning
:
case
linphone
:
:
CallStatePaused
:
...
...
@@ -347,24 +347,24 @@ void CallModel::setPausedByUser (bool status) {
if
(
status
)
{
if
(
!
mPausedByUser
)
m
Linphone
Call
->
pause
();
mCall
->
pause
();
return
;
}
if
(
mPausedByUser
)
m
Linphone
Call
->
resume
();
mCall
->
resume
();
}
// -----------------------------------------------------------------------------
bool
CallModel
::
getVideoEnabled
()
const
{
shared_ptr
<
const
linphone
::
CallParams
>
params
=
m
Linphone
Call
->
getCurrentParams
();
shared_ptr
<
const
linphone
::
CallParams
>
params
=
mCall
->
getCurrentParams
();
return
params
&&
params
->
videoEnabled
()
&&
getStatus
()
==
CallStatusConnected
;
}
void
CallModel
::
setVideoEnabled
(
bool
status
)
{
switch
(
m
Linphone
Call
->
getState
())
{
switch
(
mCall
->
getState
())
{
case
linphone
:
:
CallStateConnected
:
case
linphone
:
:
CallStateStreamsRunning
:
break
;
...
...
@@ -375,16 +375,16 @@ void CallModel::setVideoEnabled (bool status) {
return
;
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
shared_ptr
<
linphone
::
CallParams
>
params
=
core
->
createCallParams
(
m
Linphone
Call
);
shared_ptr
<
linphone
::
CallParams
>
params
=
core
->
createCallParams
(
mCall
);
params
->
enableVideo
(
status
);
m
Linphone
Call
->
update
(
params
);
mCall
->
update
(
params
);
}
// -----------------------------------------------------------------------------
bool
CallModel
::
getUpdating
()
const
{
switch
(
m
Linphone
Call
->
getState
())
{
switch
(
mCall
->
getState
())
{
case
linphone
:
:
CallStateConnected
:
case
linphone
:
:
CallStateStreamsRunning
:
case
linphone
:
:
CallStatePaused
:
...
...
@@ -406,7 +406,7 @@ bool CallModel::getRecording () const {
void
CallModel
::
sendDtmf
(
const
QString
&
dtmf
)
{
qInfo
()
<<
QStringLiteral
(
"Send dtmf: `%1`."
).
arg
(
dtmf
);
m
Linphone
Call
->
sendDtmf
(
dtmf
.
constData
()[
0
].
toLatin1
());
mCall
->
sendDtmf
(
dtmf
.
constData
()[
0
].
toLatin1
());
}
// -----------------------------------------------------------------------------
...
...
@@ -426,9 +426,9 @@ inline QVariantMap createStat (const QString &key, const QString &value) {
return
m
;
}
void
CallModel
::
updateStats
(
const
shared_ptr
<
const
linphone
::
CallStats
>
&
callStats
,
QVariantList
&
stats
)
{
void
CallModel
::
updateStats
(
const
shared_ptr
<
const
linphone
::
CallStats
>
&
callStats
,
QVariantList
&
stats
List
)
{
QString
family
;
shared_ptr
<
const
linphone
::
CallParams
>
params
=
m
Linphone
Call
->
getCurrentParams
();
shared_ptr
<
const
linphone
::
CallParams
>
params
=
mCall
->
getCurrentParams
();
shared_ptr
<
const
linphone
::
PayloadType
>
payloadType
;
switch
(
callStats
->
getType
())
{
...
...
@@ -454,21 +454,21 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
break
;
}
stats
.
clear
();
stats
List
.
clear
();
stats
<<
createStat
(
tr
(
"callStatsCodec"
),
payloadType
stats
List
<<
createStat
(
tr
(
"callStatsCodec"
),
payloadType
?
QString
(
"%1 / %2kHz"
).
arg
(
Utils
::
linphoneStringToQString
(
payloadType
->
getMimeType
())).
arg
(
payloadType
->
getClockRate
()
/
1000
)
:
""
);
stats
<<
createStat
(
tr
(
"callStatsUploadBandwidth"
),
QString
(
"%1 kbits/s"
).
arg
(
int
(
callStats
->
getUploadBandwidth
())));
stats
<<
createStat
(
tr
(
"callStatsDownloadBandwidth"
),
QString
(
"%1 kbits/s"
).
arg
(
int
(
callStats
->
getDownloadBandwidth
())));
stats
<<
createStat
(
tr
(
"callStatsIceState"
),
iceStateToString
(
callStats
->
getIceState
()));
stats
<<
createStat
(
tr
(
"callStatsIpFamily"
),
family
);
stats
<<
createStat
(
tr
(
"callStatsSenderLossRate"
),
QString
(
"%1 %"
).
arg
(
callStats
->
getSenderLossRate
()));
stats
<<
createStat
(
tr
(
"callStatsReceiverLossRate"
),
QString
(
"%1 %"
).
arg
(
callStats
->
getReceiverLossRate
()));
stats
List
<<
createStat
(
tr
(
"callStatsUploadBandwidth"
),
QString
(
"%1 kbits/s"
).
arg
(
int
(
callStats
->
getUploadBandwidth
())));
stats
List
<<
createStat
(
tr
(
"callStatsDownloadBandwidth"
),
QString
(
"%1 kbits/s"
).
arg
(
int
(
callStats
->
getDownloadBandwidth
())));
stats
List
<<
createStat
(
tr
(
"callStatsIceState"
),
iceStateToString
(
callStats
->
getIceState
()));
stats
List
<<
createStat
(
tr
(
"callStatsIpFamily"
),
family
);
stats
List
<<
createStat
(
tr
(
"callStatsSenderLossRate"
),
QString
(
"%1 %"
).
arg
(
callStats
->
getSenderLossRate
()));
stats
List
<<
createStat
(
tr
(
"callStatsReceiverLossRate"
),
QString
(
"%1 %"
).
arg
(
callStats
->
getReceiverLossRate
()));
switch
(
callStats
->
getType
())
{
case
linphone
:
:
StreamTypeAudio
:
stats
<<
createStat
(
tr
(
"callStatsJitterBuffer"
),
QString
(
"%1 ms"
).
arg
(
callStats
->
getJitterBufferSizeMs
()));
stats
List
<<
createStat
(
tr
(
"callStatsJitterBuffer"
),
QString
(
"%1 ms"
).
arg
(
callStats
->
getJitterBufferSizeMs
()));
break
;
case
linphone
:
:
StreamTypeVideo
:
{
QString
sentVideoDefinitionName
=
Utils
::
linphoneStringToQString
(
params
->
getSentVideoDefinition
()
->
getName
());
...
...
@@ -476,7 +476,7 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
.
arg
(
params
->
getSentVideoDefinition
()
->
getWidth
())
.
arg
(
params
->
getSentVideoDefinition
()
->
getHeight
());
stats
<<
createStat
(
tr
(
"callStatsSentVideoDefinition"
),
sentVideoDefinition
==
sentVideoDefinitionName
stats
List
<<
createStat
(
tr
(
"callStatsSentVideoDefinition"
),
sentVideoDefinition
==
sentVideoDefinitionName
?
sentVideoDefinition
:
QString
(
"%1 (%2)"
).
arg
(
sentVideoDefinition
).
arg
(
sentVideoDefinitionName
));
...
...
@@ -485,7 +485,7 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
.
arg
(
params
->
getReceivedVideoDefinition
()
->
getWidth
())
.
arg
(
params
->
getReceivedVideoDefinition
()
->
getHeight
());
stats
<<
createStat
(
tr
(
"callStatsReceivedVideoDefinition"
),
receivedVideoDefinition
==
receivedVideoDefinitionName
stats
List
<<
createStat
(
tr
(
"callStatsReceivedVideoDefinition"
),
receivedVideoDefinition
==
receivedVideoDefinitionName
?
receivedVideoDefinition
:
QString
(
"%1 (%2)"
).
arg
(
receivedVideoDefinition
).
arg
(
receivedVideoDefinitionName
));
}
...
...
linphone-desktop/src/components/call/CallModel.hpp
View file @
fc9e8b68
...
...
@@ -67,12 +67,12 @@ public:
CallModel
(
std
::
shared_ptr
<
linphone
::
Call
>
linphoneCall
);
~
CallModel
();
std
::
shared_ptr
<
linphone
::
Call
>
get
Linphone
Call
()
const
{
return
m
Linphone
Call
;
std
::
shared_ptr
<
linphone
::
Call
>
getCall
()
const
{
return
mCall
;
}
static
void
setRecordFile
(
std
::
shared_ptr
<
linphone
::
CallParams
>
&
callParams
);
void
updateStats
(
const
std
::
shared_ptr
<
const
linphone
::
CallStats
>
&
s
tats
);
void
updateStats
(
const
std
::
shared_ptr
<
const
linphone
::
CallStats
>
&
callS
tats
);
Q_INVOKABLE
void
accept
();
Q_INVOKABLE
void
acceptWithVideo
();
...
...
@@ -103,7 +103,7 @@ private:
CallStatus
getStatus
()
const
;
bool
isOutgoing
()
const
{
return
m
Linphone
Call
->
getDir
()
==
linphone
::
CallDirOutgoing
;
return
mCall
->
getDir
()
==
linphone
::
CallDirOutgoing
;
}
int
getDuration
()
const
;
...
...
@@ -126,7 +126,7 @@ private:
QVariantList
getAudioStats
()
const
;
QVariantList
getVideoStats
()
const
;
void
updateStats
(
const
std
::
shared_ptr
<
const
linphone
::
CallStats
>
&
callStats
,
QVariantList
&
stats
);
void
updateStats
(
const
std
::
shared_ptr
<
const
linphone
::
CallStats
>
&
callStats
,
QVariantList
&
stats
List
);
QString
iceStateToString
(
linphone
::
IceState
state
)
const
;
...
...
@@ -137,7 +137,7 @@ private:
QVariantList
mAudioStats
;
QVariantList
mVideoStats
;
std
::
shared_ptr
<
linphone
::
Call
>
m
Linphone
Call
;
std
::
shared_ptr
<
linphone
::
Call
>
mCall
;
};
#endif // CALL_MODEL_H_
linphone-desktop/src/components/calls/CallsListModel.cpp
View file @
fc9e8b68
...
...
@@ -36,13 +36,13 @@ using namespace std;
// =============================================================================
inline
QList
<
CallModel
*>::
iterator
findCall
(
inline
QList
<
CallModel
*>::
iterator
findCall
Model
(
QList
<
CallModel
*>
&
list
,
const
shared_ptr
<
linphone
::
Call
>
&
linphoneC
all
const
shared_ptr
<
linphone
::
Call
>
&
c
all
)
{
return
find_if
(
list
.
begin
(),
list
.
end
(),
[
linphoneCall
](
CallModel
*
cal
l
)
{
return
linphoneCall
==
call
->
getLinphone
Call
();
list
.
begin
(),
list
.
end
(),
[
call
](
CallModel
*
callMode
l
)
{
return
call
==
callModel
->
get
Call
();
}
);
}
...
...
@@ -53,21 +53,21 @@ CallsListModel::CallsListModel (QObject *parent) : QAbstractListModel(parent) {
mCoreHandlers
=
CoreManager
::
getInstance
()
->
getHandlers
();
QObject
::
connect
(
&
(
*
mCoreHandlers
),
&
CoreHandlers
::
callStateChanged
,
this
,
[
this
](
const
shared_ptr
<
linphone
::
Call
>
&
linphoneC
all
,
linphone
::
CallState
state
)
{
this
,
[
this
](
const
shared_ptr
<
linphone
::
Call
>
&
c
all
,
linphone
::
CallState
state
)
{
switch
(
state
)
{
case
linphone
:
:
CallStateIncomingReceived
:
case
linphone
:
:
CallStateOutgoingInit
:
addCall
(
linphoneC
all
);
addCall
(
c
all
);
break
;
case
linphone
:
:
CallStateEnd
:
case
linphone
:
:
CallStateError
:
removeCall
(
linphoneC
all
);
removeCall
(
c
all
);
break
;
case
linphone
:
:
CallStateStreamsRunning
:
{
int
index
=
static_cast
<
int
>
(
distance
(
mList
.
begin
(),
findCall
(
mList
,
linphoneC
all
)));
emit
callRunning
(
index
,
&
linphoneC
all
->
getData
<
CallModel
>
(
"call-model"
));
int
index
=
static_cast
<
int
>
(
distance
(
mList
.
begin
(),
findCall
Model
(
mList
,
c
all
)));
emit
callRunning
(
index
,
&
c
all
->
getData
<
CallModel
>
(
"call-model"
));
}
break
;
...
...
@@ -100,8 +100,8 @@ QVariant CallsListModel::data (const QModelIndex &index, int role) const {
return
QVariant
();
}
CallModel
*
CallsListModel
::
getCall
(
const
shared_ptr
<
linphone
::
Call
>
&
linphoneC
all
)
const
{
auto
it
=
findCall
(
*
(
const_cast
<
QList
<
CallModel
*>
*>
(
&
mList
)),
linphoneC
all
);
CallModel
*
CallsListModel
::
getCall
Model
(
const
shared_ptr
<
linphone
::
Call
>
&
c
all
)
const
{
auto
it
=
findCall
Model
(
*
(
const_cast
<
QList
<
CallModel
*>
*>
(
&
mList
)),
c
all
);
return
it
!=
mList
.
end
()
?
*
it
:
nullptr
;
}
...
...
@@ -170,33 +170,42 @@ bool CallsListModel::removeRows (int row, int count, const QModelIndex &parent)
// -----------------------------------------------------------------------------
void
CallsListModel
::
addCall
(
const
shared_ptr
<
linphone
::
Call
>
&
linphoneC
all
)
{
if
(
linphoneC
all
->
getDir
()
==
linphone
::
CallDirOutgoing
)
void
CallsListModel
::
addCall
(
const
shared_ptr
<
linphone
::
Call
>
&
c
all
)
{
if
(
c
all
->
getDir
()
==
linphone
::
CallDirOutgoing
)
App
::
smartShowWindow
(
App
::
getInstance
()
->
getCallsWindow
());
CallModel
*
call
=
new
CallModel
(
linphoneC
all
);
CallModel
*
call
Model
=
new
CallModel
(
c
all
);
qInfo
()
<<
QStringLiteral
(
"Add call:"
)
<<
call
;
qInfo
()
<<
QStringLiteral
(
"Add call:"
)
<<
call
Model
;
App
::
getInstance
()
->
getEngine
()
->
setObjectOwnership
(
call
,
QQmlEngine
::
CppOwnership
);
App
::
getInstance
()
->
getEngine
()
->
setObjectOwnership
(
call
Model
,
QQmlEngine
::
CppOwnership
);
int
row
=
mList
.
count
();
beginInsertRows
(
QModelIndex
(),
row
,
row
);
mList
<<
call
;
mList
<<
call
Model
;
endInsertRows
();
}
void
CallsListModel
::
removeCall
(
const
shared_ptr
<
linphone
::
Call
>
&
linphoneCall
)
{
QTimer
::
singleShot
(
DELAY_BEFORE_REMOVE_CALL
,
this
,
[
this
,
linphoneCall
]()
{
CallModel
*
call
=
&
linphoneCall
->
getData
<
CallModel
>
(
"call-model"
);
void
CallsListModel
::
removeCall
(
const
shared_ptr
<
linphone
::
Call
>
&
call
)
{
CallModel
*
callModel
;
try
{
callModel
=
&
call
->
getData
<
CallModel
>
(
"call-model"
);
}
catch
(
const
out_of_range
&
)
{
// Can be a bug. Or the call model not exists because the linphone call state
// `CallStateIncomingReceived`/`CallStateOutgoingInit` was not notified.
qWarning
()
<<
QStringLiteral
(
"Unable to found call in:"
)
<<
callModel
;
return
;
}
qInfo
()
<<
QStringLiteral
(
"Removing call:"
)
<<
call
;
QTimer
::
singleShot
(
DELAY_BEFORE_REMOVE_CALL
,
this
,
[
this
,
callModel
]()
{
qInfo
()
<<
QStringLiteral
(
"Removing call:"
)
<<
callModel
;
int
index
=
mList
.
indexOf
(
call
);
int
index
=
mList
.
indexOf
(
call
Model
);
if
(
index
==
-
1
||
!
removeRow
(
index
))
qWarning
()
<<
QStringLiteral
(
"Unable to remove call:"
)
<<
call
;
qWarning
()
<<
QStringLiteral
(
"Unable to remove call:"
)
<<
call
Model
;
if
(
mList
.
empty
())
App
::
getInstance
()
->
getCallsWindow
()
->
close
();
...
...
linphone-desktop/src/components/calls/CallsListModel.hpp
View file @
fc9e8b68
...
...
@@ -43,7 +43,7 @@ public:
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
override
;
CallModel
*
getCall
(
const
std
::
shared_ptr
<
linphone
::
Call
>
&
linphoneC
all
)
const
;
CallModel
*
getCall
Model
(
const
std
::
shared_ptr
<
linphone
::
Call
>
&
c
all
)
const
;
Q_INVOKABLE
void
launchAudioCall
(
const
QString
&
sipUri
)
const
;
Q_INVOKABLE
void
launchVideoCall
(
const
QString
&
sipUri
)
const
;
...
...
@@ -53,14 +53,14 @@ public:
Q_INVOKABLE
void
terminateAllCalls
()
const
;
signals:
void
callRunning
(
int
index
,
CallModel
*
call
);
void
callRunning
(
int
index
,
CallModel
*
call
Model
);
private:
bool
removeRow
(
int
row
,
const
QModelIndex
&
parent
=
QModelIndex
());
bool
removeRows
(
int
row
,
int
count
,
const
QModelIndex
&
parent
=
QModelIndex
())
override
;
void
addCall
(
const
std
::
shared_ptr
<
linphone
::
Call
>
&
linphoneC
all
);
void
removeCall
(
const
std
::
shared_ptr
<
linphone
::
Call
>
&
linphoneC
all
);
void
addCall
(
const
std
::
shared_ptr
<
linphone
::
Call
>
&
c
all
);
void
removeCall
(
const
std
::
shared_ptr
<
linphone
::
Call
>
&
c
all
);
QList
<
CallModel
*>
mList
;
...
...
linphone-desktop/src/components/camera/Camera.cpp
View file @
fc9e8b68
...
...
@@ -57,8 +57,8 @@ CameraRenderer::~CameraRenderer () {
if
(
mIsPreview
)
coreManager
->
getCore
()
->
setNativePreviewWindowId
(
nullptr
);
else
if
(
m
Linphone
Call
)
m
Linphone
Call
->
setNativeVideoWindowId
(
nullptr
);
else
if
(
mCall
)
mCall
->
setNativeVideoWindowId
(
nullptr
);
coreManager
->
unlockVideoRender
();
...
...
@@ -104,8 +104,8 @@ void CameraRenderer::render () {
if
(
mIsPreview
)
coreManager
->
getCore
()
->
previewOglRender
();
else
if
(
m
Linphone
Call
)
m
Linphone
Call
->
oglRender
();
else
if
(
mCall
)
mCall
->
oglRender
();
msFunctions
->
bind
(
nullptr
);
coreManager
->
unlockVideoRender
();
...
...
@@ -124,8 +124,8 @@ void CameraRenderer::synchronize (QQuickFramebufferObject *item) {
Camera
*
camera
=
qobject_cast
<
Camera
*>
(
item
);
{
CallModel
*
model
=
camera
->
getCall
();
m
LinphoneCall
=
model
?
model
->
getLinphone
Call
()
:
nullptr
;
CallModel
*
model
=
camera
->
getCall
Model
();
m
Call
=
model
?
model
->
get
Call
()
:
nullptr
;
}
mIsPreview
=
camera
->
mIsPreview
;
...
...
@@ -144,8 +144,8 @@ void CameraRenderer::updateWindowId () {
if
(
mIsPreview
)
CoreManager
::
getInstance
()
->
getCore
()
->
setNativePreviewWindowId
(
mContextInfo
);
else
if
(
m
Linphone
Call
)
m
Linphone
Call
->
setNativeVideoWindowId
(
mContextInfo
);
else
if
(
mCall
)
mCall
->
setNativeVideoWindowId
(
mContextInfo
);
}
// -----------------------------------------------------------------------------
...
...
@@ -172,16 +172,16 @@ QQuickFramebufferObject::Renderer *Camera::createRenderer () const {
// -----------------------------------------------------------------------------
CallModel
*
Camera
::
getCall
()
const
{
return
mCall
;
CallModel
*
Camera
::
getCall
Model
()
const
{
return
mCall
Model
;
}
void
Camera
::
setCall
(
CallModel
*
cal
l
)
{
if
(
mCall
!=
cal
l
)
{
mCall
=
cal
l
;
void
Camera
::
setCall
Model
(
CallModel
*
callMode
l
)
{
if
(
mCall
Model
!=
callMode
l
)
{
mCall
Model
=
callMode
l
;
update
();
emit
callChanged
(
mCall
);
emit
callChanged
(
mCall
Model
);
}
}
...
...
linphone-desktop/src/components/camera/Camera.hpp
View file @
fc9e8b68
...
...
@@ -57,7 +57,7 @@ private:
bool
mUpdateContextInfo
=
false
;
bool
mIsPreview
=
false
;
std
::
shared_ptr
<
linphone
::
Call
>
m
Linphone
Call
;
std
::
shared_ptr
<
linphone
::
Call
>
mCall
;
QQuickWindow
*
mWindow
;
};
...
...
@@ -69,7 +69,7 @@ class Camera : public QQuickFramebufferObject {
Q_OBJECT
;
Q_PROPERTY
(
CallModel
*
call
READ
getCall
WRITE
setCal
l
NOTIFY
callChanged
);
Q_PROPERTY
(
CallModel
*
call
READ
getCall
Model
WRITE
setCallMode
l
NOTIFY
callChanged
);
Q_PROPERTY
(
bool
isPreview
READ
getIsPreview
WRITE
setIsPreview
NOTIFY
isPreviewChanged
);
public:
...
...
@@ -79,18 +79,18 @@ public:
QQuickFramebufferObject
::
Renderer
*
createRenderer
()
const
override
;
signals:
void
callChanged
(
CallModel
*
call
);
void
callChanged
(
CallModel
*
call
Model
);
void
isPreviewChanged
(
bool
isPreview
);
private:
CallModel
*
getCall
()
const
;
void
setCall
(
CallModel
*
cal
l
);
CallModel
*
getCall
Model
()
const
;
void
setCall
Model
(
CallModel
*
callMode
l
);
bool
getIsPreview
()
const
;
void
setIsPreview
(
bool
status
);
bool
mIsPreview
=
false
;
CallModel
*
mCall
=
nullptr
;
CallModel
*
mCall
Model
=
nullptr
;
QTimer
*
mRefreshTimer
;
};
...
...
linphone-desktop/src/components/chat/ChatModel.cpp
View file @
fc9e8b68
...
...
@@ -524,6 +524,7 @@ void ChatModel::insertCall (const shared_ptr<linphone::CallLog> &callLog) {
case
linphone
:
:
CallStatusAborted
:
case
linphone
:
:
CallStatusEarlyAborted
:
return
;
// Ignore aborted calls.
case
linphone
:
:
CallStatusSuccess
:
case
linphone
:
:
CallStatusMissed
:
case
linphone
:
:
CallStatusDeclined
:
...
...
linphone-desktop/src/components/contact/VcardModel.hpp
View file @
fc9e8b68
...
...
@@ -29,6 +29,8 @@
// =============================================================================
class
VcardModel
:
public
QObject
{
friend
class
ContactModel
;
Q_OBJECT
;
Q_PROPERTY
(
QString
username
READ
getUsername
WRITE
setUsername
NOTIFY
vcardUpdated
);
...
...
@@ -39,8 +41,6 @@ class VcardModel : public QObject {
Q_PROPERTY
(
QVariantList
emails
READ
getEmails
NOTIFY
vcardUpdated
);
Q_PROPERTY
(
QVariantList
urls
READ
getUrls
NOTIFY
vcardUpdated
);
friend
class
ContactModel
;
public:
VcardModel
(
std
::
shared_ptr
<
linphone
::
Vcard
>
vcard
)
:
mVcard
(
vcard
)
{}
...
...
linphone-desktop/src/components/notifier/Notifier.cpp
View file @
fc9e8b68
...
...
@@ -256,17 +256,17 @@ void Notifier::notifyReceivedCall (const shared_ptr<linphone::Call> &call) {
if
(
!
notification
)
return
;
CallModel
*
model
=
CoreManager
::
getInstance
()
->
getCallsListModel
()
->
getCal
l
(
call
);
CallModel
*
callModel
=
CoreManager
::
getInstance
()
->
getCallsListModel
()
->
getCallMode
l
(
call
);
QObject
::
connect
(
m
odel
,
&
CallModel
::
statusChanged
,
notification
,
[
this
,
notification
](
CallModel
::
CallStatus
status
)
{
callM
odel
,
&
CallModel
::
statusChanged
,
notification
,
[
this
,
notification
](
CallModel
::
CallStatus
status
)
{
if
(
status
==
CallModel
::
CallStatusEnded
||
status
==
CallModel
::
CallStatusConnected
)
deleteNotification
(
QVariant
::
fromValue
(
notification
));
}
);
QVariantMap
map
;
map
[
"call"
].
setValue
(
m
odel
);
map
[
"call"
].
setValue
(
callM
odel
);
::
setProperty
(
*
notification
,
NOTIFICATION_PROPERTY_DATA
,
map
);
showNotification
(
notification
,
NOTIFICATION_TIMEOUT_RECEIVED_CALL
);
...
...
linphone-desktop/ui/views/App/Main/ContactEdit.js
View file @
fc9e8b68
...
...
@@ -24,6 +24,7 @@ function handleCreation () {
contactEdit
.
_edition
=
true
}
else
{
contactEdit
.
_vcard
=
contact
.
vcard
}
}
...
...
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