change notif received call ui (add camera or audio accept)

This commit is contained in:
Gaelle Braud 2024-02-07 15:59:17 +01:00
parent 63f1328576
commit 9667aae47f
5 changed files with 88 additions and 20 deletions

View file

@ -39,10 +39,10 @@ AccountCore::AccountCore(const std::shared_ptr<linphone::Account> &account) : QO
mustBeInLinphoneThread(getClassName()); mustBeInLinphoneThread(getClassName());
// Init data // Init data
auto address = account->getContactAddress(); auto address = account->getContactAddress();
mContactAddress = address ? Utils::coreStringToAppString(account->getContactAddress()->asString()) : ""; mContactAddress = address ? Utils::coreStringToAppString(account->getContactAddress()->asStringUriOnly()) : "";
auto params = account->getParams(); auto params = account->getParams();
auto identityAddress = params->getIdentityAddress(); auto identityAddress = params->getIdentityAddress();
mIdentityAddress = identityAddress ? Utils::coreStringToAppString(identityAddress->asString()) : ""; mIdentityAddress = identityAddress ? Utils::coreStringToAppString(identityAddress->asStringUriOnly()) : "";
mPictureUri = Utils::coreStringToAppString(params->getPictureUri()); mPictureUri = Utils::coreStringToAppString(params->getPictureUri());
mRegistrationState = LinphoneEnums::fromLinphone(account->getState()); mRegistrationState = LinphoneEnums::fromLinphone(account->getState());
mIsDefaultAccount = CoreModel::getInstance()->getCore()->getDefaultAccount() == account; mIsDefaultAccount = CoreModel::getInstance()->getCore()->getDefaultAccount() == account;

View file

@ -47,7 +47,7 @@ CallCore::CallCore(const std::shared_ptr<linphone::Call> &call) : QObject(nullpt
mCameraEnabled = call->cameraEnabled(); mCameraEnabled = call->cameraEnabled();
mDuration = call->getDuration(); mDuration = call->getDuration();
mState = LinphoneEnums::fromLinphone(call->getState()); mState = LinphoneEnums::fromLinphone(call->getState());
mPeerAddress = Utils::coreStringToAppString(mCallModel->getRemoteAddress()->asString()); mPeerAddress = Utils::coreStringToAppString(mCallModel->getRemoteAddress()->asStringUriOnly());
mStatus = LinphoneEnums::fromLinphone(call->getCallLog()->getStatus()); mStatus = LinphoneEnums::fromLinphone(call->getCallLog()->getStatus());
mTransferState = LinphoneEnums::fromLinphone(call->getTransferState()); mTransferState = LinphoneEnums::fromLinphone(call->getTransferState());
mEncryption = LinphoneEnums::fromLinphone(call->getParams()->getMediaEncryption()); mEncryption = LinphoneEnums::fromLinphone(call->getParams()->getMediaEncryption());

View file

@ -93,8 +93,9 @@ void CallModel::setPaused(bool paused) {
void CallModel::transferTo(const std::shared_ptr<linphone::Address> &address) { void CallModel::transferTo(const std::shared_ptr<linphone::Address> &address) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
if (mMonitor->transferTo(address) == -1) if (mMonitor->transferTo(address) == -1)
qWarning() qWarning() << log()
<< log().arg(QStringLiteral("Unable to transfer: `%1`.")).arg(QString::fromStdString(address->asString())); .arg(QStringLiteral("Unable to transfer: `%1`."))
.arg(Utils::coreStringToAppString(address->asStringUriOnly()));
} }
void CallModel::terminateAllCalls() { void CallModel::terminateAllCalls() {

View file

@ -10,7 +10,8 @@ DesktopPopup {
property var notificationData: ({ property var notificationData: ({
timelineModel : null timelineModel : null
}) })
property int overrodeHeight property int overriddenHeight
property int overriddenWidth
default property alias _content: content.data default property alias _content: content.data
signal deleteNotification (var notification) signal deleteNotification (var notification)
@ -29,8 +30,8 @@ DesktopPopup {
Rectangle { Rectangle {
color: "#FFFFFF" color: "#FFFFFF"
height: overrodeHeight || 120 height: overriddenHeight || 120
width: 300 width: overriddenWidth || 300
border { border {
color: "#A1A1A1" color: "#A1A1A1"

View file

@ -5,39 +5,97 @@ import UtilsCpp
// ============================================================================= // =============================================================================
Notification { Notification {
id: notification id: mainItem
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
readonly property var call: notificationData && notificationData.call readonly property var call: notificationData && notificationData.call
property var state: call.core.state property var state: call.core.state
onStateChanged:{ onStateChanged:{
console.log("state notif", state) console.log("state notif", state, this)
if(state != LinphoneEnums.CallState.IncomingReceived){ if(state != LinphoneEnums.CallState.IncomingReceived){
close() close()
} }
} }
// overridenWidth: 320 * DefaultStyle.dp
// overridenHeight: 150 * DefaultStyle.dp
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 15 anchors.leftMargin: 15
anchors.rightMargin: 15 anchors.rightMargin: 15
anchors.bottomMargin:15 anchors.bottomMargin:15
spacing: 0 anchors.topMargin:15
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Action buttons. // 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 { RowLayout {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
Button { Layout.alignment: Qt.AlignHCenter
text: 'Accept' spacing: 10 * DefaultStyle.dp
Layout.rightMargin: 20 Item {
onClicked: { Layout.fillWidth: true
notification.call.core.lAccept(true) Layout.fillHeight: true
UtilsCpp.openCallsWindow(notification.call) }
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{ Item{
@ -45,10 +103,18 @@ Notification {
Layout.fillHeight: true Layout.fillHeight: true
} }
Button { Button {
text: 'Reject' color: DefaultStyle.danger_500main
Layout.rightMargin: 20 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: { onClicked: {
notification.call.core.lDecline() mainItem.call.core.lDecline()
} }
} }
} }