diff --git a/linphone-desktop/CMakeLists.txt b/linphone-desktop/CMakeLists.txt index 0a2a0c596..82a23493b 100644 --- a/linphone-desktop/CMakeLists.txt +++ b/linphone-desktop/CMakeLists.txt @@ -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) diff --git a/linphone-desktop/ui/modules/Linphone/Calls/Calls.js b/linphone-desktop/ui/modules/Linphone/Calls/Calls.js index 551a850c6..c6c8a7a8b 100644 --- a/linphone-desktop/ui/modules/Linphone/Calls/Calls.js +++ b/linphone-desktop/ui/modules/Linphone/Calls/Calls.js @@ -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 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 + } + } +} + +// ----------------------------------------------------------------------------- +// View handlers. +// ----------------------------------------------------------------------------- + +function handleSelectedCall (call) { + setIndexWithCall(call) } function handleCountChanged (count) { if (count === 0) { - return 0 - } - - var index = calls.currentIndex - if (index !== -1) { 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))) } } diff --git a/linphone-desktop/ui/modules/Linphone/Calls/Calls.qml b/linphone-desktop/ui/modules/Linphone/Calls/Calls.qml index 233463fcf..d2d9cfe23 100644 --- a/linphone-desktop/ui/modules/Linphone/Calls/Calls.qml +++ b/linphone-desktop/ui/modules/Linphone/Calls/Calls.qml @@ -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) } } diff --git a/linphone-desktop/ui/modules/Linphone/Chat/IncomingMessage.qml b/linphone-desktop/ui/modules/Linphone/Chat/IncomingMessage.qml index fb8450358..dae1729fd 100644 --- a/linphone-desktop/ui/modules/Linphone/Chat/IncomingMessage.qml +++ b/linphone-desktop/ui/modules/Linphone/Chat/IncomingMessage.qml @@ -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. diff --git a/linphone-desktop/ui/views/App/Calls/CallsWindow.qml b/linphone-desktop/ui/views/App/Calls/CallsWindow.qml index b1afd1aa5..df7da1216 100644 --- a/linphone-desktop/ui/views/App/Calls/CallsWindow.qml +++ b/linphone-desktop/ui/views/App/Calls/CallsWindow.qml @@ -23,6 +23,7 @@ Window { isOutgoing: true, recording: false, sipAddress: '', + type: false, updating: true, videoEnabled: false })