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());
// 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;

View file

@ -47,7 +47,7 @@ CallCore::CallCore(const std::shared_ptr<linphone::Call> &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());

View file

@ -93,8 +93,9 @@ void CallModel::setPaused(bool paused) {
void CallModel::transferTo(const std::shared_ptr<linphone::Address> &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() {

View file

@ -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"

View file

@ -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()
}
}
}