Display outgoing call when calling instead of blank page.

Use c++ global cursor to get position when leaving windows for fixing fullscreen behavior on comboboxes (and any others items that can grab mouse events).
Qt workaround for fixing layouts that are not refreshed when size/content change.
This commit is contained in:
Julien Wadel 2022-09-27 14:19:53 +02:00
parent 15e0437f69
commit a93200e00b
6 changed files with 40 additions and 15 deletions

View file

@ -474,6 +474,14 @@ void CallsListModel::handleCallStateChanged (const shared_ptr<linphone::Call> &c
// -----------------------------------------------------------------------------
void CallsListModel::addCall (const shared_ptr<linphone::Call> &call) {
QSharedPointer<CallModel> callModel = QSharedPointer<CallModel>::create(call);
qInfo() << QStringLiteral("Add call:") << callModel->getFullLocalAddress() << callModel->getFullPeerAddress();
App::getInstance()->getEngine()->setObjectOwnership(callModel.get(), QQmlEngine::CppOwnership);
add(callModel);
emit layoutChanged();
if (call->getDir() == linphone::Call::Dir::Outgoing) {
QQuickWindow *callsWindow = App::getInstance()->getCallsWindow();
if (callsWindow) {
@ -484,13 +492,6 @@ void CallsListModel::addCall (const shared_ptr<linphone::Call> &call) {
App::smartShowWindow(callsWindow);
}
}
QSharedPointer<CallModel> callModel = QSharedPointer<CallModel>::create(call);
qInfo() << QStringLiteral("Add call:") << callModel->getFullLocalAddress() << callModel->getFullPeerAddress();
App::getInstance()->getEngine()->setObjectOwnership(callModel.get(), QQmlEngine::CppOwnership);
add(callModel);
emit layoutChanged();
}

View file

@ -20,6 +20,7 @@
#include <QFileInfo>
#include <QCoreApplication>
#include <QCursor>
#include <QDir>
#include <QFile>
#include <QImageReader>
@ -564,4 +565,8 @@ QSize Utils::getImageSize(const QString& url){
return s;
else
return QSize(0,0);
}
QPoint Utils::getCursorPosition(){
return QCursor::pos();
}

View file

@ -63,6 +63,7 @@ public:
Q_INVOKABLE static bool isAnimatedImage(const QString& path);
Q_INVOKABLE static bool isPhoneNumber(const QString& txt);
Q_INVOKABLE QSize getImageSize(const QString& url);
Q_INVOKABLE static QPoint getCursorPosition();
//----------------------------------------------------------------------------------
static inline QString coreStringToAppString (const std::string &str) {

View file

@ -201,8 +201,11 @@ function handleCountChanged (count) {
var model = calls.model
var index = count - 1
if(model && model.status === CallModel.CallStatusConnected)
updateSelectedCall(model.data(model.index(index, 0)), index)
if(model){
var callModel = model.data(model.index(index, 0))
if( callModel.status === Linphone.CallModel.CallStatusConnected || callModel.isOutgoing )
updateSelectedCall(callModel, index)
}
} else {
setIndexWithCall(call)
}

View file

@ -120,7 +120,20 @@ Item {
spacing: 15
verticalLayoutDirection: ListView.BottomToTop
fitCacheToContent: false
onCountChanged: if(contentItem.height < miniViews.height) positionViewAtBeginning()
onCountChanged: updateView()
onHeightChanged: updateView()
function updateView(){
if(contentItem.height < miniViews.height){
contentItem.y = miniViews.height // Qt workaround because it do not set correctly value with positionning to beginning
}
}
Component.onCompleted: updateView()
Timer{
running: true
interval: 500
repeat: true
onTriggered: miniViews.updateView()
}
delegate:Item{
height: miniViews.cellHeight
width: miniViews.width

View file

@ -570,12 +570,14 @@ Window {
propagateComposedEvents: true
cursorShape: undefined
//cursorShape: Qt.ArrowCursor
onEntered: hideButtonsTimer.startTimer()
onExited: hideButtonsTimer.stopTimer()
onPositionChanged: {
hideButtonsTimer.startTimer()
onExited: {
var cursorPosition = UtilsCpp.getCursorPosition()
mapToItem(window.contentItem, cursorPosition.x, cursorPosition.y)
if (cursorPosition.x <= 0 || cursorPosition.y <= 0
|| cursorPosition.x >= width || cursorPosition.y >= height)
hideButtonsTimer.stopTimer()
}
onPositionChanged: hideButtonsTimer.startTimer()
}
}