Fix crashs on video call.

- do deleteLater on QObjects.
- Queued QQuickFramebufferObject updates.
- Clean Linphone SDK window ID on Camera deletion (Qml side, it cannot be done on C++ beacause of asynchroneous signals).
- Do cleaning synchronization between calls window and fullscreen.
- Avoid to rebuild all entries of ChatRoom when below minimum limits (keep this feature to avoid loading time when initiate the call).
This commit is contained in:
Julien Wadel 2022-03-24 16:40:29 +01:00
parent ac1206450b
commit 1667b78b4b
25 changed files with 190 additions and 116 deletions

View file

@ -69,17 +69,17 @@ SingleApplicationPrivate::SingleApplicationPrivate (SingleApplication *p_ptr) :
SingleApplicationPrivate::~SingleApplicationPrivate () {
if (socket != nullptr) {
socket->close();
delete socket;
socket->deleteLater();
}
memory->lock();
InstancesInfo *inst = static_cast<InstancesInfo *>(memory->data());
if (server != nullptr) {
server->close();
delete server;
server->deleteLater();
inst->primary = false;
}
memory->unlock();
delete memory;
memory->deleteLater();
}
void SingleApplicationPrivate::genBlockServerName (int timeout) {
@ -276,7 +276,7 @@ void SingleApplicationPrivate::slotConnectionEstablished () {
if (connectionType == InvalidConnection) {
nextConnSocket->close();
delete nextConnSocket;
nextConnSocket->deleteLater();
return;
}
@ -376,7 +376,7 @@ SingleApplication::SingleApplication (int &argc, char *argv[], bool allowSeconda
}
d->connectToPrimary(timeout, NewInstance);
delete d;
d->deleteLater();
::exit(EXIT_SUCCESS);
}
@ -385,7 +385,7 @@ SingleApplication::SingleApplication (int &argc, char *argv[], bool allowSeconda
*/
SingleApplication::~SingleApplication () {
Q_D(SingleApplication);
delete d;
d->deleteLater();
}
bool SingleApplication::isPrimary () {

View file

@ -141,7 +141,7 @@ void CallsListModel::launchAudioCall (const QString &sipAddress, const QString&
[address,core,params,currentProxyConfig,prepareTransfertAddress, context](const std::shared_ptr<linphone::ProxyConfig> &proxyConfig, linphone::RegistrationState state) mutable {
if(context && proxyConfig==currentProxyConfig && state==linphone::RegistrationState::Ok){
CallModel::prepareTransfert(core->inviteAddressWithParams(address, params), prepareTransfertAddress);
delete context;
context->deleteLater();
context = nullptr;
}
});
@ -179,7 +179,7 @@ void CallsListModel::launchSecureAudioCall (const QString &sipAddress, LinphoneE
[address,core,params,currentProxyConfig,prepareTransfertAddress, context](const std::shared_ptr<linphone::ProxyConfig> &proxyConfig, linphone::RegistrationState state) mutable {
if(context && proxyConfig==currentProxyConfig && state==linphone::RegistrationState::Ok){
CallModel::prepareTransfert(core->inviteAddressWithParams(address, params), prepareTransfertAddress);
delete context;
context->deleteLater();
context = nullptr;
}
});

View file

@ -48,12 +48,21 @@ Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) {
QObject::connect(
mRefreshTimer, &QTimer::timeout,
this, &QQuickFramebufferObject::update,
Qt::DirectConnection
Qt::QueuedConnection
);
mRefreshTimer->start();
}
void Camera::resetWindowId() {
if(mIsPreview)
CoreManager::getInstance()->getCore()->setNativePreviewWindowId(NULL);
else if( mCallModel && mCallModel->getCall())
mCallModel->getCall()->setNativeVideoWindowId(NULL);
else
CoreManager::getInstance()->getCore()->setNativeVideoWindowId(NULL);
}
class SafeFramebuffer : public QQuickFramebufferObject::Renderer{
public:
SafeFramebuffer(){}

View file

@ -46,6 +46,8 @@ public:
Camera (QQuickItem *parent = Q_NULLPTR);
QQuickFramebufferObject::Renderer *createRenderer () const override;
Q_INVOKABLE void resetWindowId();
signals:
void callChanged (CallModel *callModel);

View file

@ -921,41 +921,51 @@ int ChatRoomModel::loadTillMessage(ChatMessageModel * message){
return -1;
}
void ChatRoomModel::initEntries(){
qDebug() << "Internal Entries : Init";
// On call : reinitialize all entries. This allow to free up memory
QList<std::shared_ptr<ChatEvent> > entries;
QList<EntrySorterHelper> prepareEntries;
// Get chat messages
for (auto &message : mChatRoom->getHistory(mFirstLastEntriesStep)) {
prepareEntries << EntrySorterHelper(message->getTime() ,MessageEntry, message);
}
// Get events
for(auto &eventLog : mChatRoom->getHistoryEvents(mFirstLastEntriesStep))
prepareEntries << EntrySorterHelper(eventLog->getCreationTime() , NoticeEntry, eventLog);
// Get calls.
bool secureChatEnabled = CoreManager::getInstance()->getSettingsModel()->getSecureChatEnabled();
bool standardChatEnabled = CoreManager::getInstance()->getSettingsModel()->getStandardChatEnabled();
void ChatRoomModel::resetEntries(){
beginResetModel();
mEntries.clear();
endResetModel();
}
if( isOneToOne() && (secureChatEnabled && !standardChatEnabled && isSecure()
|| standardChatEnabled && !isSecure()) ) {
auto callHistory = CallsListModel::getCallHistory(getParticipantAddress(), Utils::coreStringToAppString(mChatRoom->getLocalAddress()->asStringUriOnly()));
// callhistory is sorted from newest to oldest
int count = 0;
for (auto callLog = callHistory.begin() ; count < mFirstLastEntriesStep && callLog != callHistory.end() ; ++callLog, ++count ){
prepareEntries << EntrySorterHelper((*callLog)->getStartDate(), CallEntry, *callLog);
void ChatRoomModel::initEntries(){
if( mEntries.size() > mLastEntriesStep)
resetEntries();
if(mEntries.size() == 0) {
qDebug() << "Internal Entries : Init";
// On call : reinitialize all entries. This allow to free up memory
QList<std::shared_ptr<ChatEvent> > entries;
QList<EntrySorterHelper> prepareEntries;
// Get chat messages
for (auto &message : mChatRoom->getHistory(mFirstLastEntriesStep)) {
prepareEntries << EntrySorterHelper(message->getTime() ,MessageEntry, message);
}
// Get events
for(auto &eventLog : mChatRoom->getHistoryEvents(mFirstLastEntriesStep))
prepareEntries << EntrySorterHelper(eventLog->getCreationTime() , NoticeEntry, eventLog);
// Get calls.
bool secureChatEnabled = CoreManager::getInstance()->getSettingsModel()->getSecureChatEnabled();
bool standardChatEnabled = CoreManager::getInstance()->getSettingsModel()->getStandardChatEnabled();
if( isOneToOne() && (secureChatEnabled && !standardChatEnabled && isSecure()
|| standardChatEnabled && !isSecure()) ) {
auto callHistory = CallsListModel::getCallHistory(getParticipantAddress(), Utils::coreStringToAppString(mChatRoom->getLocalAddress()->asStringUriOnly()));
// callhistory is sorted from newest to oldest
int count = 0;
for (auto callLog = callHistory.begin() ; count < mFirstLastEntriesStep && callLog != callHistory.end() ; ++callLog, ++count ){
prepareEntries << EntrySorterHelper((*callLog)->getStartDate(), CallEntry, *callLog);
}
}
EntrySorterHelper::getLimitedSelection(&entries, prepareEntries, mFirstLastEntriesStep, this);
qDebug() << "Internal Entries : Built";
mIsInitialized = true;
if(entries.size() >0){
beginInsertRows(QModelIndex(),0, entries.size()-1);
mEntries = entries;
updateNewMessageNotice(mChatRoom->getUnreadMessagesCount());
endInsertRows();
}
qDebug() << "Internal Entries : End";
}
EntrySorterHelper::getLimitedSelection(&entries, prepareEntries, mFirstLastEntriesStep, this);
qDebug() << "Internal Entries : Built";
mIsInitialized = true;
if(entries.size() >0){
beginResetModel();
mEntries = entries;
updateNewMessageNotice(mChatRoom->getUnreadMessagesCount());
endResetModel();
}
qDebug() << "Internal Entries : End";
}
void ChatRoomModel::setEntriesLoading(const bool& loading){
if( mEntriesLoading != loading){

View file

@ -231,7 +231,8 @@ public:
Q_INVOKABLE void forwardMessage(ChatMessageModel * model);
void compose ();
Q_INVOKABLE void resetMessageCount ();
Q_INVOKABLE void initEntries();
Q_INVOKABLE void resetEntries();
void initEntries();
Q_INVOKABLE int loadMoreEntries(); // return new entries count
void callEnded(std::shared_ptr<linphone::Call> call);
void updateNewMessageNotice(const int& count);

View file

@ -246,30 +246,29 @@ QString ChatRoomProxyModel::getCachedText() const{
// -----------------------------------------------------------------------------
void ChatRoomProxyModel::reload (ChatRoomModel *chatRoomModel) {
if (mChatRoomModel) {
ChatRoomModel *ChatRoomModel = mChatRoomModel.get();
QObject::disconnect(ChatRoomModel, &ChatRoomModel::isRemoteComposingChanged, this, &ChatRoomProxyModel::handleIsRemoteComposingChanged);
QObject::disconnect(ChatRoomModel, &ChatRoomModel::messageReceived, this, &ChatRoomProxyModel::handleMessageReceived);
QObject::disconnect(ChatRoomModel, &ChatRoomModel::messageSent, this, &ChatRoomProxyModel::handleMessageSent);
QObject::disconnect(ChatRoomModel, &ChatRoomModel::markAsReadEnabledChanged, this, &ChatRoomProxyModel::markAsReadEnabledChanged);
QObject::disconnect(ChatRoomModel, &ChatRoomModel::moreEntriesLoaded, this, &ChatRoomProxyModel::onMoreEntriesLoaded);
if(chatRoomModel != mChatRoomModel.get()) {
if (mChatRoomModel) {
ChatRoomModel *ChatRoomModel = mChatRoomModel.get();
QObject::disconnect(ChatRoomModel, &ChatRoomModel::isRemoteComposingChanged, this, &ChatRoomProxyModel::handleIsRemoteComposingChanged);
QObject::disconnect(ChatRoomModel, &ChatRoomModel::messageReceived, this, &ChatRoomProxyModel::handleMessageReceived);
QObject::disconnect(ChatRoomModel, &ChatRoomModel::messageSent, this, &ChatRoomProxyModel::handleMessageSent);
QObject::disconnect(ChatRoomModel, &ChatRoomModel::markAsReadEnabledChanged, this, &ChatRoomProxyModel::markAsReadEnabledChanged);
QObject::disconnect(ChatRoomModel, &ChatRoomModel::moreEntriesLoaded, this, &ChatRoomProxyModel::onMoreEntriesLoaded);
}
mChatRoomModel = CoreManager::getInstance()->getTimelineListModel()->getChatRoomModel(chatRoomModel);
setSourceModel(mChatRoomModel.get());
if (mChatRoomModel) {
ChatRoomModel *ChatRoomModel = mChatRoomModel.get();
QObject::connect(ChatRoomModel, &ChatRoomModel::isRemoteComposingChanged, this, &ChatRoomProxyModel::handleIsRemoteComposingChanged);
QObject::connect(ChatRoomModel, &ChatRoomModel::messageReceived, this, &ChatRoomProxyModel::handleMessageReceived);
QObject::connect(ChatRoomModel, &ChatRoomModel::messageSent, this, &ChatRoomProxyModel::handleMessageSent);
QObject::connect(ChatRoomModel, &ChatRoomModel::markAsReadEnabledChanged, this, &ChatRoomProxyModel::markAsReadEnabledChanged);
QObject::connect(ChatRoomModel, &ChatRoomModel::moreEntriesLoaded, this, &ChatRoomProxyModel::onMoreEntriesLoaded);
mChatRoomModel->initEntries();// This way, we don't load huge chat rooms (that lead to freeze GUI)
}
}
mChatRoomModel = CoreManager::getInstance()->getTimelineListModel()->getChatRoomModel(chatRoomModel);
if (mChatRoomModel) {
ChatRoomModel *ChatRoomModel = mChatRoomModel.get();
QObject::connect(ChatRoomModel, &ChatRoomModel::isRemoteComposingChanged, this, &ChatRoomProxyModel::handleIsRemoteComposingChanged);
QObject::connect(ChatRoomModel, &ChatRoomModel::messageReceived, this, &ChatRoomProxyModel::handleMessageReceived);
QObject::connect(ChatRoomModel, &ChatRoomModel::messageSent, this, &ChatRoomProxyModel::handleMessageSent);
QObject::connect(ChatRoomModel, &ChatRoomModel::markAsReadEnabledChanged, this, &ChatRoomProxyModel::markAsReadEnabledChanged);
QObject::connect(ChatRoomModel, &ChatRoomModel::moreEntriesLoaded, this, &ChatRoomProxyModel::onMoreEntriesLoaded);
mChatRoomModel->initEntries();// This way, we don't load huge chat rooms (that lead to freeze GUI)
}
setSourceModel(mChatRoomModel.get());
invalidate();
//invalidate();
}
void ChatRoomProxyModel::resetMessageCount(){

View file

@ -44,10 +44,10 @@ ContactsImporterModel::ContactsImporterModel (PluginDataAPI * data, QObject *par
void ContactsImporterModel::setDataAPI(PluginDataAPI *data){
if(mData){// Unload the current plugin loader and delete it from memory
QPluginLoader * loader = mData->getPluginLoader();
delete mData;
mData->deleteLater();
if(loader){
loader->unload();
delete loader;
loader->deleteLater();
}
mData = data;
}else

View file

@ -112,6 +112,6 @@ void ContactsImporterPluginsManager::importContacts(const QVector<QMultiMap<QStr
if( card->getSipAddresses().size()>0){
CoreManager::getInstance()->getContactsListModel()->addContact(card);
}else
delete card;
card->deleteLater();
}
}

View file

@ -148,7 +148,7 @@ ContactModel *ContactsListModel::addContact (VcardModel *vcardModel) {
if (mLinphoneFriends->addFriend(contact->mLinphoneFriend) != linphone::FriendList::Status::OK) {
qWarning() << QStringLiteral("Unable to add contact from vcard:") << vcardModel;
delete contact;
contact->deleteLater();
return nullptr;
}

View file

@ -186,8 +186,8 @@ void CoreManager::stateChanged(Qt::ApplicationState pState){
if(pState == Qt::ApplicationActive)
mCbsTimer->setInterval( Constants::CbsCallInterval);
else
mCbsTimer->setInterval( Constants::CbsCallInterval * 10);
}
mCbsTimer->setInterval( Constants::CbsCallInterval * 2);// Reduce a little processes
}
}
// -----------------------------------------------------------------------------

View file

@ -83,7 +83,7 @@ bool LdapListModel::removeRows (int row, int count, const QModelIndex &parent) {
beginRemoveRows(parent, row, limit);
for (int i = 0; i < count; ++i)
delete mServers.takeAt(row);
mServers.takeAt(row)->deleteLater();
endRemoveRows();

View file

@ -114,7 +114,7 @@ Notifier::~Notifier () {
const int nComponents = Notifications.size();
for (int i = 0; i < nComponents; ++i)
delete mComponents[i];
mComponents[i]->deleteLater();
delete[] mComponents;
}

View file

@ -66,6 +66,8 @@ void ParticipantImdnStateProxyModel::setChatMessageModel(ChatMessageModel * mess
ParticipantImdnStateListModel *model = static_cast<ParticipantImdnStateListModel*>(sourceModel());
ParticipantImdnStateListModel *messageModel = message->getParticipantImdnStates().get();
if( model != messageModel){
if(model)
disconnect(model, &ParticipantImdnStateListModel::countChanged, this, &ParticipantImdnStateProxyModel::countChanged);
setSourceModel(messageModel);
connect(messageModel, &ParticipantImdnStateListModel::countChanged, this, &ParticipantImdnStateProxyModel::countChanged);
sort(0);
@ -73,4 +75,4 @@ void ParticipantImdnStateProxyModel::setChatMessageModel(ChatMessageModel * mess
}
}
emit chatMessageModelChanged();
}
}

View file

@ -62,7 +62,17 @@ AccountSettingsModel::AccountSettingsModel (QObject *parent) : QObject(parent) {
coreManager->getHandlers().get(), &CoreHandlers::registrationStateChanged,
this, &AccountSettingsModel::handleRegistrationStateChanged
);
QObject::connect(coreManager, &CoreManager::eventCountChanged, this, [this]() { emit accountSettingsUpdated(); });
//QObject::connect(coreManager, &CoreManager::eventCountChanged, this, [this]() { emit accountSettingsUpdated(); });
QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::usernameChanged);
QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::sipAddressChanged);
QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::fullSipAddressChanged);
QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::registrationStateChanged);
QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::conferenceURIChanged);
QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::primaryDisplayNameChanged);
QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::primaryUsernameChanged);
QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::primarySipAddressChanged);
QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::accountsChanged);
}
// -----------------------------------------------------------------------------
@ -79,6 +89,7 @@ void AccountSettingsModel::setUsedSipAddress (const shared_ptr<const linphone::A
shared_ptr<linphone::ProxyConfig> proxyConfig = core->getDefaultProxyConfig();
proxyConfig ? proxyConfig->setIdentityAddress(address) : core->setPrimaryContact(address->asString());
emit sipAddressChanged();
}
QString AccountSettingsModel::getUsedSipAddressAsStringUriOnly () const {
@ -404,7 +415,7 @@ void AccountSettingsModel::setUsername (const QString &username) {
.arg(Utils::coreStringToAppString(newAddress->asStringUriOnly()));
} else {
setUsedSipAddress(newAddress);
emit accountSettingsUpdated();
emit usernameChanged();
}
}
}
@ -432,7 +443,7 @@ void AccountSettingsModel::setPrimaryUsername (const QString &username) {
username.isEmpty() ? APPLICATION_NAME : username
));
core->setPrimaryContact(primary->asString());
emit accountSettingsUpdated();
emit primaryUsernameChanged();
}
}
@ -448,7 +459,7 @@ void AccountSettingsModel::setPrimaryDisplayName (const QString &displayName) {
if(oldDisplayName != displayName){
primary->setDisplayName(Utils::appStringToCoreString(displayName));
core->setPrimaryContact(primary->asString());
emit accountSettingsUpdated();
emit primaryDisplayNameChanged();
}
}
@ -508,10 +519,10 @@ void AccountSettingsModel::handleRegistrationStateChanged (
mRemovingProxies.removeAll(proxy);
QTimer::singleShot(100, [proxy, this](){// removeProxyConfig cannot be called from callback
CoreManager::getInstance()->getCore()->removeProxyConfig(proxy);
emit accountSettingsUpdated();
emit accountsChanged();
});
}
if(defaultProxyConfig == proxy)
emit defaultRegistrationChanged();
emit accountSettingsUpdated();
emit registrationStateChanged();
}

