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
e1fb1a39
Commit
e1fb1a39
authored
Feb 09, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/modules/Linphone/Calls/Calls): change current call when stream is running
parent
9304442b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
61 deletions
+82
-61
CallsListModel.cpp
linphone-desktop/src/components/calls/CallsListModel.cpp
+20
-6
CallsListModel.hpp
linphone-desktop/src/components/calls/CallsListModel.hpp
+3
-0
SmartConnect.qml
linphone-desktop/ui/modules/Common/SmartConnect.qml
+5
-1
Calls.qml
linphone-desktop/ui/modules/Linphone/Calls/Calls.qml
+54
-54
No files found.
linphone-desktop/src/components/calls/CallsListModel.cpp
View file @
e1fb1a39
...
...
@@ -36,6 +36,19 @@ using namespace std;
// =============================================================================
inline
QList
<
CallModel
*>::
iterator
findCall
(
QList
<
CallModel
*>
&
list
,
const
shared_ptr
<
linphone
::
Call
>
&
linphone_call
)
{
return
find_if
(
list
.
begin
(),
list
.
end
(),
[
linphone_call
](
CallModel
*
call
)
{
return
linphone_call
==
call
->
getLinphoneCall
();
}
);
}
// -----------------------------------------------------------------------------
CallsListModel
::
CallsListModel
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
{
m_core_handlers
=
CoreManager
::
getInstance
()
->
getHandlers
();
QObject
::
connect
(
...
...
@@ -52,6 +65,12 @@ CallsListModel::CallsListModel (QObject *parent) : QAbstractListModel(parent) {
removeCall
(
linphone_call
);
break
;
case
linphone
:
:
CallStateStreamsRunning
:
{
int
index
=
static_cast
<
int
>
(
distance
(
m_list
.
begin
(),
findCall
(
m_list
,
linphone_call
)));
emit
callRunning
(
index
,
&
linphone_call
->
getData
<
CallModel
>
(
"call-model"
));
}
break
;
default:
break
;
}
...
...
@@ -82,12 +101,7 @@ QVariant CallsListModel::data (const QModelIndex &index, int role) const {
}
CallModel
*
CallsListModel
::
getCall
(
const
shared_ptr
<
linphone
::
Call
>
&
linphone_call
)
const
{
auto
it
=
find_if
(
m_list
.
begin
(),
m_list
.
end
(),
[
linphone_call
](
CallModel
*
call
)
{
return
linphone_call
==
call
->
getLinphoneCall
();
}
);
auto
it
=
findCall
(
*
(
const_cast
<
QList
<
CallModel
*>
*>
(
&
m_list
)),
linphone_call
);
return
it
!=
m_list
.
end
()
?
*
it
:
nullptr
;
}
...
...
linphone-desktop/src/components/calls/CallsListModel.hpp
View file @
e1fb1a39
...
...
@@ -48,6 +48,9 @@ public:
Q_INVOKABLE
void
launchAudioCall
(
const
QString
&
sip_uri
)
const
;
Q_INVOKABLE
void
launchVideoCall
(
const
QString
&
sip_uri
)
const
;
signals:
void
callRunning
(
int
index
,
CallModel
*
call
);
private:
bool
removeRow
(
int
row
,
const
QModelIndex
&
parent
=
QModelIndex
());
bool
removeRows
(
int
row
,
int
count
,
const
QModelIndex
&
parent
=
QModelIndex
())
override
;
...
...
linphone-desktop/ui/modules/Common/SmartConnect.qml
View file @
e1fb1a39
...
...
@@ -20,7 +20,11 @@ Item {
Component.onDestruction
:
{
for
(
var
signalName
in
handlers
)
{
handlers
[
signalName
].
forEach
(
function
(
value
)
{
value
[
0
][
signalName
].
disconnect
(
value
[
1
])
var
component
=
value
[
0
][
signalName
]
if
(
component
)
{
component
.
disconnect
(
value
[
1
])
}
})
}
}
...
...
linphone-desktop/ui/modules/Linphone/Calls/Calls.qml
View file @
e1fb1a39
...
...
@@ -11,9 +11,10 @@ ListView {
// ---------------------------------------------------------------------------
readonly
property
var
selectedCall
:
smartConnect
.
selectedCall
readonly
property
var
selectedCall
:
_
selectedCall
property
var
_mapStatusToParams
property
var
_selectedCall
// ---------------------------------------------------------------------------
...
...
@@ -102,6 +103,57 @@ ListView {
string
:
'
paused
'
}
})
model
.
rowsAboutToBeRemoved
.
connect
(
function
(
_
,
first
,
last
)
{
var
index
=
calls
.
currentIndex
if
(
index
>=
first
&&
index
<=
last
)
{
// Remove current call.
if
(
model
.
rowCount
()
-
(
last
-
first
+
1
)
<=
0
)
{
_selectedCall
=
null
}
else
{
if
(
first
===
0
)
{
_selectedCall
=
model
.
data
(
model
.
index
(
last
+
1
,
0
))
}
else
{
_selectedCall
=
model
.
data
(
model
.
index
(
0
,
0
))
}
}
}
})
model
.
rowsRemoved
.
connect
(
function
(
_
,
first
,
last
)
{
var
index
=
calls
.
currentIndex
// The current call has been removed.
if
(
index
>=
first
&&
index
<=
last
)
{
if
(
model
.
rowCount
()
===
0
)
{
calls
.
currentIndex
=
-
1
// No calls.
}
else
{
calls
.
currentIndex
=
0
// The first call becomes the selected call.
}
}
// Update the current index of the selected call if it was after the removed calls.
else
if
(
last
<
index
)
{
calls
.
currentIndex
=
index
-
(
last
-
first
+
1
)
}
})
// The last inserted outgoing element become the selected call.
model
.
rowsInserted
.
connect
(
function
(
_
,
first
,
last
)
{
for
(
var
index
=
last
;
index
>=
first
;
index
--
)
{
var
call
=
model
.
data
(
model
.
index
(
index
,
0
))
if
(
call
.
isOutgoing
)
{
calls
.
currentIndex
=
first
_selectedCall
=
model
.
data
(
model
.
index
(
first
,
0
))
}
}
})
model
.
callRunning
.
connect
(
function
(
index
,
call
)
{
calls
.
currentIndex
=
index
_selectedCall
=
call
})
}
// ---------------------------------------------------------------------------
...
...
@@ -161,58 +213,6 @@ ListView {
}
}
// ---------------------------------------------------------------------------
// SmartConnect that updates the current selected call and the current index.
// ---------------------------------------------------------------------------
SmartConnect
{
id
:
smartConnect
property
var
selectedCall
Component.onCompleted
:
{
this
.
connect
(
model
,
'
rowsAboutToBeRemoved
'
,
function
(
_
,
first
,
last
)
{
var
index
=
calls
.
currentIndex
if
(
index
>=
first
&&
index
<=
last
)
{
// Remove current call.
if
(
model
.
rowCount
()
-
(
last
-
first
+
1
)
<=
0
)
{
selectedCall
=
null
}
else
{
if
(
first
===
0
)
{
selectedCall
=
model
.
data
(
model
.
index
(
last
+
1
,
0
))
}
else
{
selectedCall
=
model
.
data
(
model
.
index
(
0
,
0
))
}
}
}
})
this
.
connect
(
model
,
'
rowsRemoved
'
,
function
(
_
,
first
,
last
)
{
var
index
=
calls
.
currentIndex
// The current call has been removed.
if
(
index
>=
first
&&
index
<=
last
)
{
if
(
model
.
rowCount
()
===
0
)
{
calls
.
currentIndex
=
-
1
// No calls.
}
else
{
calls
.
currentIndex
=
0
// The first call becomes the selected call.
}
}
// Update the current index of the selected call if it was after the removed calls.
else
if
(
last
<
index
)
{
calls
.
currentIndex
=
index
-
(
last
-
first
+
1
)
}
})
// The last inserted element become the selected call.
this
.
connect
(
model
,
'
rowsInserted
'
,
function
(
_
,
first
,
last
)
{
calls
.
currentIndex
=
first
selectedCall
=
model
.
data
(
model
.
index
(
first
,
0
))
})
}
}
// ---------------------------------------------------------------------------
delegate
:
CallControls
{
...
...
@@ -245,7 +245,7 @@ ListView {
width
:
parent
.
width
onClicked
:
{
smartConnect
.
selectedCall
=
$call
_
selectedCall
=
$call
calls
.
currentIndex
=
index
}
...
...
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