friends presence

This commit is contained in:
Gaelle Braud 2024-01-31 10:45:32 +01:00
parent 84950e70b5
commit ac528fc05c
8 changed files with 171 additions and 131 deletions

View file

@ -76,7 +76,6 @@ void CoreModel::start() {
Utils::appStringToCoreString(Paths::getFactoryConfigFilePath()), nullptr); Utils::appStringToCoreString(Paths::getFactoryConfigFilePath()), nullptr);
setMonitor(mCore); setMonitor(mCore);
setPathsAfterCreation(); setPathsAfterCreation();
mCore->enableFriendListSubscription(true);
mCore->enableRecordAware(true); mCore->enableRecordAware(true);
mCore->setVideoDisplayFilter("MSQOGL"); mCore->setVideoDisplayFilter("MSQOGL");
mCore->usePreviewWindow(true); 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. config->setInt("video", "show_local", 0); // So : write ourself to turn off camera before starting the core.
mCore->start(); mCore->start();
setPathAfterStart(); setPathAfterStart();
mCore->enableFriendListSubscription(true);
auto videoPolicy = mCore->getVideoActivationPolicy(); auto videoPolicy = mCore->getVideoActivationPolicy();
videoPolicy->setAutomaticallyAccept(true); videoPolicy->setAutomaticallyAccept(true);
videoPolicy->setAutomaticallyInitiate(false); videoPolicy->setAutomaticallyInitiate(false);

View file

@ -88,6 +88,7 @@ signals:
void familyNameChanged(const QString &name); void familyNameChanged(const QString &name);
void organizationChanged(const QString &orga); void organizationChanged(const QString &orga);
void jobChanged(const QString &job); void jobChanged(const QString &job);
void presenceReceived(LinphoneEnums::ConsolidatedPresence consolidatedPresence, QDateTime presenceTimestamp);
private: private:
DECLARE_ABSTRACT_OBJECT DECLARE_ABSTRACT_OBJECT
@ -96,9 +97,6 @@ private:
// LINPHONE // LINPHONE
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
virtual void onPresenceReceived(const std::shared_ptr<linphone::Friend> &contact) override; virtual void onPresenceReceived(const std::shared_ptr<linphone::Friend> &contact) override;
signals:
void presenceReceived(LinphoneEnums::ConsolidatedPresence consolidatedPresence, QDateTime presenceTimestamp);
}; };
#endif #endif

View file

