Commit 41c388e6 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Calls/ConferenceManager): in progress

parent 67e51fa5
......@@ -60,8 +60,8 @@ if(NOT WIN32)
set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -Wsuggest-override -Werror=suggest-override")
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CUSTOM_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CUSTOM_FLAGS} -DNDEBUG -DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG")
# See: http://stackoverflow.com/a/1372836
if(WIN32)
......
......@@ -90,33 +90,61 @@ function getParams (call) {
}
}
// -----------------------------------------------------------------------------
// Helpers.
// -----------------------------------------------------------------------------
function handleCallRunning (index, call) {
calls.currentIndex = index
function updateSelectedCall (call, index) {
calls._selectedCall = call
if (index != null) {
calls.currentIndex = index
}
}
function handleCountChanged (count) {
if (count === 0) {
return 0
function resetSelectedCall () {
updateSelectedCall(null, -1)
}
function setIndexWithCall (call) {
var count = calls.count
for (var i = 0; i < count; i++) {
if (call === model.data(model.index(i, 0))) {
updateSelectedCall(call, i)
return
}
}
}
var index = calls.currentIndex
if (index !== -1) {
// -----------------------------------------------------------------------------
// View handlers.
// -----------------------------------------------------------------------------
function handleSelectedCall (call) {
setIndexWithCall(call)
}
function handleCountChanged (count) {
if (count === 0) {
return
}
var model = calls.model
index = count - 1
var call = calls._selectedCall
calls.currentIndex = index
calls._selectedCall = model.data(model.index(index, 0))
if (call == null) {
var model = calls.model
var index = count - 1
updateSelectedCall(model.data(model.index(index, 0)), index)
} else {
setIndexWithCall(call)
}
}
function resetSelectedCall () {
calls.currentIndex = -1
calls._selectedCall = null
// -----------------------------------------------------------------------------
// Model handlers.
// -----------------------------------------------------------------------------
function handleCallRunning (call) {
updateSelectedCall(call)
}
function handleRowsAboutToBeRemoved (_, first, last) {
......@@ -134,13 +162,13 @@ function handleRowsInserted (_, first, last) {
var call = model.data(model.index(index, 0))
if (call.isOutgoing) {
resetSelectedCall()
updateSelectedCall(call)
return
}
}
// First received call.
if (first === 0 && model.rowCount() === 1) {
resetSelectedCall()
updateSelectedCall(model.data(model.index(0, 0)))
}
}
......@@ -26,11 +26,12 @@ ListView {
// ---------------------------------------------------------------------------
onCountChanged: Logic.handleCountChanged(count)
onSelectedCall: Logic.handleSelectedCall(call)
Connections {
target: model
onCallRunning: Logic.handleCallRunning(index, callModel)
onCallRunning: Logic.handleCallRunning(callModel)
onRowsAboutToBeRemoved: Logic.handleRowsAboutToBeRemoved(parent, first, last)
onRowsInserted: Logic.handleRowsInserted(parent, first, last)
}
......@@ -86,6 +87,8 @@ ListView {
}
}
// ---------------------------------------------------------------------------
// Calls.
// ---------------------------------------------------------------------------
delegate: CallControls {
......@@ -119,8 +122,7 @@ ListView {
onClicked: {
if ($call.status !== CallModel.CallStatusEnded) {
_selectedCall = $call
calls.currentIndex = index
Logic.updateSelectedCall($call, index)
}
}
......
......@@ -31,6 +31,9 @@ RowLayout {
}
var previousEntry = proxyModel.data(proxyModel.index(index - 1, 0))
if (!previousEntry) {
return true
}
// 2. Previous entry is a call event. => Visible.
// 3. I have sent a message before my contact. => Visible.
......
......@@ -23,6 +23,7 @@ Window {
isOutgoing: true,
recording: false,
sipAddress: '',
type: false,
updating: true,
videoEnabled: false
})
......
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