From 9667aae47f7f3d5da211082aa1421d8d491e1b24 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Wed, 7 Feb 2024 15:59:17 +0100 Subject: [PATCH] change notif received call ui (add camera or audio accept) --- Linphone/core/account/AccountCore.cpp | 4 +- Linphone/core/call/CallCore.cpp | 2 +- Linphone/model/call/CallModel.cpp | 5 +- .../view/Item/Notification/Notification.qml | 7 +- .../Notification/NotificationReceivedCall.qml | 90 ++++++++++++++++--- 5 files changed, 88 insertions(+), 20 deletions(-) diff --git a/Linphone/core/account/AccountCore.cpp b/Linphone/core/account/AccountCore.cpp index 7345b9c81..f423e3d91 100644 --- a/Linphone/core/account/AccountCore.cpp +++ b/Linphone/core/account/AccountCore.cpp @@ -39,10 +39,10 @@ AccountCore::AccountCore(const std::shared_ptr &account) : QO mustBeInLinphoneThread(getClassName()); // Init data auto address = account->getContactAddress(); - mContactAddress = address ? Utils::coreStringToAppString(account->getContactAddress()->asString()) : ""; + mContactAddress = address ? Utils::coreStringToAppString(account->getContactAddress()->asStringUriOnly()) : ""; auto params = account->getParams(); auto identityAddress = params->getIdentityAddress(); - mIdentityAddress = identityAddress ? Utils::coreStringToAppString(identityAddress->asString()) : ""; + mIdentityAddress = identityAddress ? Utils::coreStringToAppString(identityAddress->asStringUriOnly()) : ""; mPictureUri = Utils::coreStringToAppString(params->getPictureUri()); mRegistrationState = LinphoneEnums::fromLinphone(account->getState()); mIsDefaultAccount = CoreModel::getInstance()->getCore()->getDefaultAccount() == account; diff --git a/Linphone/core/call/CallCore.cpp b/Linphone/core/call/CallCore.cpp index d8d5fe56e..2d4f325cb 100644 --- a/Linphone/core/call/CallCore.cpp +++ b/Linphone/core/call/CallCore.cpp @@ -47,7 +47,7 @@ CallCore::CallCore(const std::shared_ptr &call) : QObject(nullpt mCameraEnabled = call->cameraEnabled(); mDuration = call->getDuration(); mState = LinphoneEnums::fromLinphone(call->getState()); - mPeerAddress = Utils::coreStringToAppString(mCallModel->getRemoteAddress()->asString()); + mPeerAddress = Utils::coreStringToAppString(mCallModel->getRemoteAddress()->asStringUriOnly()); mStatus = LinphoneEnums::fromLinphone(call->getCallLog()->getStatus()); mTransferState = LinphoneEnums::fromLinphone(call->getTransferState()); mEncryption = LinphoneEnums::fromLinphone(call->getParams()->getMediaEncryption()); diff --git a/Linphone/model/call/CallModel.cpp b/Linphone/model/call/CallModel.cpp index f2a1de45d..aec8e6af6 100644 --- a/Linphone/model/call/CallModel.cpp +++ b/Linphone/model/call/CallModel.cpp @@ -93,8 +93,9 @@ void CallModel::setPaused(bool paused) { void CallModel::transferTo(const std::shared_ptr &address) { mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); if (mMonitor->transferTo(address) == -1) - qWarning() - << log().arg(QStringLiteral("Unable to transfer: `%1`.")).arg(QString::fromStdString(address->asString())); + qWarning() << log() + .arg(QStringLiteral("Unable to transfer: `%1`.")) + .arg(Utils::coreStringToAppString(address->asStringUriOnly())); } void CallModel::terminateAllCalls() { diff --git a/Linphone/view/Item/Notification/Notification.qml b/Linphone/view/Item/Notification/Notification.qml index cf4fcb708..671314963 100644 --- a/Linphone/view/Item/Notification/Notification.qml +++ b/Linphone/view/Item/Notification/Notification.qml @@ -10,7 +10,8 @@ DesktopPopup { property var notificationData: ({ timelineModel : null }) - property int overrodeHeight + property int overriddenHeight + property int overriddenWidth default property alias _content: content.data signal deleteNotification (var notification) @@ -29,8 +30,8 @@ DesktopPopup { Rectangle { color: "#FFFFFF" - height: overrodeHeight || 120 - width: 300 + height: overriddenHeight || 120 + width: overriddenWidth || 300 border { color: "#A1A1A1" diff --git a/Linphone/view/Item/Notification/NotificationReceivedCall.qml b/Linphone/view/Item/Notification/NotificationReceivedCall.qml index a50166f77..61e6a1da0 100644 --- a/Linphone/view/Item/Notification/NotificationReceivedCall.qml +++ b/Linphone/view/Item/Notification/NotificationReceivedCall.qml @@ -5,39 +5,97 @@ import UtilsCpp // ============================================================================= Notification { - id: notification + id: mainItem // --------------------------------------------------------------------------- readonly property var call: notificationData && notificationData.call property var state: call.core.state onStateChanged:{ - console.log("state notif", state) + console.log("state notif", state, this) if(state != LinphoneEnums.CallState.IncomingReceived){ close() } } + // overridenWidth: 320 * DefaultStyle.dp + // overridenHeight: 150 * DefaultStyle.dp // --------------------------------------------------------------------------- ColumnLayout { anchors.fill: parent anchors.leftMargin: 15 anchors.rightMargin: 15 anchors.bottomMargin:15 - spacing: 0 + anchors.topMargin:15 // --------------------------------------------------------------------- // Action buttons. // --------------------------------------------------------------------- + RowLayout { + Layout.fillWidth: true + Layout.alignment: Qt.AlignLeft + spacing: 15 * DefaultStyle.dp + Avatar { + Layout.preferredWidth: 40 * DefaultStyle.dp + Layout.preferredHeight: 40 * DefaultStyle.dp + call: mainItem.call + } + ColumnLayout { + Text { + property var remoteAddress: UtilsCpp.getDisplayName(call.core.peerAddress) + text: remoteAddress ? remoteAddress.value : "" + font { + pixelSize: 14 * DefaultStyle.dp + weight: 700 * DefaultStyle.dp + } + } + Text { + text: call.core.peerAddress + } + } + } + RowLayout { Layout.fillHeight: true Layout.fillWidth: true - Button { - text: 'Accept' - Layout.rightMargin: 20 - onClicked: { - notification.call.core.lAccept(true) - UtilsCpp.openCallsWindow(notification.call) + Layout.alignment: Qt.AlignHCenter + spacing: 10 * DefaultStyle.dp + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + RowLayout { + Layout.alignment: Qt.AlignHCenter + spacing: 3 * DefaultStyle.dp + Button { + color: DefaultStyle.success_500main + Layout.preferredWidth: 40 * DefaultStyle.dp + Layout.preferredHeight: 40 * DefaultStyle.dp + contentItem: EffectImage { + colorizationColor: DefaultStyle.grey_0 + source: AppIcons.phone + imageWidth: 24 * DefaultStyle.dp + imageHeight: 24 * DefaultStyle.dp + } + onClicked: { + mainItem.call.core.lAccept(false) + UtilsCpp.openCallsWindow(mainItem.call) + } + } + Button { + color: DefaultStyle.success_500main + Layout.preferredWidth: 40 * DefaultStyle.dp + Layout.preferredHeight: 40 * DefaultStyle.dp + contentItem: EffectImage { + colorizationColor: DefaultStyle.grey_0 + source: AppIcons.videoCamera + imageWidth: 24 * DefaultStyle.dp + imageHeight: 24 * DefaultStyle.dp + } + onClicked: { + mainItem.call.core.lAccept(true) + UtilsCpp.openCallsWindow(mainItem.call) + } } } Item{ @@ -45,10 +103,18 @@ Notification { Layout.fillHeight: true } Button { - text: 'Reject' - Layout.rightMargin: 20 + color: DefaultStyle.danger_500main + Layout.rightMargin: 20 * DefaultStyle.dp + Layout.preferredWidth: 55 * DefaultStyle.dp + Layout.preferredHeight: 40 * DefaultStyle.dp + contentItem: EffectImage { + colorizationColor: DefaultStyle.grey_0 + source: AppIcons.endCall + imageWidth: 24 * DefaultStyle.dp + imageHeight: 24 * DefaultStyle.dp + } onClicked: { - notification.call.core.lDecline() + mainItem.call.core.lDecline() } } }