TODO : find why it crashes in CallsWindow.qml function endCall(). For now we don't return to call history at the end of a call
This commit is contained in:
Gaelle Braud 2024-07-05 17:30:09 +02:00
parent e3b587bdbd
commit 7a21e17c55
15 changed files with 101 additions and 31 deletions

View file

@ -74,7 +74,17 @@ void ConferenceInfoProxy::updateCurrentDateIndex() {
bool ConferenceInfoProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { bool ConferenceInfoProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
auto ciCore = qobject_cast<ConferenceInfoList *>(sourceModel())->template getAt<ConferenceInfoCore>(sourceRow); auto ciCore = qobject_cast<ConferenceInfoList *>(sourceModel())->template getAt<ConferenceInfoCore>(sourceRow);
if (ciCore) { if (ciCore) {
if (!ciCore->getSubject().contains(mSearchText)) return false; bool searchTextInSubject = false;
bool searchTextInParticipant = false;
if (ciCore->getSubject().toLower().contains(mSearchText.toLower())) searchTextInSubject = true;
for (auto &contact : ciCore->getParticipants()) {
auto infos = contact.toMap();
if (infos["displayName"].toString().toLower().contains(mSearchText.toLower())) {
searchTextInParticipant = true;
break;
}
}
if (!searchTextInSubject && !searchTextInParticipant) return false;
QDateTime currentDateTime = QDateTime::currentDateTimeUtc(); QDateTime currentDateTime = QDateTime::currentDateTimeUtc();
if (mFilterType == int(ConferenceInfoProxy::ConferenceInfoFiltering::None)) { if (mFilterType == int(ConferenceInfoProxy::ConferenceInfoFiltering::None)) {
return true; return true;

View file

@ -173,3 +173,23 @@ QVariant MagicSearchList::data(const QModelIndex &index, int role) const {
} }
return QVariant(); return QVariant();
} }
int MagicSearchList::findFriendIndexByAddress(const QString &address) {
int i = 0;
qDebug() << "LOOKING FOR ADDRESS" << address;
for (auto &item : mList) {
qDebug() << "item" << item;
auto isFriendCore = item.objectCast<FriendCore>();
if (!isFriendCore) continue;
qDebug() << "SEARCH IN FRIEND" << isFriendCore->getDisplayName();
for (auto &friendAddress : isFriendCore->getAllAddresses()) {
auto map = friendAddress.toMap();
qDebug() << "COMPARE" << map["address"].toString();
if (map["address"].toString() == address) {
return i;
}
}
++i;
}
return -1;
}

View file

@ -52,6 +52,8 @@ public:
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
int findFriendIndexByAddress(const QString& address);
signals: signals:
void lSearch(QString filter); void lSearch(QString filter);
void lSetSourceFlags(int sourceFlags); void lSetSourceFlags(int sourceFlags);

View file

@ -38,6 +38,10 @@ MagicSearchProxy::MagicSearchProxy(QObject *parent) : SortFilterProxy(parent) {
MagicSearchProxy::~MagicSearchProxy() { MagicSearchProxy::~MagicSearchProxy() {
} }
int MagicSearchProxy::findFriendIndexByAddress(const QString &address) {
return mapFromSource(mList->index(mList->findFriendIndexByAddress(address), 0)).row();
}
QString MagicSearchProxy::getSearchText() const { QString MagicSearchProxy::getSearchText() const {
return mSearchText; return mSearchText;
} }

View file

@ -49,6 +49,7 @@ public:
void setAggregationFlag(LinphoneEnums::MagicSearchAggregation flag); void setAggregationFlag(LinphoneEnums::MagicSearchAggregation flag);
// Q_INVOKABLE forceUpdate(); // Q_INVOKABLE forceUpdate();
Q_INVOKABLE int findFriendIndexByAddress(const QString &address);
signals: signals:
void searchTextChanged(); void searchTextChanged();

View file

@ -168,11 +168,13 @@ void ConferenceModel::onActiveSpeakerParticipantDevice(
void ConferenceModel::onParticipantAdded(const std::shared_ptr<linphone::Conference> &conference, void ConferenceModel::onParticipantAdded(const std::shared_ptr<linphone::Conference> &conference,
const std::shared_ptr<linphone::Participant> &participant) { const std::shared_ptr<linphone::Participant> &participant) {
lDebug() << "onParticipant Added" << participant->getAddress()->asStringUriOnly();
emit participantAdded(participant); emit participantAdded(participant);
emit participantDeviceCountChanged(getParticipantDeviceCount()); emit participantDeviceCountChanged(getParticipantDeviceCount());
} }
void ConferenceModel::onParticipantRemoved(const std::shared_ptr<linphone::Conference> &conference, void ConferenceModel::onParticipantRemoved(const std::shared_ptr<linphone::Conference> &conference,
const std::shared_ptr<const linphone::Participant> &participant) { const std::shared_ptr<const linphone::Participant> &participant) {
lDebug() << "onParticipant Removed" << participant->getAddress()->asStringUriOnly();
emit participantRemoved(participant); emit participantRemoved(participant);
emit participantDeviceCountChanged(getParticipantDeviceCount()); emit participantDeviceCountChanged(getParticipantDeviceCount());
} }

View file

@ -73,8 +73,8 @@ AppWindow {
function endCall(callToFinish) { function endCall(callToFinish) {
if (callToFinish) callToFinish.core.lTerminate() if (callToFinish) callToFinish.core.lTerminate()
var mainWin = UtilsCpp.getMainWindow() // var mainWin = UtilsCpp.getMainWindow()
mainWin.goToCallHistory() // mainWin.goToCallHistory()
} }
function callEnded(call){ function callEnded(call){
if (call.core.state === LinphoneEnums.CallState.Error) { if (call.core.state === LinphoneEnums.CallState.Error) {
@ -320,7 +320,7 @@ AppWindow {
} }
RowLayout { RowLayout {
spacing: 5 * DefaultStyle.dp spacing: 5 * DefaultStyle.dp
visible: mainWindow.callState != LinphoneEnums.CallState.End && mainWindow.callState != LinphoneEnums.CallState.Released visible: mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState === LinphoneEnums.CallState.StreamsRunning
BusyIndicator { BusyIndicator {
visible: mainWindow.call && mainWindow.callState != LinphoneEnums.CallState.Connected && mainWindow.callState != LinphoneEnums.CallState.StreamsRunning visible: mainWindow.call && mainWindow.callState != LinphoneEnums.CallState.Connected && mainWindow.callState != LinphoneEnums.CallState.StreamsRunning
Layout.preferredWidth: 15 * DefaultStyle.dp Layout.preferredWidth: 15 * DefaultStyle.dp
@ -742,7 +742,6 @@ AppWindow {
} }
} }
onClicked: { onClicked: {
console.log("call is paused", modelData.core.paused)
modelData.core.lSetPaused(!modelData.core.paused) modelData.core.lSetPaused(!modelData.core.paused)
} }
} }
@ -850,7 +849,7 @@ AppWindow {
} }
} }
onClicked: { onClicked: {
UtilsCpp.copyToClipboard(mainWindow.conference.core.uri) UtilsCpp.copyToClipboard(mainWindow.call.core.peerAddress)
showInformationPopup(qsTr("Copié"), qsTr("Le lien de la réunion a été copié dans le presse-papier"), true) showInformationPopup(qsTr("Copié"), qsTr("Le lien de la réunion a été copié dans le presse-papier"), true)
} }
} }

View file

@ -21,6 +21,7 @@ Item {
signal addAccountRequest() signal addAccountRequest()
signal openNewCall() signal openNewCall()
signal openCallHistory() signal openCallHistory()
signal displayContact(string contactAddress)
signal createContactRequested(string name, string address) signal createContactRequested(string name, string address)
function goToNewCall() { function goToNewCall() {
@ -31,6 +32,10 @@ Item {
tabbar.currentIndex = 0 tabbar.currentIndex = 0
mainItem.openCallHistory() mainItem.openCallHistory()
} }
function goToContactPage(contactAddress) {
tabbar.currentIndex = 1
mainItem.displayContact(contactAddress)
}
function createContact(name, address) { function createContact(name, address) {
tabbar.currentIndex = 1 tabbar.currentIndex = 1
@ -388,9 +393,10 @@ Item {
onCreateContactRequested: (name, address) => { onCreateContactRequested: (name, address) => {
contactPage.createContact(name, address) contactPage.createContact(name, address)
} }
onDisplayContact: (contactAddress) => {
contactPage.displayContact(contactAddress)
}
} }
} }
Item{} Item{}
//ConversationPage{} //ConversationPage{}

View file

@ -33,6 +33,10 @@ AppWindow {
mainWindowStackView.replace(mainPage, StackView.Immediate) mainWindowStackView.replace(mainPage, StackView.Immediate)
mainWindowStackView.currentItem.goToNewCall() mainWindowStackView.currentItem.goToNewCall()
} }
function goToContactPage(contactAddress) {
mainWindowStackView.replace(mainPage, StackView.Immediate)
mainWindowStackView.currentItem.goToContactPage(contactAddress)
}
function transferCallSucceed() { function transferCallSucceed() {
mainWindowStackView.replace(mainPage, StackView.Immediate) mainWindowStackView.replace(mainPage, StackView.Immediate)
UtilsCpp.showInformationPopup(qsTr("Appel transféré"), qsTr("Votre correspondant a été transféré au contact sélectionné")) UtilsCpp.showInformationPopup(qsTr("Appel transféré"), qsTr("Votre correspondant a été transféré au contact sélectionné"))

View file

@ -47,6 +47,14 @@ ListView {
signal contactDeletionRequested(FriendGui contact) signal contactDeletionRequested(FriendGui contact)
signal contactAddedToSelection() signal contactAddedToSelection()
function selectContact(address) {
console.log("select", address)
var index = magicSearchProxy.findFriendIndexByAddress(address)
console.log("index in selection", index)
if (index == -1) {
mainItem.currentIndex = index
}
}
function addContactToSelection(address) { function addContactToSelection(address) {
if (multiSelectionEnabled) { if (multiSelectionEnabled) {
var indexInSelection = selectedContacts.indexOf(address) var indexInSelection = selectedContacts.indexOf(address)
@ -65,6 +73,7 @@ ListView {
model: MagicSearchProxy { model: MagicSearchProxy {
id: magicSearchProxy
searchText: searchBarText.length === 0 ? "*" : searchBarText searchText: searchBarText.length === 0 ? "*" : searchBarText
onFriendCreated: (index) => { onFriendCreated: (index) => {
mainItem.currentIndex = index mainItem.currentIndex = index

View file

@ -39,7 +39,7 @@ ListView {
model: ConferenceInfoProxy { model: ConferenceInfoProxy {
id: confInfoProxy id: confInfoProxy
searchText: searchBarText.length === 0 ? "" : searchBarText searchText: searchBarText
filterType: ConferenceInfoProxy.None filterType: ConferenceInfoProxy.None
} }

View file

@ -149,7 +149,8 @@ ColumnLayout {
button.icon.source: AppIcons.phone button.icon.source: AppIcons.phone
label: qsTr("Appel") label: qsTr("Appel")
button.onClicked: { button.onClicked: {
mainWindow.startCallWithContact(contact, false, mainItem) if (mainItem.contact) mainWindow.startCallWithContact(mainItem.contact, false, mainItem)
else UtilsCpp.createCall(mainItem.contactAddress)
} }
} }
LabelButton { LabelButton {
@ -171,7 +172,8 @@ ColumnLayout {
button.icon.source: AppIcons.videoCamera button.icon.source: AppIcons.videoCamera
label: qsTr("Appel Video") label: qsTr("Appel Video")
button.onClicked: { button.onClicked: {
mainWindow.startCallWithContact(contact, true, mainItem) if (mainItem.contact) mainWindow.startCallWithContact(mainItem.contact, true, mainItem)
else UtilsCpp.createCall(mainItem.contactAddress, {'localVideoEnabled': true})
} }
} }
} }

View file

@ -146,12 +146,6 @@ AbstractMainPage {
} }
} }
} }
Connections {
target: deleteHistoryPopup
onAccepted: {
historyListView.model.removeAllEntries()
}
}
onClicked: { onClicked: {
removeHistory.close() removeHistory.close()
deleteHistoryPopup.open() deleteHistoryPopup.open()
@ -219,6 +213,13 @@ AbstractMainPage {
flickDeceleration: 10000 flickDeceleration: 10000
spacing: 10 * DefaultStyle.dp spacing: 10 * DefaultStyle.dp
Connections {
target: deleteHistoryPopup
onAccepted: {
historyListView.model.removeAllEntries()
}
}
delegate: Item { delegate: Item {
width:historyListView.width width:historyListView.width
height: 56 * DefaultStyle.dp height: 56 * DefaultStyle.dp
@ -527,7 +528,7 @@ AbstractMainPage {
visible: mainItem.selectedRowHistoryGui != undefined visible: mainItem.selectedRowHistoryGui != undefined
property var contactObj: UtilsCpp.findFriendByAddress(contactAddress) property var contactObj: UtilsCpp.findFriendByAddress(contactAddress)
contact: contactObj && contactObj.value || null contact: contactObj && contactObj.value || null
conferenceInfo: mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.conferenceInfo conferenceInfo: mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.conferenceInfo || null
contactAddress: mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress || "" contactAddress: mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress || ""
contactName: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.displayName : "" contactName: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.displayName : ""
anchors.top: rightPanelStackView.top anchors.top: rightPanelStackView.top
@ -540,16 +541,19 @@ AbstractMainPage {
anchors.rightMargin: 30 * DefaultStyle.dp anchors.rightMargin: 30 * DefaultStyle.dp
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
popup.x: width popup.x: width
property var friendGuiObj: UtilsCpp.findFriendByAddress(contactDetail.contactAddress)
property var friendGui: friendGuiObj ? friendGuiObj.value : null
popup.contentItem: ColumnLayout { popup.contentItem: ColumnLayout {
Button { Button {
background: Item {} background: Item {}
contentItem: IconLabel { contentItem: IconLabel {
text: qsTr("Ajouter aux contacts") text: detailOptions.friendGui ? qsTr("Voir le contact") : qsTr("Ajouter aux contacts")
iconSource: AppIcons.plusCircle iconSource: AppIcons.plusCircle
} }
onClicked: { onClicked: {
detailOptions.close() detailOptions.close()
mainItem.createContactRequested(contactDetail.contactName, contactDetail.contactAddress) if (detailOptions.friendGui) mainWindow.goToContactPage(contactDetail.contactAddress)
else mainItem.createContactRequested(contactDetail.contactName, contactDetail.contactAddress)
} }
} }
Button { Button {
@ -564,15 +568,15 @@ AbstractMainPage {
else UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Erreur lors de la copie de l'adresse"), false) else UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Erreur lors de la copie de l'adresse"), false)
} }
} }
Button { // Button {
background: Item {} // background: Item {}
enabled: false // enabled: false
contentItem: IconLabel { // contentItem: IconLabel {
text: qsTr("Bloquer") // text: qsTr("Bloquer")
iconSource: AppIcons.empty // iconSource: AppIcons.empty
} // }
onClicked: console.debug("[CallPage.qml] TODO : block user") // onClicked: console.debug("[CallPage.qml] TODO : block user")
} // }
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 2 * DefaultStyle.dp Layout.preferredHeight: 2 * DefaultStyle.dp

View file

@ -41,6 +41,10 @@ AbstractMainPage {
rightPanelStackView.push(contactEdition, {"contact": friendGui, "title": qsTr("Modifier contact"), "saveButtonText": qsTr("Enregistrer")}) rightPanelStackView.push(contactEdition, {"contact": friendGui, "title": qsTr("Modifier contact"), "saveButtonText": qsTr("Enregistrer")})
} }
function displayContact(contactAddress) {
contactList.selectContact(contactAddress)
}
// rightPanelStackView.initialItem: contactDetail // rightPanelStackView.initialItem: contactDetail
Binding { Binding {
mainItem.showDefaultItem: false mainItem.showDefaultItem: false

View file

@ -57,9 +57,9 @@ AbstractMainPage {
topPadding: 11 * DefaultStyle.dp topPadding: 11 * DefaultStyle.dp
bottomPadding: 11 * DefaultStyle.dp bottomPadding: 11 * DefaultStyle.dp
onClicked: { onClicked: {
cancelAndDeleteConfDialog.cancelRequested()
cancelAndDeleteConfDialog.accepted() cancelAndDeleteConfDialog.accepted()
cancelAndDeleteConfDialog.close() cancelAndDeleteConfDialog.close()
cancelAndDeleteConfDialog.cancelRequested()
} }
}, },
Button { Button {
@ -169,6 +169,7 @@ AbstractMainPage {
// Layout.fillWidth: true // Layout.fillWidth: true
//Layout.topMargin: 18 * DefaultStyle.dp //Layout.topMargin: 18 * DefaultStyle.dp
placeholderText: qsTr("Rechercher une réunion") placeholderText: qsTr("Rechercher une réunion")
focusedBorderColor: DefaultStyle.main1_500_main
Layout.preferredWidth: 331 * DefaultStyle.dp Layout.preferredWidth: 331 * DefaultStyle.dp
} }
@ -270,6 +271,7 @@ AbstractMainPage {
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("La conférence doit contenir au moins un participant"), false) UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("La conférence doit contenir au moins un participant"), false)
} else { } else {
meetingSetup.conferenceInfoGui.core.save() meetingSetup.conferenceInfoGui.core.save()
mainWindow.showLoadingPopup(qsTr("Création de la réunion en cours ..."), true)
} }
} }
} }
@ -285,7 +287,7 @@ AbstractMainPage {
var mainWin = UtilsCpp.getMainWindow() var mainWin = UtilsCpp.getMainWindow()
if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.AllocationPending if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.AllocationPending
|| meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Updating) { || meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Updating) {
mainWin.showLoadingPopup(qsTr("Création de la conférence en cours...")) mainWin.showLoadingPopup(qsTr("Création de la réunion en cours..."))
} else { } else {
if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Error) { if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Error) {
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("La création de la conférence a échoué"), false) UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("La création de la conférence a échoué"), false)
@ -298,6 +300,7 @@ AbstractMainPage {
onSaveSucceed: { onSaveSucceed: {
leftPanelStackView.pop() leftPanelStackView.pop()
UtilsCpp.showInformationPopup(qsTr("Nouvelle réunion"), qsTr("Réunion planifiée avec succès"), true) UtilsCpp.showInformationPopup(qsTr("Nouvelle réunion"), qsTr("Réunion planifiée avec succès"), true)
mainWindow.closeLoadingPopup()
} }
onAddParticipantsRequested: { onAddParticipantsRequested: {
leftPanelStackView.push(addParticipants, {"conferenceInfoGui": conferenceInfoGui, "container": leftPanelStackView}) leftPanelStackView.push(addParticipants, {"conferenceInfoGui": conferenceInfoGui, "container": leftPanelStackView})