View file

@ -34,19 +34,19 @@ class AccountSettingsModel : public QObject {
Q_OBJECT
// Selected proxy config.
Q_PROPERTY(QString username READ getUsername WRITE setUsername NOTIFY accountSettingsUpdated)
Q_PROPERTY(QString sipAddress READ getUsedSipAddressAsStringUriOnly NOTIFY accountSettingsUpdated)
Q_PROPERTY(QString fullSipAddress READ getUsedSipAddressAsString)
Q_PROPERTY(RegistrationState registrationState READ getRegistrationState NOTIFY accountSettingsUpdated)
Q_PROPERTY(QString username READ getUsername WRITE setUsername NOTIFY usernameChanged)
Q_PROPERTY(QString sipAddress READ getUsedSipAddressAsStringUriOnly NOTIFY sipAddressChanged)
Q_PROPERTY(QString fullSipAddress READ getUsedSipAddressAsString NOTIFY fullSipAddressChanged)
Q_PROPERTY(RegistrationState registrationState READ getRegistrationState NOTIFY registrationStateChanged)
Q_PROPERTY(QString conferenceURI READ getConferenceURI NOTIFY accountSettingsUpdated)
Q_PROPERTY(QString conferenceURI READ getConferenceURI NOTIFY conferenceURIChanged)
// Default info.
Q_PROPERTY(QString primaryDisplayName READ getPrimaryDisplayName WRITE setPrimaryDisplayName NOTIFY accountSettingsUpdated)
Q_PROPERTY(QString primaryUsername READ getPrimaryUsername WRITE setPrimaryUsername NOTIFY accountSettingsUpdated)
Q_PROPERTY(QString primarySipAddress READ getPrimarySipAddress NOTIFY accountSettingsUpdated)
Q_PROPERTY(QString primaryDisplayName READ getPrimaryDisplayName WRITE setPrimaryDisplayName NOTIFY primaryDisplayNameChanged)
Q_PROPERTY(QString primaryUsername READ getPrimaryUsername WRITE setPrimaryUsername NOTIFY primaryUsernameChanged)
Q_PROPERTY(QString primarySipAddress READ getPrimarySipAddress NOTIFY primarySipAddressChanged)
Q_PROPERTY(QVariantList accounts READ getAccounts NOTIFY accountSettingsUpdated)
Q_PROPERTY(QVariantList accounts READ getAccounts NOTIFY accountsChanged)
public:
enum RegistrationState {
@ -88,6 +88,21 @@ public:
Q_INVOKABLE void eraseAllPasswords ();
signals:
void usernameChanged();
void sipAddressChanged();
void fullSipAddressChanged();
void registrationStateChanged();
void conferenceURIChanged();
void primaryDisplayNameChanged();
void primaryUsernameChanged();
void primarySipAddressChanged();
void accountsChanged();
void accountSettingsUpdated ();
void defaultProxyChanged();
void publishPresenceChanged();

View file

@ -131,7 +131,8 @@ void TimelineModel::setSelected(const bool& selected){
<< ", canHandleParticipants:"<< mChatRoomModel->canHandleParticipants()
<< ", isReadOnly:" << mChatRoomModel->isReadOnly()
<< ", state:" << mChatRoomModel->getState();
}
}else
mChatRoomModel->resetEntries();// Cleanup leaving chat room
emit selectedChanged(mSelected);
}
}

