diff --git a/Linphone/core/call/CallCore.cpp b/Linphone/core/call/CallCore.cpp index eaff051b..90285868 100644 --- a/Linphone/core/call/CallCore.cpp +++ b/Linphone/core/call/CallCore.cpp @@ -92,6 +92,7 @@ CallCore::CallCore(const std::shared_ptr &call) : QObject(nullpt } mMicrophoneVolume = call->getRecordVolume(); mRecordable = mState == LinphoneEnums::CallState::StreamsRunning; + mConferenceVideoLayout = mCallModel->getConferenceVideoLayout(); } CallCore::~CallCore() { @@ -220,7 +221,7 @@ void CallCore::setSelf(QSharedPointer me) { mCallModelConnection->makeConnectToModel(&CallModel::microphoneVolumeGainChanged, [this](float gain) { mCallModelConnection->invokeToCore([this, gain]() { setMicrophoneVolumeGain(gain); }); }); - mCallModelConnection->makeConnectToCore(&CallCore::lSetInputAudioDevice, [this](const QString &id) { + mCallModelConnection->makeConnectToCore(&CallCore::lSetInputAudioDevice, [this](QString id) { mCallModelConnection->invokeToModel([this, id]() { if (auto device = ToolModel::findAudioDevice(id)) { mCallModel->setInputAudioDevice(device); @@ -230,7 +231,7 @@ void CallCore::setSelf(QSharedPointer me) { mCallModelConnection->makeConnectToModel(&CallModel::inputAudioDeviceChanged, [this](const std::string &id) { mCallModelConnection->invokeToCore([this, id]() {}); }); - mCallModelConnection->makeConnectToCore(&CallCore::lSetOutputAudioDevice, [this](const QString &id) { + mCallModelConnection->makeConnectToCore(&CallCore::lSetOutputAudioDevice, [this](QString id) { mCallModelConnection->invokeToModel([this, id]() { if (auto device = ToolModel::findAudioDevice(id)) { mCallModel->setOutputAudioDevice(device); @@ -253,6 +254,14 @@ void CallCore::setSelf(QSharedPointer me) { mCallModelConnection->makeConnectToCore(&CallCore::lTerminateAllCalls, [this]() { mCallModelConnection->invokeToModel([this]() { mCallModel->terminateAllCalls(); }); }); + mCallModelConnection->makeConnectToModel( + &CallModel::conferenceVideoLayoutChanged, [this](LinphoneEnums::ConferenceLayout layout) { + mCallModelConnection->invokeToCore([this, layout]() { setConferenceVideoLayout(layout); }); + }); + mCallModelConnection->makeConnectToCore( + &CallCore::lSetConferenceVideoLayout, [this](LinphoneEnums::ConferenceLayout layout) { + mCallModelConnection->invokeToModel([this, layout]() { mCallModel->changeConferenceVideoLayout(layout); }); + }); } QString CallCore::getPeerAddress() const { @@ -509,6 +518,18 @@ void CallCore::setTransferState(LinphoneEnums::CallState state, const QString &m } } +LinphoneEnums::ConferenceLayout CallCore::getConferenceVideoLayout() const { + return mConferenceVideoLayout; +} + +void CallCore::setConferenceVideoLayout(LinphoneEnums::ConferenceLayout layout) { + mustBeInMainThread(log().arg(Q_FUNC_INFO)); + if (mConferenceVideoLayout != layout) { + mConferenceVideoLayout = layout; + emit conferenceVideoLayoutChanged(); + } +} + std::shared_ptr CallCore::getModel() const { return mCallModel; } diff --git a/Linphone/core/call/CallCore.hpp b/Linphone/core/call/CallCore.hpp index d39ddc62..d7d8fd17 100644 --- a/Linphone/core/call/CallCore.hpp +++ b/Linphone/core/call/CallCore.hpp @@ -61,6 +61,8 @@ class CallCore : public QObject, public AbstractObject { Q_PROPERTY(float microVolume READ getMicrophoneVolume WRITE setMicrophoneVolume NOTIFY microphoneVolumeChanged) Q_PROPERTY(LinphoneEnums::CallState transferState READ getTransferState NOTIFY transferStateChanged) Q_PROPERTY(ConferenceGui *conference READ getConferenceGui NOTIFY conferenceChanged) + Q_PROPERTY(LinphoneEnums::ConferenceLayout conferenceVideoLayout READ getConferenceVideoLayout WRITE + lSetConferenceVideoLayout NOTIFY conferenceVideoLayoutChanged) public: // Should be call from model Thread. Will be automatically in App thread after initialization @@ -141,6 +143,9 @@ public: LinphoneEnums::CallState getTransferState() const; void setTransferState(LinphoneEnums::CallState state, const QString &message); + LinphoneEnums::ConferenceLayout getConferenceVideoLayout() const; + void setConferenceVideoLayout(LinphoneEnums::ConferenceLayout layout); + std::shared_ptr getModel() const; signals: @@ -165,6 +170,7 @@ signals: void microphoneVolumeChanged(); void microphoneVolumeGainChanged(); void conferenceChanged(); + void conferenceVideoLayoutChanged(); // Linphone commands void lAccept(bool withVideo); // Accept an incoming call @@ -175,14 +181,15 @@ signals: void lSetMicrophoneMuted(bool isMuted); void lSetCameraEnabled(bool enabled); void lSetPaused(bool paused); - void lTransferCall(const QString &dest); + void lTransferCall(QString &est); void lStartRecording(); void lStopRecording(); void lVerifyAuthenticationToken(bool verified); void lSetSpeakerVolumeGain(float gain); void lSetMicrophoneVolumeGain(float gain); - void lSetInputAudioDevice(const QString &id); - void lSetOutputAudioDevice(const QString &id); + void lSetInputAudioDevice(QString id); + void lSetOutputAudioDevice(QString id); + void lSetConferenceVideoLayout(LinphoneEnums::ConferenceLayout layout); /* TODO Q_INVOKABLE void acceptWithVideo(); @@ -209,7 +216,9 @@ private: LinphoneEnums::CallState mState; LinphoneEnums::CallState mTransferState; LinphoneEnums::CallDir mDir; + LinphoneEnums::ConferenceLayout mConferenceVideoLayout; LinphoneEnums::MediaEncryption mEncryption; + QString mLastErrorMessage; QString mPeerAddress; bool mIsSecured; diff --git a/Linphone/model/call/CallModel.cpp b/Linphone/model/call/CallModel.cpp index 2d988ec4..1b087602 100644 --- a/Linphone/model/call/CallModel.cpp +++ b/Linphone/model/call/CallModel.cpp @@ -153,6 +153,7 @@ void CallModel::setRecordFile(const std::string &path) { } void CallModel::setSpeakerVolumeGain(float gain) { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mMonitor->setSpeakerVolumeGain(gain); emit speakerVolumeGainChanged(gain); } @@ -165,21 +166,25 @@ float CallModel::getSpeakerVolumeGain() const { } void CallModel::setMicrophoneVolumeGain(float gain) { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mMonitor->setMicrophoneVolumeGain(gain); emit microphoneVolumeGainChanged(gain); } float CallModel::getMicrophoneVolumeGain() const { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); auto gain = mMonitor->getMicrophoneVolumeGain(); return gain; } float CallModel::getMicrophoneVolume() const { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); auto volume = mMonitor->getRecordVolume(); return volume; } void CallModel::setInputAudioDevice(const std::shared_ptr &device) { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mMonitor->setInputAudioDevice(device); std::string deviceName; if (device) deviceName = device->getDeviceName(); @@ -187,10 +192,12 @@ void CallModel::setInputAudioDevice(const std::shared_ptr } std::shared_ptr CallModel::getInputAudioDevice() const { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); return mMonitor->getInputAudioDevice(); } void CallModel::setOutputAudioDevice(const std::shared_ptr &device) { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mMonitor->setOutputAudioDevice(device); std::string deviceName; if (device) deviceName = device->getDeviceName(); @@ -198,6 +205,7 @@ void CallModel::setOutputAudioDevice(const std::shared_ptr CallModel::getOutputAudioDevice() const { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); return mMonitor->getOutputAudioDevice(); } @@ -229,12 +237,53 @@ std::string CallModel::getAuthenticationToken() const { } void CallModel::setConference(const std::shared_ptr &conference) { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); if (mConference != conference) { mConference = conference; emit conferenceChanged(); } } +LinphoneEnums::ConferenceLayout CallModel::getConferenceVideoLayout() const { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + return LinphoneEnums::fromLinphone(mMonitor->getParams()->getConferenceVideoLayout()); +} + +void CallModel::changeConferenceVideoLayout(LinphoneEnums::ConferenceLayout layout) { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + auto coreManager = CoreModel::getInstance(); + + // if (layout == LinphoneEnums::ConferenceLayout::Grid) + // coreManager->getSettingsModel()->setCameraMode(coreManager->getSettingsModel()->getGridCameraMode()); + // else + // coreManager->getSettingsModel()->setCameraMode(coreManager->getSettingsModel()->getActiveSpeakerCameraMode()); + auto params = coreManager->getCore()->createCallParams(mMonitor); + params->setConferenceVideoLayout(LinphoneEnums::toLinphone(layout)); + params->enableVideo(layout != LinphoneEnums::ConferenceLayout::AudioOnly); + if (!params->videoEnabled() && params->screenSharingEnabled()) { + params->enableScreenSharing(false); // Deactivate screensharing if going to audio only. + } + mMonitor->update(params); +} + +void CallModel::updateConferenceVideoLayout() { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + auto callParams = mMonitor->getParams(); + // auto settings = CoreManager::getInstance()->getSettingsModel(); + auto newLayout = LinphoneEnums::fromLinphone(callParams->getConferenceVideoLayout()); + if (!callParams->videoEnabled()) newLayout = LinphoneEnums::ConferenceLayout::AudioOnly; + if (mConferenceVideoLayout != newLayout) { // && !getPausedByUser()) { // Only update if not in pause. + // if (mMonitor->getConference()) { + // if (callParams->getConferenceVideoLayout() == linphone::Conference::Layout::Grid) + // settings->setCameraMode(settings->getGridCameraMode()); + // else settings->setCameraMode(settings->getActiveSpeakerCameraMode()); + // } else settings->setCameraMode(settings->getCallCameraMode()); + qDebug() << "Changing layout from " << mConferenceVideoLayout << " into " << newLayout; + mConferenceVideoLayout = newLayout; + emit conferenceVideoLayoutChanged(mConferenceVideoLayout); + } +} + void CallModel::onDtmfReceived(const std::shared_ptr &call, int dtmf) { emit dtmfReceived(call, dtmf); } @@ -272,6 +321,7 @@ void CallModel::onStateChanged(const std::shared_ptr &call, emit remoteVideoEnabledChanged(params && params->videoEnabled()); emit cameraEnabledChanged(call->cameraEnabled()); setConference(call->getConference()); + updateConferenceVideoLayout(); } emit stateChanged(state, message); } diff --git a/Linphone/model/call/CallModel.hpp b/Linphone/model/call/CallModel.hpp index dd3e6835..08e309ba 100644 --- a/Linphone/model/call/CallModel.hpp +++ b/Linphone/model/call/CallModel.hpp @@ -23,6 +23,7 @@ #include "model/listener/Listener.hpp" #include "tool/AbstractObject.hpp" +#include "tool/LinphoneEnums.hpp" #include #include @@ -67,6 +68,10 @@ public: void setAuthenticationTokenVerified(bool verified); std::string getAuthenticationToken() const; + LinphoneEnums::ConferenceLayout getConferenceVideoLayout() const; + void changeConferenceVideoLayout(LinphoneEnums::ConferenceLayout layout); // Make a call request + void updateConferenceVideoLayout(); // Called from call state changed ater the new layout has been set. + signals: void microphoneMutedChanged(bool isMuted); void speakerMutedChanged(bool isMuted); @@ -82,11 +87,13 @@ signals: void inputAudioDeviceChanged(const std::string &id); void outputAudioDeviceChanged(const std::string &id); void conferenceChanged(); + void conferenceVideoLayoutChanged(LinphoneEnums::ConferenceLayout layout); private: QTimer mDurationTimer; QTimer mMicroVolumeTimer; std::shared_ptr mConference; + LinphoneEnums::ConferenceLayout mConferenceVideoLayout; DECLARE_ABSTRACT_OBJECT @@ -150,7 +157,7 @@ signals: void cameraNotWorking(const std::shared_ptr &call, const std::string &cameraName); void videoDisplayErrorOccurred(const std::shared_ptr &call, int errorCode); void audioDeviceChanged(const std::shared_ptr &call, - const std::shared_ptr &audioDevice); + const std::shared_ptr &audioDevice); void remoteRecording(const std::shared_ptr &call, bool recording); }; diff --git a/Linphone/view/App/CallsWindow.qml b/Linphone/view/App/CallsWindow.qml index 796d7307..00b1b4a5 100644 --- a/Linphone/view/App/CallsWindow.qml +++ b/Linphone/view/App/CallsWindow.qml @@ -20,6 +20,8 @@ Window { property ConferenceGui conference: call && call.core.conference || null onConferenceChanged: console.log ("CONFERENCE CHANGED", conference) + property var conferenceLayout: call && call.core.conferenceVideoLayout || undefined + property bool callTerminatedByUser: false onCallChanged: { @@ -47,13 +49,15 @@ Window { function changeLayout(layoutIndex) { if (layoutIndex == 0) { - console.log("TODO : set mosaic layout") + console.log("Set Grid layout") + call.core.lSetConferenceVideoLayout(LinphoneEnums.ConferenceLayout.Grid) } else if (layoutIndex == 1) { - console.log("TODO : set pip layout") + console.log("Set AS layout") + call.core.lSetConferenceVideoLayout(LinphoneEnums.ConferenceLayout.ActiveSpeaker) } else { - console.log("TODO : set audio layout") + console.log("Set audio-only layout") + call.core.lSetConferenceVideoLayout(LinphoneEnums.ConferenceLayout.AudioOnly) } - console.log("+ change settings default layout") } Connections { @@ -469,14 +473,19 @@ Window { ] RadioButton { id: radiobutton + checkOnClick: false color: DefaultStyle.main1_500_main indicatorSize: 20 * DefaultStyle.dp leftPadding: indicator.width + spacing spacing: 8 * DefaultStyle.dp - Component.onCompleted: { - console.log("TODO : set checked true if is current layout") - if (index == 0) checked = true - } + checkable: false // Qt Documentation is wrong: It is true by default. We don't want to change the checked state if the layout change is not effective. + checked: index == 0 + ? mainWindow.conferenceLayout === LinphoneEnums.ConferenceLayout.Grid + : index == 1 + ? mainWindow.conferenceLayout === LinphoneEnums.ConferenceLayout.ActiveSpeaker + : mainWindow.conferenceLayout === LinphoneEnums.ConferenceLayout.AudioOnly + onClicked: mainWindow.changeLayout(index) + contentItem: RowLayout { spacing: 5 * DefaultStyle.dp EffectImage { @@ -494,7 +503,6 @@ Window { Layout.fillWidth: true } } - onCheckedChanged: if (checked) mainWindow.changeLayout(index) } } } diff --git a/Linphone/view/CMakeLists.txt b/Linphone/view/CMakeLists.txt index 621d5bc6..fd400a5a 100644 --- a/Linphone/view/CMakeLists.txt +++ b/Linphone/view/CMakeLists.txt @@ -7,7 +7,7 @@ list(APPEND _LINPHONEAPP_QML_FILES view/Layout/Call/ActiveSpeakerLayout.qml view/Layout/Call/CallLayout.qml - #view/Layout/Call/GridLayout.qml + view/Layout/Call/GridLayout.qml view/Layout/Conference/IncallGrid.qml view/Layout/Contact/ContactLayout.qml diff --git a/Linphone/view/Item/NumericPad.qml b/Linphone/view/Item/NumericPad.qml index 8fba145c..c2f9d35f 100644 --- a/Linphone/view/Item/NumericPad.qml +++ b/Linphone/view/Item/NumericPad.qml @@ -1,6 +1,6 @@ import QtQuick 2.7 import QtQuick.Controls 2.2 as Control -import QtQuick.Layouts +import QtQuick.Layouts as Layout import QtQuick.Effects import Linphone @@ -59,16 +59,16 @@ Control.Popup { onClicked: mainItem.close() } } - contentItem: GridLayout { + contentItem: Layout.GridLayout { columns: 3 columnSpacing: 3 - Layout.fillWidth: true - Layout.fillHeight: true + Layout.Layout.fillWidth: true + Layout.Layout.fillHeight: true Repeater { model: 9 Button { id: numPadButton - Layout.alignment: Qt.AlignHCenter + Layout.Layout.alignment: Qt.AlignHCenter required property int index implicitWidth: 60 * DefaultStyle.dp implicitHeight: 60 * DefaultStyle.dp @@ -101,7 +101,7 @@ Control.Popup { ] Button { id: digitButton - Layout.alignment: Qt.AlignHCenter + Layout.Layout.alignment: Qt.AlignHCenter shadowEnabled: true implicitWidth: 60 * DefaultStyle.dp implicitHeight: 60 * DefaultStyle.dp @@ -146,7 +146,7 @@ Control.Popup { id: launchCallButton implicitWidth: 75 * DefaultStyle.dp implicitHeight: 55 * DefaultStyle.dp - Layout.alignment: Qt.AlignHCenter + Layout.Layout.alignment: Qt.AlignHCenter background: Rectangle { anchors.fill: parent color: DefaultStyle.success_500main @@ -163,7 +163,7 @@ Control.Popup { rightPadding: 5 * DefaultStyle.dp topPadding: 5 * DefaultStyle.dp bottomPadding: 5 * DefaultStyle.dp - Layout.alignment: Qt.AlignHCenter + Layout.Layout.alignment: Qt.AlignHCenter background: Item { visible: false } diff --git a/Linphone/view/Item/RadioButton.qml b/Linphone/view/Item/RadioButton.qml index 66a39da2..c49026b7 100644 --- a/Linphone/view/Item/RadioButton.qml +++ b/Linphone/view/Item/RadioButton.qml @@ -8,15 +8,16 @@ Control.RadioButton { property string title property string contentText property string imgUrl + property bool checkOnClick: true property color color - hoverEnabled: true property int indicatorSize: 16 * DefaultStyle.dp + //onClicked: if (checkOnClick && !mainItem.checked) mainItem.toggle() - MouseArea { - anchors.fill: parent - hoverEnabled: false - cursorShape: mainItem.hovered ? Qt.PointingHandCursor : Qt.ArrowCursor - onClicked: if (!mainItem.checked) mainItem.toggle() + MouseArea{ + anchors.fill:parent + hoverEnabled: true + acceptedButtons: Qt.NoButton + cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor } indicator: Rectangle { diff --git a/Linphone/view/Item/ZrtpTokenAuthenticationDialog.qml b/Linphone/view/Item/ZrtpTokenAuthenticationDialog.qml index 5a2d6cb1..f9aeafc5 100644 --- a/Linphone/view/Item/ZrtpTokenAuthenticationDialog.qml +++ b/Linphone/view/Item/ZrtpTokenAuthenticationDialog.qml @@ -1,5 +1,5 @@ import QtQuick -import QtQuick.Layouts +import QtQuick.Layouts as Layout import QtQuick.Effects import Linphone @@ -27,10 +27,10 @@ Dialog { onStatusChanged: if (status === CallModel.CallStatusEnded) close() } - buttons: ColumnLayout { + buttons: Layout.ColumnLayout { spacing: 15 * DefaultStyle.dp Button { - Layout.alignment: Qt.AlignHCenter + Layout.Layout.alignment: Qt.AlignHCenter background: Item{} contentItem: Text { text: qsTr("Skip") @@ -49,7 +49,7 @@ Dialog { text: qsTr("Letters doesn't match") color: DefaultStyle.danger_500main inversedColors: true - Layout.alignment: Qt.AlignHCenter + Layout.Layout.alignment: Qt.AlignHCenter width: 330 * DefaultStyle.dp onClicked: { if(mainItem.call) mainItem.call.core.lVerifyAuthenticationToken(false) @@ -58,14 +58,14 @@ Dialog { } } - content: ColumnLayout { + content: Layout.ColumnLayout { spacing: 32 * DefaultStyle.dp - Layout.alignment: Qt.AlignHCenter - ColumnLayout { + Layout.Layout.alignment: Qt.AlignHCenter + Layout.ColumnLayout { spacing: 10 * DefaultStyle.dp Text { - Layout.preferredWidth: 330 * DefaultStyle.dp - Layout.alignment: Qt.AlignHCenter + Layout.Layout.preferredWidth: 330 * DefaultStyle.dp + Layout.Layout.alignment: Qt.AlignHCenter text: qsTr("Vérifier l'appareil") horizontalAlignment: Text.AlignLeft @@ -76,8 +76,8 @@ Dialog { } Text { - Layout.preferredWidth: 330 * DefaultStyle.dp - Layout.alignment: Qt.AlignHCenter + Layout.Layout.preferredWidth: 330 * DefaultStyle.dp + Layout.Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignLeft //: 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. @@ -88,10 +88,10 @@ Dialog { } } - GridLayout { + Layout.GridLayout { id: securityGridView - // Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + // Layout.Layout.fillWidth: true + Layout.Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom rows: 2 columns: 2 rowSpacing: 32 * DefaultStyle.dp diff --git a/Linphone/view/Layout/Call/CallLayout.qml b/Linphone/view/Layout/Call/CallLayout.qml index b1862c15..a9f88b51 100644 --- a/Linphone/view/Layout/Call/CallLayout.qml +++ b/Linphone/view/Layout/Call/CallLayout.qml @@ -1,5 +1,5 @@ import QtQuick -import QtQuick.Layouts +import QtQuick.Layouts as Layout import QtQuick.Effects import QtQml.Models import QtQuick.Controls as Control @@ -16,6 +16,8 @@ Item { property CallGui call property bool callTerminatedByUser: false readonly property var callState: call && call.core.state || undefined + property var conferenceLayout: call && call.core.conferenceVideoLayout || undefined + onConferenceLayoutChanged:console.log("CallLayout change : " +conferenceLayout) onCallStateChanged: if (callState === LinphoneEnums.CallState.End) { callTerminatedText.visible = true }else if( callState === LinphoneEnums.CallState.Error) { @@ -36,33 +38,47 @@ Item { weight: 300 * DefaultStyle.dp } } - StackLayout { + Layout.StackLayout { id: centerLayout currentIndex: 0 anchors.fill: parent Loader{ id: callLayout - Layout.fillWidth: true - Layout.fillHeight: true - sourceComponent:ActiveSpeakerLayout{ - Layout.fillWidth: true - Layout.fillHeight: true - call: mainItem.call - } + Layout.Layout.fillWidth: true + Layout.Layout.fillHeight: true + sourceComponent: mainItem.conferenceLayout == LinphoneEnums.ConferenceLayout.ActiveSpeaker + ? activeSpeakerComponent + : gridComponent } - ColumnLayout { + Layout.ColumnLayout { id: userNotFoundLayout - Layout.preferredWidth: parent.width - Layout.preferredHeight: parent.height - Layout.alignment: Qt.AlignCenter + Layout.Layout.preferredWidth: parent.width + Layout.Layout.preferredHeight: parent.height + Layout.Layout.alignment: Qt.AlignCenter Text { text: qsTr(mainItem.call.core.lastErrorMessage) - Layout.alignment: Qt.AlignCenter + Layout.Layout.alignment: Qt.AlignCenter color: DefaultStyle.grey_0 font.pixelSize: 40 * DefaultStyle.dp } } } + Component{ + id: activeSpeakerComponent + ActiveSpeakerLayout{ + Layout.Layout.fillWidth: true + Layout.Layout.fillHeight: true + call: mainItem.call + } + } + Component{ + id: gridComponent + GridLayout{ + Layout.Layout.fillWidth: true + Layout.Layout.fillHeight: true + call: mainItem.call + } + } } // ColumnLayout { diff --git a/Linphone/view/Layout/Call/GridLayout.qml b/Linphone/view/Layout/Call/GridLayout.qml index 3b2cb19b..03c08270 100644 --- a/Linphone/view/Layout/Call/GridLayout.qml +++ b/Linphone/view/Layout/Call/GridLayout.qml @@ -1,27 +1,14 @@ -import QtQuick 2.7 -import QtQuick.Layouts 1.3 -import QtQml.Models 2.12 -import QtGraphicalEffects 1.12 +import QtQuick +import QtQuick.Layouts +import QtQml.Models -import Common 1.0 -import Common.Styles 1.0 -import Linphone 1.0 -import LinphoneEnums 1.0 - -import UtilsCpp 1.0 - -import App.Styles 1.0 - -import ConstantsCpp 1.0 -// Temp -import 'Incall.js' as Logic -import 'qrc:/ui/scripts/Utils/utils.js' as Utils +import Linphone // ============================================================================= Mosaic { id: grid - property alias callModel: participantDevices.callModel + property alias call: allDevices.currentCall property bool cameraEnabled: true property int participantCount: gridModel.count @@ -29,27 +16,41 @@ Mosaic { //onParticipantCountChanged: participantCount > ConstantsCpp.maxMosaicParticipants ? SettingsModel.setLimitedMosaicQuality() : SettingsModel.setHighMosaicQuality() delegateModel: DelegateModel{ id: gridModel - property ParticipantDeviceProxyModel participantDevices : ParticipantDeviceProxyModel { - id: participantDevices - showMe: true - } + property ParticipantDeviceProxy participantDevices : ParticipantDeviceProxy { + id: allDevices + qmlName: "G" + Component.onCompleted: console.log("Loaded : " +allDevices) + } model: participantDevices delegate: Item{ id: avatarCell - property ParticipantDeviceModel currentDevice: gridModel.participantDevices.getAt(index) + property ParticipantDeviceGui currentDevice: gridModel.participantDevices.getAt(index) onCurrentDeviceChanged: { if(index < 0) cameraView.enabled = false // this is a delegate destruction. We need to stop camera before Qt change its currentDevice (and then, let CameraView to delete wrong renderer) } height: grid.cellHeight - 10 width: grid.cellWidth - 10 - + Sticker { + id: cameraView + visible: mainItem.callState != LinphoneEnums.CallState.End && mainItem.callState != LinphoneEnums.CallState.Released + && modelData.core.address != activeSpeakerSticker.address + anchors.fill: parent + //height: visible ? 180 * DefaultStyle.dp : 0 + //width: 300 * DefaultStyle.dp + qmlName: 'G_'+index + + participantDevice: avatarCell.currentDevice + previewEnabled: index == 0 + Component.onCompleted: console.log(qmlName + " is " +modelData.core.address) + } + /* Sticker{ id: cameraView anchors.fill: parent cameraQmlName: 'G_'+index - callModel: index >= 0 ? participantDevices.callModel : null // do this before to prioritize changing call on remove + callModel: index >= 0 ? allDevices.callModel : null // do this before to prioritize changing call on remove deactivateCamera: index <0 || !grid.cameraEnabled || grid.callModel.pausedByUser currentDevice: gridModel.participantDevices.getAt(index) @@ -61,7 +62,7 @@ Mosaic { avatarBackgroundColor: IncallStyle.container.avatar.backgroundColor.color //onCloseRequested: participantDevices.showMe = false - } + }*/ } } } diff --git a/Linphone/view/Layout/Mosaic.qml b/Linphone/view/Layout/Mosaic.qml index 43e8958f..b77f854e 100644 --- a/Linphone/view/Layout/Mosaic.qml +++ b/Linphone/view/Layout/Mosaic.qml @@ -1,10 +1,8 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.0 -import QtQml.Models 2.12 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQml.Models -import Common 1.0 -import Common.Styles 1.0 // ============================================================================= ColumnLayout{ @@ -115,4 +113,4 @@ ColumnLayout{ onCountChanged: grid.updateLayout() } -} \ No newline at end of file +}