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

View file

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

View file

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

View file

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

View file

@ -84,18 +84,13 @@ 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
anchors.right: parent.right
anchors.rightMargin: 5 * DefaultStyle.dp
anchors.verticalCenter: parent.verticalCenter
children: mainItem.delegateButtons || []
}
@ -106,9 +101,7 @@ ListView {
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
Layout.rightMargin: 5 * DefaultStyle.dp
popup.contentItem: ColumnLayout {
Button {
background: Item{}
@ -163,11 +156,12 @@ ListView {
}
}
}
}
MouseArea {
id: contactArea
hoverEnabled: mainItem.hoverEnabled
anchors.fill: initial.visible ? contactDelegate : parent
anchors.fill: contactDelegate
height: mainItem.height
Rectangle {
anchors.fill: contactArea

View file

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

View file

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

View file

@ -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 {
@ -202,9 +203,9 @@ AbstractMainPage {
}
Button {
background: Item{}
icon.source: favoriteList.visible ? AppIcons.upArrow : AppIcons.downArrow
width: 24 * DefaultStyle.dp
height: 24 * DefaultStyle.dp
icon.source: contactList.visible ? AppIcons.upArrow : AppIcons.downArrow
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
onClicked: contactList.visible = !contactList.visible
}
}