View file

@ -67,9 +67,9 @@ void ChatRoomInitializer::setAdminsAsync(const std::string& subject, const linph
init->mAdmins = admins;
init->mSelf = init;
chatRoomEvent->addListener(init);
delete context;
context->deleteLater();
}else if( state > linphone::ChatRoom::State::Created){// The chat room could be completed. Delete the bind.
delete context;
context->deleteLater();
}
}
});

View file

@ -66,7 +66,7 @@ QPluginLoader * PluginsManager::getPlugin(const QString &pluginIdentity){
loader->unload();
}
}
delete loader;
loader->deleteLater();
}
}
return nullptr;
@ -93,7 +93,7 @@ void * PluginsManager::createInstance(const QString &pluginIdentity){
}else
loader->unload();
}
delete loader;
loader->deleteLater();
}
}
return dataInstance;
@ -111,7 +111,7 @@ QJsonDocument PluginsManager::getJson(const QString &pluginIdentity){
}
}
pluginLoader->unload();
delete pluginLoader;
pluginLoader->deleteLater();
}
return doc;
}

View file

@ -256,7 +256,6 @@ Item {
visible: !isCustom
}
OpacityMask{
anchors.fill: foregroundColor
source: foregroundColor
@ -264,7 +263,6 @@ Item {
visible: isCustom
}
OpacityMask{
id: mask
anchors.fill: foregroundHiddenPartColor
@ -273,6 +271,7 @@ Item {
visible: isCustom && percentageDisplayed != 100
}
MouseArea{
anchors.fill:parent
hoverEnabled: true

View file

@ -131,18 +131,25 @@ function openMediaParameters (window, incall) {
}
function showFullscreen (position) {
incall.isFullScreen = true
if (incall._fullscreen) {
incall._fullscreen.raise()
return
}
DesktopTools.DesktopTools.screenSaverStatus = false
incall._fullscreen = Utils.openWindow(Qt.resolvedUrl('IncallFullscreenWindow.qml'), window, {
properties: {
caller: incall,
x:position.x,
y:position.y,
width:window.width,
height:window.height
}
var parameters = {
caller: incall,
x:position.x,
y:position.y,
width:window.width,
height:window.height,
window:window
}
incall._fullscreen = Utils.openWindow(Qt.resolvedUrl('IncallFullscreenWindow.qml'), parameters.window, {
properties: parameters
}, true)
if(incall._fullscreen) {
incall._fullscreen.cameraIsReady = Qt.binding(function(){ return !incall.cameraIsReady})
incall._fullscreen.previewIsReady = Qt.binding(function(){ return !incall.previewIsReady})
}
}

View file

@ -21,15 +21,18 @@ Rectangle {
// ---------------------------------------------------------------------------
// Used by `IncallFullscreenWindow.qml`.
readonly property bool cameraActivated:
cameraLoader.status !== Loader.Null ||
cameraPreviewLoader.status !== Loader.Null
readonly property bool cameraActivated: cameraIsReady || previewIsReady
property bool cameraIsReady : false
property bool previewIsReady : false
property var call
property var _sipAddressObserver: SipAddressesModel.getSipAddressObserver(call.fullPeerAddress, call.fullLocalAddress)
property var _fullscreen: null
property bool isFullScreen: false // Use this variable to test if we are in fullscreen. Do not test _fullscreen : we need to clean memory before having the window (see .js file)
property var _fullscreen: null
on_FullscreenChanged: if( !_fullscreen) isFullScreen = false
// ---------------------------------------------------------------------------
color: CallStyle.backgroundColor
@ -246,7 +249,7 @@ Rectangle {
anchors.centerIn: parent
active: incall.call.videoEnabled && !_fullscreen
active: incall.call.videoEnabled && !isFullScreen
sourceComponent: camera
Component {
@ -256,14 +259,18 @@ Rectangle {
call: incall.call
height: container.height
width: container.width
Component.onDestruction: {
resetWindowId()
}
}
}
}
Loader {
anchors.centerIn: parent
active: !call.videoEnabled || _fullscreen
active: !call.videoEnabled || isFullScreen
sourceComponent: avatar
}
}
@ -388,7 +395,7 @@ Rectangle {
anchors.centerIn: parent
height: CallStyle.actionArea.userVideo.height
width: CallStyle.actionArea.userVideo.width
active: incall.width >= CallStyle.actionArea.lowWidth && incall.call.videoEnabled && !_fullscreen
active: incall.width >= CallStyle.actionArea.lowWidth && incall.call.videoEnabled && !isFullScreen
sourceComponent: cameraPreview
Component {
id: cameraPreview
@ -397,6 +404,9 @@ Rectangle {
anchors.fill: parent
call: incall.call
isPreview: true
Component.onDestruction: {
resetWindowId()
}
}
}
}

View file

@ -24,6 +24,8 @@ Window {
property var call
property var caller
property bool hideButtons: false
property bool cameraIsReady : false
property bool previewIsReady : false
// ---------------------------------------------------------------------------
@ -72,7 +74,7 @@ Window {
active: {
var caller = window.caller
return caller && !caller.cameraActivated
return window.cameraIsReady && caller && !caller.cameraActivated
}
sourceComponent: camera
@ -82,6 +84,9 @@ Window {
Camera {
call: window.call
Component.onDestruction: {
resetWindowId()
}
}
}
}
@ -430,7 +435,7 @@ Window {
Loader {
active: {
var caller = window.caller
return caller && !caller.cameraActivated
return window.previewIsReady && caller && !caller.cameraActivated
}
sourceComponent: cameraPreview
@ -457,6 +462,9 @@ Window {
call: window.call
isPreview: true
Component.onDestruction: {
resetWindowId()
}
height: Math.min(window.height, (CallFullscreenStyle.actionArea.userVideo.height * window.height/CallFullscreenStyle.actionArea.userVideo.heightReference) * scale)
width: Math.min(window.width, (CallFullscreenStyle.actionArea.userVideo.width * window.width/CallFullscreenStyle.actionArea.userVideo.widthReference) * scale )

View file

@ -554,7 +554,7 @@ ColumnLayout {
Connections {
target: AccountSettingsModel
onAccountSettingsUpdated: {
onSipAddressChanged: {
if (conversation.localAddress !== AccountSettingsModel.sipAddress) {
window.setView('Home')
}

@ -1 +1 @@
Subproject commit 340bc9a1a682cfb5feb4751280e1b94693ee0ce1
Subproject commit 00fd2d08b3cc24365aba7407c3885e11cc120024