From c83212fbeb88fd8dc514064a09bac06908854d04 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Mon, 13 Dec 2021 00:27:14 +0100 Subject: [PATCH] Fixes, debug feedback, set duration, allow manual set on time, fix mosaic test mode --- .../src/components/call/CallModel.cpp | 5 ++- .../src/components/calls/CallsListModel.cpp | 2 +- .../conferenceInfo/ConferenceInfoModel.cpp | 9 +++- .../conferenceInfo/ConferenceInfoModel.hpp | 2 + .../src/components/core/CoreHandlers.cpp | 1 + .../ui/views/App/Calls/IncallAvatar.qml | 11 +++-- .../ui/views/App/Calls/VideoConference.qml | 41 +++++++++++++++---- .../ui/views/App/Main/Conferences.qml | 1 + .../views/App/Main/Dialogs/NewConference.qml | 17 +++++--- 9 files changed, 67 insertions(+), 22 deletions(-) diff --git a/linphone-app/src/components/call/CallModel.cpp b/linphone-app/src/components/call/CallModel.cpp index 297e18006..39263786c 100644 --- a/linphone-app/src/components/call/CallModel.cpp +++ b/linphone-app/src/components/call/CallModel.cpp @@ -679,7 +679,10 @@ void CallModel::setVideoEnabled (bool status) { case linphone::Call::State::Connected: case linphone::Call::State::StreamsRunning: break; - default: return; + default: { + qWarning() << "Cannot set Video mode because of call status : " << (int)mCall->getState() << " is not in {" <<(int)linphone::Call::State::Connected << ", " <<(int)linphone::Call::State::StreamsRunning << "}"; + return; + } } if (status == getVideoEnabled()) diff --git a/linphone-app/src/components/calls/CallsListModel.cpp b/linphone-app/src/components/calls/CallsListModel.cpp index feb9c4037..19fa4cccc 100644 --- a/linphone-app/src/components/calls/CallsListModel.cpp +++ b/linphone-app/src/components/calls/CallsListModel.cpp @@ -413,7 +413,7 @@ QVariantMap CallsListModel::createConference(ConferenceInfoModel * conferenceInf auto proxy = core->getDefaultProxyConfig(); params->setVideoEnabled(true); params->setStartTime(conferenceInfo->getConferenceInfo()->getDateTime()); - params->setEndTime(conferenceInfo->getConferenceInfo()->getDateTime()+conferenceInfo->getConferenceInfo()->getDuration()*60*1000); + params->setEndTime(conferenceInfo->getConferenceInfo()->getDateTime()+conferenceInfo->getConferenceInfo()->getDuration()*60); params->setLayout(linphone::ConferenceLayout::Grid); //params->setDescription(conferenceInfo->getConferenceInfo()->getDescription()); diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp index cf2933449..d5c3f76dd 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp @@ -109,7 +109,13 @@ QDateTime ConferenceInfoModel::getDateTime() const{ } int ConferenceInfoModel::getDuration() const{ - return mConferenceInfo->getDuration(); + int duration = mConferenceInfo->getDuration(); + qWarning() << "Duration: " << duration; + return duration; +} + +QDateTime ConferenceInfoModel::getEndDateTime() const{ + return getDateTime().addSecs(getDuration()*60); } QString ConferenceInfoModel::getOrganizer() const{ @@ -149,6 +155,7 @@ void ConferenceInfoModel::setDateTime(const QDateTime& dateTime){ } void ConferenceInfoModel::setDuration(const int& duration){ + qWarning() << "Set Duration: " << duration; mConferenceInfo->setDuration(duration); emit durationChanged(); } diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp index 9046dab2a..6cae02ad1 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp @@ -34,6 +34,7 @@ public: Q_PROPERTY(QDateTime dateTime READ getDateTime WRITE setDateTime NOTIFY dateTimeChanged) Q_PROPERTY(int duration READ getDuration WRITE setDuration NOTIFY durationChanged) + Q_PROPERTY(QDateTime endDateTime READ getEndDateTime NOTIFY dateTimeChanged) Q_PROPERTY(QString organizer READ getOrganizer WRITE setOrganizer NOTIFY organizerChanged) Q_PROPERTY(QString subject READ getSubject WRITE setSubject NOTIFY subjectChanged) Q_PROPERTY(QString description READ getDescription WRITE setDescription NOTIFY descriptionChanged) @@ -52,6 +53,7 @@ public: QDateTime getDateTime() const; int getDuration() const; + QDateTime getEndDateTime() const; QString getOrganizer() const; QString getSubject() const; QString getDescription() const; diff --git a/linphone-app/src/components/core/CoreHandlers.cpp b/linphone-app/src/components/core/CoreHandlers.cpp index d396ed137..9422428ec 100644 --- a/linphone-app/src/components/core/CoreHandlers.cpp +++ b/linphone-app/src/components/core/CoreHandlers.cpp @@ -328,6 +328,7 @@ void CoreHandlers::onEcCalibrationResult( void CoreHandlers::onConferenceInfoCreated(const std::shared_ptr & core, const std::shared_ptr & conferenceInfo){ qWarning() << "onConferenceInfoCreated : sending invitation only for known participants (API fail? this should be done from SDK)"; + qWarning() << "onConferenceInfoCreated : Duration: " << conferenceInfo->getDuration(); for(auto participant : conferenceInfo->getParticipants()){ std::shared_ptr params = core->createDefaultChatRoomParams(); diff --git a/linphone-app/ui/views/App/Calls/IncallAvatar.qml b/linphone-app/ui/views/App/Calls/IncallAvatar.qml index 5fc3ce50e..b666e4407 100644 --- a/linphone-app/ui/views/App/Calls/IncallAvatar.qml +++ b/linphone-app/ui/views/App/Calls/IncallAvatar.qml @@ -14,7 +14,7 @@ Avatar { property var participantDeviceModel readonly property var _sipAddressObserver: call ? SipAddressesModel.getSipAddressObserver(call.fullPeerAddress, call.fullLocalAddress) - : SipAddressesModel.getSipAddressObserver(participantdeviceModel.address, '') + : SipAddressesModel.getSipAddressObserver(participantDeviceModel.address, '') readonly property var _username: UtilsCpp.getDisplayName(_sipAddressObserver.peerAddress) backgroundColor: CallStyle.container.avatar.backgroundColor @@ -23,11 +23,14 @@ Avatar { : 'transparent' image: { - var contact = _sipAddressObserver.contact - return contact && contact.vcard.avatar + if (_sipAddressObserver) { + var contact = _sipAddressObserver.contact + return contact && contact.vcard.avatar + }else + return null; } - username: call && call.status === CallModel.CallStatusPaused ? '' : _username + username: call && call.status === CallModel.CallStatusPaused || !_username? '' : _username Text { anchors.fill: parent diff --git a/linphone-app/ui/views/App/Calls/VideoConference.qml b/linphone-app/ui/views/App/Calls/VideoConference.qml index e136575ee..c452267e0 100644 --- a/linphone-app/ui/views/App/Calls/VideoConference.qml +++ b/linphone-app/ui/views/App/Calls/VideoConference.qml @@ -11,6 +11,10 @@ import UtilsCpp 1.0 import App.Styles 1.0 + +// Temp +import 'Incall.js' as Logic + // ============================================================================= Rectangle { @@ -18,15 +22,19 @@ Rectangle { property CallModel callModel + onCallModelChanged: if(callModel) { + grid.setParticipantDevicesMode() + }else + grid.setTestMode() // --------------------------------------------------------------------------- color: VideoConferenceStyle.backgroundColor Component.onCompleted: { - for(var i = 0 ; i < 5 ; ++i) - grid.add({color: '#'+ Math.floor(Math.random()*255).toString(16) - +Math.floor(Math.random()*255).toString(16) - +Math.floor(Math.random()*255).toString(16)}) + if(!callModel){ + grid.setTestMode() + }else + grid.setParticipantDevicesMode() } // --------------------------------------------------------------------------- @@ -113,6 +121,20 @@ Rectangle { anchors.fill: parent property int radius : 8 + function setTestMode(){ + grid.clear() + gridModel.model = gridModel.defaultList + for(var i = 0 ; i < 5 ; ++i) + grid.add({color: '#'+ Math.floor(Math.random()*255).toString(16) + +Math.floor(Math.random()*255).toString(16) + +Math.floor(Math.random()*255).toString(16)}) + console.log("Setting test mode : count=" + gridModel.defaultList.count) + } + function setParticipantDevicesMode(){ + console.log("Setting participant mode : count=" + gridModel.participantDevices.count) + grid.clear() + gridModel.model = gridModel.participantDevices + } delegateModel: DelegateModel{ id: gridModel @@ -131,7 +153,7 @@ Rectangle { delegate: Rectangle{ - color: gridModel.defaultList.get(index).color ? gridModel.defaultList.get(index).color : '' + color: !conference.callModel && gridModel.defaultList.get(index).color ? gridModel.defaultList.get(index).color : '' //color: gridModel.model.get(index) && gridModel.model.get(index).color ? gridModel.model.get(index).color : '' // modelIndex is a custom index because by Mosaic modelisation, it is not accessible. //color: modelData.color ? modelData.color : '' radius: grid.radius @@ -165,7 +187,8 @@ Rectangle { active: conference.callModel && (gridModel.participantDevices.getAt(index).videoEnabled && !_fullscreen) - sourceComponent: gridModel.participantDevices.getAt(index).isMe ? cameraPreview : camera + sourceComponent: conference.callModel ? gridModel.participantDevices.getAt(index).isMe ? cameraPreview : camera + : null Component { id: camera @@ -321,9 +344,9 @@ Rectangle { id: camera isCustom: true backgroundRadius: 90 - colorSet: conference.callModel.videoEnabled ? VideoConferenceStyle.buttons.cameraOn : VideoConferenceStyle.buttons.cameraOff - updating: conference.callModel.videoEnabled && conference.callModel.updating - onClicked: conference.callModel.videoEnabled = !conference.callModel.videoEnabled + colorSet: conference.callModel && conference.callModel.videoEnabled ? VideoConferenceStyle.buttons.cameraOn : VideoConferenceStyle.buttons.cameraOff + //updating: conference.callModel.videoEnabled && conference.callModel.updating + onClicked: if(conference.callModel) conference.callModel.videoEnabled = !conference.callModel.videoEnabled } } RowLayout{ diff --git a/linphone-app/ui/views/App/Main/Conferences.qml b/linphone-app/ui/views/App/Main/Conferences.qml index f5e5e37e0..4c32dced7 100644 --- a/linphone-app/ui/views/App/Main/Conferences.qml +++ b/linphone-app/ui/views/App/Main/Conferences.qml @@ -189,6 +189,7 @@ ColumnLayout { elide: Text.ElideRight font.pointSize: ConferencesStyle.conference.schedule.pointSize text: Qt.formatDateTime(modelData.dateTime, 'yyyy/MM/dd hh:mm') + +', end at: ' +Qt.formatDateTime(modelData.endDateTime, 'yyyy/MM/dd hh:mm') } } Text{ diff --git a/linphone-app/ui/views/App/Main/Dialogs/NewConference.qml b/linphone-app/ui/views/App/Main/Dialogs/NewConference.qml index 9a2070996..8cc1b228d 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/NewConference.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/NewConference.qml @@ -87,7 +87,7 @@ DialogPlus { onClicked: exit(0) }, TextButtonB { - //enabled: selectedParticipants.count >= conferenceManager.minParticipants && subject.text != '' && AccountSettingsModel.conferenceURI != '' + enabled: selectedParticipants.count >= conferenceManager.minParticipants && subject.text != '' && AccountSettingsModel.conferenceURI != '' //: 'Launch' : Start button text: qsTr('startButton') capitalization: Font.AllUppercase @@ -100,13 +100,15 @@ DialogPlus { onClicked: { if( scheduledSwitch.checked){ var startDateTime = new Date() - startDateTime.setDate(Date.fromLocaleDateString(locale, dateField.text, Locale.ShortFormat)) - startDateTime.setTime( Date.fromLocaleTimeString(locale, timeField.text, Locale.ShortFormat)) + startDateTime.setDate(dateField.getDate()) + startDateTime.setTime(timeField.getTime()) conferenceInfoModel.dateTime = startDateTime + conferenceInfoModel.duration = durationField.text } conferenceInfoModel.subject = subject.text conferenceInfoModel.description = description.text + conferenceInfoModel.setParticipants(selectedParticipants.participantListModel) var callsWindow = App.getCallsWindow() App.smartShowWindow(callsWindow) @@ -265,7 +267,10 @@ DialogPlus { text = date.toLocaleTimeString(scheduleForm.locale, 'hh:mm') } MouseArea{ - anchors.fill: parent + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: parent.right + width: parent.width-50 onClicked: { if( rightStackView.currentItemType === 2) { rightStackView.currentItemType = 0 @@ -279,7 +284,7 @@ DialogPlus { } } } - NumericField{ text: '1200'; readOnly: true; Layout.preferredWidth: parent.cellWidth} + NumericField{id: durationField; text: '1200'; Layout.preferredWidth: parent.cellWidth} TextField{ text: 'Paris'; readOnly: true; Layout.preferredWidth: parent.cellWidth} function updateDateTime(){ var storedDate = new Date() @@ -289,7 +294,7 @@ DialogPlus { } var currentDate = new Date() if(currentDate >= storedDate){ - var nextStoredDate = UtilsCpp.addMinutes(new Date(), 5) + var nextStoredDate = UtilsCpp.addMinutes(new Date(), 1) dateField.setDate(nextStoredDate) timeField.setTime(nextStoredDate) }