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 {
auto ciCore = qobject_cast<ConferenceInfoList *>(sourceModel())->template getAt<ConferenceInfoCore>(sourceRow);
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();
if (mFilterType == int(ConferenceInfoProxy::ConferenceInfoFiltering::None)) {
return true;

View file

@ -173,3 +173,23 @@ QVariant MagicSearchList::data(const QModelIndex &index, int role) const {
}
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;
int findFriendIndexByAddress(const QString& address);
signals:
void lSearch(QString filter);
void lSetSourceFlags(int sourceFlags);

View file

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

View file

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

View file

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

View file

@ -73,8 +73,8 @@ AppWindow {
function endCall(callToFinish) {
if (callToFinish) callToFinish.core.lTerminate()
var mainWin = UtilsCpp.getMainWindow()
mainWin.goToCallHistory()
// var mainWin = UtilsCpp.getMainWindow()
// mainWin.goToCallHistory()
}
function callEnded(call){
if (call.core.state === LinphoneEnums.CallState.Error) {
@ -320,7 +320,7 @@ AppWindow {
}
RowLayout {
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 {
visible: mainWindow.call && mainWindow.callState != LinphoneEnums.CallState.Connected && mainWindow.callState != LinphoneEnums.CallState.StreamsRunning
Layout.preferredWidth: 15 * DefaultStyle.dp
@ -742,7 +742,6 @@ AppWindow {
}
}
onClicked: {
console.log("call is paused", modelData.core.paused)
modelData.core.lSetPaused(!modelData.core.paused)
}
}
@ -850,7 +849,7 @@ AppWindow {
}
}
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)
}
}

View file

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

View file

@ -33,6 +33,10 @@ AppWindow {
mainWindowStackView.replace(mainPage, StackView.Immediate)
mainWindowStackView.currentItem.goToNewCall()
}
function goToContactPage(contactAddress) {
mainWindowStackView.replace(mainPage, StackView.Immediate)
mainWindowStackView.currentItem.goToContactPage(contactAddress)
}
function transferCallSucceed() {
mainWindowStackView.replace(mainPage, StackView.Immediate)
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 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) {
if (multiSelectionEnabled) {
var indexInSelection = selectedContacts.indexOf(address)
@ -65,6 +73,7 @@ ListView {
model: MagicSearchProxy {
id: magicSearchProxy
searchText: searchBarText.length === 0 ? "*" : searchBarText
onFriendCreated: (index) => {
mainItem.currentIndex = index

View file

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

View file

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

View file

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

View file

@ -57,9 +57,9 @@ AbstractMainPage {
topPadding: 11 * DefaultStyle.dp
bottomPadding: 11 * DefaultStyle.dp
onClicked: {
cancelAndDeleteConfDialog.cancelRequested()
cancelAndDeleteConfDialog.accepted()
cancelAndDeleteConfDialog.close()
cancelAndDeleteConfDialog.cancelRequested()
}
},
Button {
@ -169,6 +169,7 @@ AbstractMainPage {
// Layout.fillWidth: true
//Layout.topMargin: 18 * DefaultStyle.dp
placeholderText: qsTr("Rechercher une réunion")
focusedBorderColor: DefaultStyle.main1_500_main
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)
} else {
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()
if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.AllocationPending
|| 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 {
if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Error) {
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("La création de la conférence a échoué"), false)
@ -298,6 +300,7 @@ AbstractMainPage {
onSaveSucceed: {
leftPanelStackView.pop()
UtilsCpp.showInformationPopup(qsTr("Nouvelle réunion"), qsTr("Réunion planifiée avec succès"), true)
mainWindow.closeLoadingPopup()
}
onAddParticipantsRequested: {
leftPanelStackView.push(addParticipants, {"conferenceInfoGui": conferenceInfoGui, "container": leftPanelStackView})