@ -77,18 +77,34 @@ ColumnLayout {
// Layout.fillWidth: true // Layout.fillWidth: true
Text { Text {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: mainItem.contactName
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: mainItem.contactName
font { font {
pixelSize: 14 * DefaultStyle.dp pixelSize: 14 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp weight: 400 * DefaultStyle.dp
capitalization: Font.Capitalize
} }
} }
Text { Text {
id: contactAddress id: contactAddress
visible: mainItem.addressVisible property var mode : contact ? contact.core.consolidatedPresence : -1
text: mainItem.contactAddress Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.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 { font {
pixelSize: 12 * DefaultStyle.dp pixelSize: 12 * DefaultStyle.dp
weight: 300 * DefaultStyle.dp weight: 300 * DefaultStyle.dp

View file

@ -54,6 +54,38 @@ StackView {
anchors.bottom: parent.bottom 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{ Component{
id: initials id: initials
Rectangle { Rectangle {

View file

@ -84,18 +84,13 @@ ListView {
text: itemDelegate.displayName text: itemDelegate.displayName
font.pixelSize: 14 * DefaultStyle.dp font.pixelSize: 14 * DefaultStyle.dp
font.capitalization: mainItem.displayNameCapitalization ? Font.Capitalize : Font.MixedCase font.capitalization: mainItem.displayNameCapitalization ? Font.Capitalize : Font.MixedCase
} maximumLineCount: 1
Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
}
RowLayout { RowLayout {
id: buttonsLayout
z: 1 z: 1
height: parent.height height: parent.height
anchors.right: parent.right
anchors.rightMargin: 5 * DefaultStyle.dp
anchors.verticalCenter: parent.verticalCenter
children: mainItem.delegateButtons || [] children: mainItem.delegateButtons || []
} }
@ -106,9 +101,7 @@ ListView {
visible: mainItem.contactMenuVisible && (contactArea.containsMouse || hovered || popup.opened) && (!delegateButtons || delegateButtons.children.length === 0) visible: mainItem.contactMenuVisible && (contactArea.containsMouse || hovered || popup.opened) && (!delegateButtons || delegateButtons.children.length === 0)
popup.x: 0 popup.x: 0
popup.padding: 10 * DefaultStyle.dp popup.padding: 10 * DefaultStyle.dp
anchors.right: parent.right Layout.rightMargin: 5 * DefaultStyle.dp
anchors.rightMargin: 5 * DefaultStyle.dp
anchors.verticalCenter: parent.verticalCenter
popup.contentItem: ColumnLayout { popup.contentItem: ColumnLayout {
Button { Button {
background: Item{} background: Item{}
@ -163,11 +156,12 @@ ListView {
} }
} }
} }
}
MouseArea { MouseArea {
id: contactArea id: contactArea
hoverEnabled: mainItem.hoverEnabled hoverEnabled: mainItem.hoverEnabled
anchors.fill: initial.visible ? contactDelegate : parent anchors.fill: contactDelegate
height: mainItem.height height: mainItem.height
Rectangle { Rectangle {
anchors.fill: contactArea anchors.fill: contactArea

View file

@ -190,10 +190,14 @@ Item {
} }
Button { Button {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
topPadding: 11 * DefaultStyle.dp
bottomPadding: 11 * DefaultStyle.dp
leftPadding: 20 * DefaultStyle.dp
rightPadding: 20 * DefaultStyle.dp
contentItem: RowLayout { contentItem: RowLayout {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
EffectImage { EffectImage {
colorizationColor: "red"// DefaultStyle.grey_0 colorizationColor: DefaultStyle.grey_0
source: mainItem.newItemIconSource source: mainItem.newItemIconSource
width: 24 * DefaultStyle.dp width: 24 * DefaultStyle.dp
height: 24 * DefaultStyle.dp height: 24 * DefaultStyle.dp

View file

@ -194,14 +194,14 @@ AbstractMainPage {
height: 45 * DefaultStyle.dp height: 45 * DefaultStyle.dp
} }
} }
Item {
Layout.fillWidth: true
Layout.fillHeight: true
ColumnLayout { ColumnLayout {
Layout.fillHeight: true
Layout.fillWidth: true
spacing: 5 * DefaultStyle.dp spacing: 5 * DefaultStyle.dp
anchors.verticalCenter: parent.verticalCenter
Text { Text {
id: friendAddress id: friendAddress
Layout.fillWidth: true
maximumLineCount: 1
property var remoteAddress: modelData ? UtilsCpp.getDisplayName(modelData.core.remoteAddress) : null property var remoteAddress: modelData ? UtilsCpp.getDisplayName(modelData.core.remoteAddress) : null
text: remoteAddress ? remoteAddress.value : "" text: remoteAddress ? remoteAddress.value : ""
font { font {
@ -230,7 +230,6 @@ AbstractMainPage {
Layout.preferredHeight: 5 * DefaultStyle.dp Layout.preferredHeight: 5 * DefaultStyle.dp
sourceSize.width: 5 * DefaultStyle.dp sourceSize.width: 5 * DefaultStyle.dp
sourceSize.height: 5 * DefaultStyle.dp sourceSize.height: 5 * DefaultStyle.dp
RectangleTest{anchors.fill: parent}
} }
Text { Text {
// text: modelData.core.date // text: modelData.core.date
@ -242,10 +241,6 @@ AbstractMainPage {
} }
} }
} }
}
// Item {
// Layout.fillWidth: true
// }
Button { Button {
Layout.rightMargin: 5 * DefaultStyle.dp Layout.rightMargin: 5 * DefaultStyle.dp
padding: 0 padding: 0

View file

@ -9,7 +9,7 @@ AbstractMainPage {
id: mainItem id: mainItem
noItemButtonText: qsTr("Ajouter un contact") noItemButtonText: qsTr("Ajouter un contact")
emptyListText: qsTr("Aucun contact pour le moment") 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 // disable left panel contact list interaction while a contact is being edited
property bool leftPanelEnabled: true property bool leftPanelEnabled: true
@ -154,8 +154,8 @@ AbstractMainPage {
Button { Button {
background: Item{} background: Item{}
icon.source: favoriteList.visible ? AppIcons.upArrow : AppIcons.downArrow icon.source: favoriteList.visible ? AppIcons.upArrow : AppIcons.downArrow
width: 24 * DefaultStyle.dp Layout.preferredWidth: 24 * DefaultStyle.dp
height: 24 * DefaultStyle.dp Layout.preferredHeight: 24 * DefaultStyle.dp
onClicked: favoriteList.visible = !favoriteList.visible onClicked: favoriteList.visible = !favoriteList.visible
} }
} }
@ -190,6 +190,7 @@ AbstractMainPage {
ColumnLayout { ColumnLayout {
visible: contactList.count > 0 visible: contactList.count > 0
RowLayout { RowLayout {
Layout.fillWidth: true
Text { Text {
text: qsTr("All contacts") text: qsTr("All contacts")
font { font {
@ -202,9 +203,9 @@ AbstractMainPage {
} }
Button { Button {
background: Item{} background: Item{}
icon.source: favoriteList.visible ? AppIcons.upArrow : AppIcons.downArrow icon.source: contactList.visible ? AppIcons.upArrow : AppIcons.downArrow
width: 24 * DefaultStyle.dp Layout.preferredWidth: 24 * DefaultStyle.dp
height: 24 * DefaultStyle.dp Layout.preferredHeight: 24 * DefaultStyle.dp
onClicked: contactList.visible = !contactList.visible onClicked: contactList.visible = !contactList.visible
} }
} }