mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
friends presence
This commit is contained in:
parent
84950e70b5
commit
ac528fc05c
8 changed files with 171 additions and 131 deletions
|
|
@ -76,7 +76,6 @@ void CoreModel::start() {
|
|||
Utils::appStringToCoreString(Paths::getFactoryConfigFilePath()), nullptr);
|
||||
setMonitor(mCore);
|
||||
setPathsAfterCreation();
|
||||
mCore->enableFriendListSubscription(true);
|
||||
mCore->enableRecordAware(true);
|
||||
mCore->setVideoDisplayFilter("MSQOGL");
|
||||
mCore->usePreviewWindow(true);
|
||||
|
|
@ -92,6 +91,7 @@ void CoreModel::start() {
|
|||
config->setInt("video", "show_local", 0); // So : write ourself to turn off camera before starting the core.
|
||||
mCore->start();
|
||||
setPathAfterStart();
|
||||
mCore->enableFriendListSubscription(true);
|
||||
auto videoPolicy = mCore->getVideoActivationPolicy();
|
||||
videoPolicy->setAutomaticallyAccept(true);
|
||||
videoPolicy->setAutomaticallyInitiate(false);
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ signals:
|
|||
void familyNameChanged(const QString &name);
|
||||
void organizationChanged(const QString &orga);
|
||||
void jobChanged(const QString &job);
|
||||
void presenceReceived(LinphoneEnums::ConsolidatedPresence consolidatedPresence, QDateTime presenceTimestamp);
|
||||
|
||||
private:
|
||||
DECLARE_ABSTRACT_OBJECT
|
||||
|
|
@ -96,9 +97,6 @@ private:
|
|||
// LINPHONE
|
||||
//--------------------------------------------------------------------------------
|
||||
virtual void onPresenceReceived(const std::shared_ptr<linphone::Friend> &contact) override;
|
||||
|
||||
signals:
|
||||
void presenceReceived(LinphoneEnums::ConsolidatedPresence consolidatedPresence, QDateTime presenceTimestamp);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -77,18 +77,34 @@ ColumnLayout {
|
|||
// Layout.fillWidth: true
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: mainItem.contactName
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: mainItem.contactName
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
weight: 400 * DefaultStyle.dp
|
||||
capitalization: Font.Capitalize
|
||||
}
|
||||
}
|
||||
Text {
|
||||
id: contactAddress
|
||||
visible: mainItem.addressVisible
|
||||
text: mainItem.contactAddress
|
||||
property var mode : contact ? contact.core.consolidatedPresence : -1
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
visible: mainItem.addressVisible
|
||||
text: mode === LinphoneEnums.ConsolidatedPresence.Online
|
||||
? qsTr("En ligne")
|
||||
: mode === LinphoneEnums.ConsolidatedPresence.Busy
|
||||
? qsTr("Occupé")
|
||||
: mode === LinphoneEnums.ConsolidatedPresence.DoNotDisturb
|
||||
? qsTr("Ne pas déranger")
|
||||
: qsTr("Hors ligne")
|
||||
color: mode === LinphoneEnums.ConsolidatedPresence.Online
|
||||
? DefaultStyle.success_500main
|
||||
: mode === LinphoneEnums.ConsolidatedPresence.Busy
|
||||
? DefaultStyle.warning_600
|
||||
: mode === LinphoneEnums.ConsolidatedPresence.DoNotDisturb
|
||||
? DefaultStyle.danger_500main
|
||||
: DefaultStyle.main2_500main
|
||||
font {
|
||||
pixelSize: 12 * DefaultStyle.dp
|
||||
weight: 300 * DefaultStyle.dp
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ StackView {
|
|||
property string displayNameVal: displayNameObj ? displayNameObj.value : ""
|
||||
property bool haveAvatar: (account && account.core.pictureUri )
|
||||
|| (contact && contact.core.pictureUri)
|
||||
|
||||
|
||||
onHaveAvatarChanged: replace(haveAvatar ? avatar : initials, StackView.Immediate)
|
||||
|
||||
property bool secured: false
|
||||
|
|
@ -54,6 +54,38 @@ StackView {
|
|||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
visible: (account || contact) && (account
|
||||
? account.core.registrationState != LinphoneEnums.RegistrationState.Progress && account.core.registrationState != LinphoneEnums.RegistrationState.Refreshing
|
||||
: contact.core.consolidatedPresence != LinphoneEnums.ConsolidatedPresence.Offline)
|
||||
width: mainItem.width/4.5
|
||||
height: width
|
||||
radius: width / 2
|
||||
x: 2 * mainItem.width / 3
|
||||
y: 6 * mainItem.height / 7
|
||||
z: 1
|
||||
color: account
|
||||
? account.core.registrationState == LinphoneEnums.RegistrationState.Ok
|
||||
? DefaultStyle.success_500main
|
||||
: account.core.registrationState == LinphoneEnums.RegistrationState.Cleared || account.core.registrationState == LinphoneEnums.RegistrationState.None
|
||||
? DefaultStyle.warning_600
|
||||
: account.core.registrationState == LinphoneEnums.RegistrationState.Progress || account.core.registrationState == LinphoneEnums.RegistrationState.Refreshing
|
||||
? DefaultStyle.main2_500main
|
||||
: DefaultStyle.danger_500main
|
||||
: contact
|
||||
? contact.core.consolidatedPresence === LinphoneEnums.ConsolidatedPresence.Online
|
||||
? DefaultStyle.success_500main
|
||||
: contact.core.consolidatedPresence === LinphoneEnums.ConsolidatedPresence.Busy
|
||||
? DefaultStyle.warning_600
|
||||
: contact.core.consolidatedPresence === LinphoneEnums.ConsolidatedPresence.DoNotDisturb
|
||||
? DefaultStyle.danger_500main
|
||||
: DefaultStyle.main2_500main
|
||||
: "transparent"
|
||||
border {
|
||||
width: 2 * DefaultStyle.dp
|
||||
color: DefaultStyle.grey_0
|
||||
}
|
||||
}
|
||||
Component{
|
||||
id: initials
|
||||
Rectangle {
|
||||
|
|
|
|||
|
|
@ -84,81 +84,75 @@ ListView {
|
|||
text: itemDelegate.displayName
|
||||
font.pixelSize: 14 * DefaultStyle.dp
|
||||
font.capitalization: mainItem.displayNameCapitalization ? Font.Capitalize : Font.MixedCase
|
||||
}
|
||||
Item {
|
||||
maximumLineCount: 1
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
id: buttonsLayout
|
||||
z: 1
|
||||
height: parent.height
|
||||
children: mainItem.delegateButtons || []
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
z: 1
|
||||
height: parent.height
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 5 * DefaultStyle.dp
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
children: mainItem.delegateButtons || []
|
||||
}
|
||||
|
||||
PopupButton {
|
||||
id: friendPopup
|
||||
z: 1
|
||||
hoverEnabled: mainItem.hoverEnabled
|
||||
visible: mainItem.contactMenuVisible && (contactArea.containsMouse || hovered || popup.opened) && (!delegateButtons || delegateButtons.children.length === 0)
|
||||
popup.x: 0
|
||||
popup.padding: 10 * DefaultStyle.dp
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 5 * DefaultStyle.dp
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
popup.contentItem: ColumnLayout {
|
||||
Button {
|
||||
background: Item{}
|
||||
contentItem: RowLayout {
|
||||
Image {
|
||||
source: modelData.core.starred ? AppIcons.heartFill : AppIcons.heart
|
||||
fillMode: Image.PreserveAspectFit
|
||||
width: 24 * DefaultStyle.dp
|
||||
height: 24 * DefaultStyle.dp
|
||||
Layout.preferredWidth: 24 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 24 * DefaultStyle.dp
|
||||
}
|
||||
Text {
|
||||
text: modelData.core.starred ? qsTr("Enlever des favoris") : qsTr("Mettre en favori")
|
||||
color: DefaultStyle.main2_500main
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
weight: 400 * DefaultStyle.dp
|
||||
PopupButton {
|
||||
id: friendPopup
|
||||
z: 1
|
||||
hoverEnabled: mainItem.hoverEnabled
|
||||
visible: mainItem.contactMenuVisible && (contactArea.containsMouse || hovered || popup.opened) && (!delegateButtons || delegateButtons.children.length === 0)
|
||||
popup.x: 0
|
||||
popup.padding: 10 * DefaultStyle.dp
|
||||
Layout.rightMargin: 5 * DefaultStyle.dp
|
||||
popup.contentItem: ColumnLayout {
|
||||
Button {
|
||||
background: Item{}
|
||||
contentItem: RowLayout {
|
||||
Image {
|
||||
source: modelData.core.starred ? AppIcons.heartFill : AppIcons.heart
|
||||
fillMode: Image.PreserveAspectFit
|
||||
width: 24 * DefaultStyle.dp
|
||||
height: 24 * DefaultStyle.dp
|
||||
Layout.preferredWidth: 24 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 24 * DefaultStyle.dp
|
||||
}
|
||||
Text {
|
||||
text: modelData.core.starred ? qsTr("Enlever des favoris") : qsTr("Mettre en favori")
|
||||
color: DefaultStyle.main2_500main
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
weight: 400 * DefaultStyle.dp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
modelData.core.lSetStarred(!modelData.core.starred)
|
||||
friendPopup.close()
|
||||
}
|
||||
}
|
||||
Button {
|
||||
background: Item{}
|
||||
contentItem: RowLayout {
|
||||
EffectImage {
|
||||
source: AppIcons.trashCan
|
||||
width: 24 * DefaultStyle.dp
|
||||
height: 24 * DefaultStyle.dp
|
||||
Layout.preferredWidth: 24 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 24 * DefaultStyle.dp
|
||||
fillMode: Image.PreserveAspectFit
|
||||
colorizationColor: DefaultStyle.danger_500main
|
||||
onClicked: {
|
||||
modelData.core.lSetStarred(!modelData.core.starred)
|
||||
friendPopup.close()
|
||||
}
|
||||
Text {
|
||||
text: qsTr("Supprimer")
|
||||
color: DefaultStyle.danger_500main
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
weight: 400 * DefaultStyle.dp
|
||||
}
|
||||
Button {
|
||||
background: Item{}
|
||||
contentItem: RowLayout {
|
||||
EffectImage {
|
||||
source: AppIcons.trashCan
|
||||
width: 24 * DefaultStyle.dp
|
||||
height: 24 * DefaultStyle.dp
|
||||
Layout.preferredWidth: 24 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 24 * DefaultStyle.dp
|
||||
fillMode: Image.PreserveAspectFit
|
||||
colorizationColor: DefaultStyle.danger_500main
|
||||
}
|
||||
Text {
|
||||
text: qsTr("Supprimer")
|
||||
color: DefaultStyle.danger_500main
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
weight: 400 * DefaultStyle.dp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
mainItem.contactDeletionRequested(modelData)
|
||||
friendPopup.close()
|
||||
onClicked: {
|
||||
mainItem.contactDeletionRequested(modelData)
|
||||
friendPopup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -167,7 +161,7 @@ ListView {
|
|||
MouseArea {
|
||||
id: contactArea
|
||||
hoverEnabled: mainItem.hoverEnabled
|
||||
anchors.fill: initial.visible ? contactDelegate : parent
|
||||
anchors.fill: contactDelegate
|
||||
height: mainItem.height
|
||||
Rectangle {
|
||||
anchors.fill: contactArea
|
||||
|
|
|
|||
|
|
@ -190,10 +190,14 @@ Item {
|
|||
}
|
||||
Button {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
topPadding: 11 * DefaultStyle.dp
|
||||
bottomPadding: 11 * DefaultStyle.dp
|
||||
leftPadding: 20 * DefaultStyle.dp
|
||||
rightPadding: 20 * DefaultStyle.dp
|
||||
contentItem: RowLayout {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
EffectImage {
|
||||
colorizationColor: "red"// DefaultStyle.grey_0
|
||||
colorizationColor: DefaultStyle.grey_0
|
||||
source: mainItem.newItemIconSource
|
||||
width: 24 * DefaultStyle.dp
|
||||
height: 24 * DefaultStyle.dp
|
||||
|
|
|
|||
|
|
@ -194,58 +194,53 @@ AbstractMainPage {
|
|||
height: 45 * DefaultStyle.dp
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
ColumnLayout {
|
||||
Layout.fillHeight: true
|
||||
ColumnLayout {
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Text {
|
||||
id: friendAddress
|
||||
property var remoteAddress: modelData ? UtilsCpp.getDisplayName(modelData.core.remoteAddress) : null
|
||||
text: remoteAddress ? remoteAddress.value : ""
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
weight: 400 * DefaultStyle.dp
|
||||
}
|
||||
Layout.fillWidth: true
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
Text {
|
||||
id: friendAddress
|
||||
Layout.fillWidth: true
|
||||
maximumLineCount: 1
|
||||
property var remoteAddress: modelData ? UtilsCpp.getDisplayName(modelData.core.remoteAddress) : null
|
||||
text: remoteAddress ? remoteAddress.value : ""
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
weight: 400 * DefaultStyle.dp
|
||||
}
|
||||
RowLayout {
|
||||
spacing: 3 * DefaultStyle.dp
|
||||
Image {
|
||||
source: modelData.core.status === LinphoneEnums.CallStatus.Declined
|
||||
|| modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere
|
||||
|| modelData.core.status === LinphoneEnums.CallStatus.Aborted
|
||||
|| modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted
|
||||
? modelData.core.isOutgoing
|
||||
? AppIcons.outgoingCallRejected
|
||||
: AppIcons.incomingCallRejected
|
||||
: modelData.core.status === LinphoneEnums.CallStatus.Missed
|
||||
? modelData.core.isOutgoing
|
||||
? AppIcons.outgoingCallMissed
|
||||
: AppIcons.incomingCallMissed
|
||||
: modelData.core.isOutgoing
|
||||
? AppIcons.outgoingCall
|
||||
: AppIcons.incomingCall
|
||||
Layout.preferredWidth: 5 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 5 * DefaultStyle.dp
|
||||
sourceSize.width: 5 * DefaultStyle.dp
|
||||
sourceSize.height: 5 * DefaultStyle.dp
|
||||
RectangleTest{anchors.fill: parent}
|
||||
}
|
||||
Text {
|
||||
// text: modelData.core.date
|
||||
text: UtilsCpp.formatDateElapsedTime(modelData.core.date)
|
||||
font {
|
||||
pixelSize: 12 * DefaultStyle.dp
|
||||
weight: 300 * DefaultStyle.dp
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
spacing: 3 * DefaultStyle.dp
|
||||
Image {
|
||||
source: modelData.core.status === LinphoneEnums.CallStatus.Declined
|
||||
|| modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere
|
||||
|| modelData.core.status === LinphoneEnums.CallStatus.Aborted
|
||||
|| modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted
|
||||
? modelData.core.isOutgoing
|
||||
? AppIcons.outgoingCallRejected
|
||||
: AppIcons.incomingCallRejected
|
||||
: modelData.core.status === LinphoneEnums.CallStatus.Missed
|
||||
? modelData.core.isOutgoing
|
||||
? AppIcons.outgoingCallMissed
|
||||
: AppIcons.incomingCallMissed
|
||||
: modelData.core.isOutgoing
|
||||
? AppIcons.outgoingCall
|
||||
: AppIcons.incomingCall
|
||||
Layout.preferredWidth: 5 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 5 * DefaultStyle.dp
|
||||
sourceSize.width: 5 * DefaultStyle.dp
|
||||
sourceSize.height: 5 * DefaultStyle.dp
|
||||
}
|
||||
Text {
|
||||
// text: modelData.core.date
|
||||
text: UtilsCpp.formatDateElapsedTime(modelData.core.date)
|
||||
font {
|
||||
pixelSize: 12 * DefaultStyle.dp
|
||||
weight: 300 * DefaultStyle.dp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Item {
|
||||
// Layout.fillWidth: true
|
||||
// }
|
||||
Button {
|
||||
Layout.rightMargin: 5 * DefaultStyle.dp
|
||||
padding: 0
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ AbstractMainPage {
|
|||
id: mainItem
|
||||
noItemButtonText: qsTr("Ajouter un contact")
|
||||
emptyListText: qsTr("Aucun contact pour le moment")
|
||||
newItemIconSource: AppIcons.newCall
|
||||
newItemIconSource: AppIcons.plusCircle
|
||||
|
||||
// disable left panel contact list interaction while a contact is being edited
|
||||
property bool leftPanelEnabled: true
|
||||
|
|
@ -154,8 +154,8 @@ AbstractMainPage {
|
|||
Button {
|
||||
background: Item{}
|
||||
icon.source: favoriteList.visible ? AppIcons.upArrow : AppIcons.downArrow
|
||||
width: 24 * DefaultStyle.dp
|
||||
height: 24 * DefaultStyle.dp
|
||||
Layout.preferredWidth: 24 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 24 * DefaultStyle.dp
|
||||
onClicked: favoriteList.visible = !favoriteList.visible
|
||||
}
|
||||
}
|
||||
|
|
@ -190,6 +190,7 @@ AbstractMainPage {
|
|||
ColumnLayout {
|
||||
visible: contactList.count > 0
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Text {
|
||||
text: qsTr("All contacts")
|
||||
font {
|
||||
|
|
@ -201,11 +202,11 @@ AbstractMainPage {
|
|||
Layout.fillWidth: true
|
||||
}
|
||||
Button {
|
||||
background: Item{}
|
||||
icon.source: favoriteList.visible ? AppIcons.upArrow : AppIcons.downArrow
|
||||
width: 24 * DefaultStyle.dp
|
||||
height: 24 * DefaultStyle.dp
|
||||
onClicked: contactList.visible = !contactList.visible
|
||||
background: Item{}
|
||||
icon.source: contactList.visible ? AppIcons.upArrow : AppIcons.downArrow
|
||||
Layout.preferredWidth: 24 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 24 * DefaultStyle.dp
|
||||
onClicked: contactList.visible = !contactList.visible
|
||||
}
|
||||
}
|
||||
ContactsList{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue