diff --git a/Linphone/core/chat/message/EventLogList.cpp b/Linphone/core/chat/message/EventLogList.cpp index e796658c0..efddab6ae 100644 --- a/Linphone/core/chat/message/EventLogList.cpp +++ b/Linphone/core/chat/message/EventLogList.cpp @@ -136,6 +136,41 @@ void EventLogList::setChatGui(ChatGui *chat) { setChatCore(chatCore); } +void EventLogList::setDisplayItemsStep(int displayItemsStep) { + if (mDisplayItemsStep != displayItemsStep) { + mDisplayItemsStep = displayItemsStep; + emit displayItemsStepChanged(); + } +} + +void EventLogList::displayMore() { + if (!mChatCore) return; + auto chatModel = mChatCore->getModel(); + if (!chatModel) return; + mCoreModelConnection->invokeToModel([this, chatModel]() { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + int maxSize = chatModel->getHistorySizeEvents(); + int totalItemsCount = mList.count(); + auto newCount = std::min(totalItemsCount + mDisplayItemsStep, maxSize); + if (newCount <= totalItemsCount) { + return; + } + auto linphoneLogs = chatModel->getHistoryRange(totalItemsCount, newCount); + QList> *events = new QList>(); + for (auto it : linphoneLogs) { + auto model = EventLogCore::create(it); + events->push_back(model); + } + mCoreModelConnection->invokeToCore([this, events, newCount] { + int currentCount = mList.count(); + for (auto &event : *events) { + connectItem(event); + add(event); + } + }); + }); +} + int EventLogList::findFirstUnreadIndex() { auto eventList = getSharedList(); auto it = std::find_if(eventList.begin(), eventList.end(), [](const QSharedPointer item) { @@ -199,7 +234,8 @@ void EventLogList::setSelf(QSharedPointer me) { } mCoreModelConnection->invokeToModel([this, chatModel]() { mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); - auto linphoneLogs = chatModel->getHistory(); + qDebug() << "update history till" << mDisplayItemsStep; + auto linphoneLogs = chatModel->getHistoryRange(0, mDisplayItemsStep); QList> *events = new QList>(); for (auto it : linphoneLogs) { auto model = EventLogCore::create(it); diff --git a/Linphone/core/chat/message/EventLogList.hpp b/Linphone/core/chat/message/EventLogList.hpp index f1efe26c2..84e343512 100644 --- a/Linphone/core/chat/message/EventLogList.hpp +++ b/Linphone/core/chat/message/EventLogList.hpp @@ -52,6 +52,9 @@ public: int findFirstUnreadIndex(); + void displayMore(); + void setDisplayItemsStep(int displayItemsStep); + void findChatMessageWithFilter(QString filter, QSharedPointer startEvent, bool forward = true, @@ -69,6 +72,7 @@ signals: void listAboutToBeReset(); void chatGuiChanged(); void isUpdatingChanged(); + void displayItemsStepChanged(); private: QString mFilter; @@ -76,6 +80,7 @@ private: QSharedPointer> mChatModelConnection; QSharedPointer> mCoreModelConnection; bool mIsUpdating = false; + int mDisplayItemsStep = 0; DECLARE_ABSTRACT_OBJECT }; diff --git a/Linphone/core/chat/message/EventLogProxy.cpp b/Linphone/core/chat/message/EventLogProxy.cpp index c6a7a5827..323f9e13d 100644 --- a/Linphone/core/chat/message/EventLogProxy.cpp +++ b/Linphone/core/chat/message/EventLogProxy.cpp @@ -43,6 +43,8 @@ void EventLogProxy::setSourceModel(QAbstractItemModel *model) { if (newEventLogList) { connect(newEventLogList, &EventLogList::listAboutToBeReset, this, &EventLogProxy::listAboutToBeReset); connect(newEventLogList, &EventLogList::chatGuiChanged, this, &EventLogProxy::chatGuiChanged); + connect(this, &EventLogProxy::displayItemsStepChanged, newEventLogList, + [this, newEventLogList] { newEventLogList->setDisplayItemsStep(mDisplayItemsStep); }); connect(newEventLogList, &EventLogList::eventInserted, this, [this, newEventLogList](int index, EventLogGui *event) { invalidate(); @@ -90,6 +92,13 @@ QSharedPointer EventLogProxy::getEventCoreAtIndex(int i) { return getItemAt(i); } +void EventLogProxy::displayMore() { + auto model = getListModel(); + if (model) { + model->displayMore(); + } +} + void EventLogProxy::loadUntil(int index) { auto confInfoList = getListModel(); if (mMaxDisplayItems < index) setMaxDisplayItems(index + mDisplayItemsStep); diff --git a/Linphone/core/chat/message/EventLogProxy.hpp b/Linphone/core/chat/message/EventLogProxy.hpp index c9a57dbb1..738a39472 100644 --- a/Linphone/core/chat/message/EventLogProxy.hpp +++ b/Linphone/core/chat/message/EventLogProxy.hpp @@ -44,6 +44,7 @@ public: void setSourceModel(QAbstractItemModel *sourceModel) override; + Q_INVOKABLE void displayMore() override; Q_INVOKABLE void loadUntil(int index); Q_INVOKABLE EventLogGui *getEventAtIndex(int i); QSharedPointer getEventCoreAtIndex(int i); diff --git a/Linphone/core/proxy/LimitProxy.hpp b/Linphone/core/proxy/LimitProxy.hpp index 2c5f8a689..3f38b819c 100644 --- a/Linphone/core/proxy/LimitProxy.hpp +++ b/Linphone/core/proxy/LimitProxy.hpp @@ -45,7 +45,7 @@ public: // Helper for setting the limit with sorted/filtered list void setSourceModels(SortFilterProxy *firstList); - Q_INVOKABLE void displayMore(); + Q_INVOKABLE virtual void displayMore(); Q_INVOKABLE QVariant getAt(const int &index) const; Q_INVOKABLE QVariantList getAll() const; virtual int getCount() const; diff --git a/Linphone/model/chat/ChatModel.cpp b/Linphone/model/chat/ChatModel.cpp index 661b778fe..3b84137b2 100644 --- a/Linphone/model/chat/ChatModel.cpp +++ b/Linphone/model/chat/ChatModel.cpp @@ -61,11 +61,11 @@ std::list> ChatModel::getSharedDocuments() co } std::list> ChatModel::getHistory() const { - int filter = mMonitor->hasCapability((int)linphone::ChatRoom::Capabilities::Conference) - ? static_cast(linphone::ChatRoom::HistoryFilter::ChatMessage) | - static_cast(linphone::ChatRoom::HistoryFilter::InfoNoDevice) - : static_cast(linphone::ChatRoom::HistoryFilter::ChatMessage); - return mMonitor->getHistory(0, filter); + return mMonitor->getHistoryEvents(0); +} + +std::list> ChatModel::getHistoryRange(int begin, int end) { + return mMonitor->getHistoryRangeEvents(begin, end); } std::list> ChatModel::getChatMessageHistory() const { @@ -78,6 +78,10 @@ std::list> ChatModel::getChatMessageHisto return res; } +int ChatModel::getHistorySizeEvents() { + return mMonitor->getHistoryEventsSize(); +} + QString ChatModel::getIdentifier() const { return Utils::coreStringToAppString(mMonitor->getIdentifier()); } @@ -123,9 +127,6 @@ int ChatModel::getUnreadMessagesCount() const { void ChatModel::markAsRead() { mMonitor->markAsRead(); - for (auto &message : getChatMessageHistory()) { - message->markAsRead(); - } emit messagesRead(); } diff --git a/Linphone/model/chat/ChatModel.hpp b/Linphone/model/chat/ChatModel.hpp index c57a02b43..b4a4a8be7 100644 --- a/Linphone/model/chat/ChatModel.hpp +++ b/Linphone/model/chat/ChatModel.hpp @@ -49,7 +49,9 @@ public: std::list> getSharedMedias() const; std::list> getSharedDocuments() const; std::list> getHistory() const; + std::list> getHistoryRange(int begin, int end); std::list> getChatMessageHistory() const; + int getHistorySizeEvents(); QString getIdentifier() const; void deleteHistory(); void deleteMessage(std::shared_ptr message); diff --git a/Linphone/view/Control/Container/Call/CallLayout.qml b/Linphone/view/Control/Container/Call/CallLayout.qml index 19c233e6a..41d590fc3 100644 --- a/Linphone/view/Control/Container/Call/CallLayout.qml +++ b/Linphone/view/Control/Container/Call/CallLayout.qml @@ -20,6 +20,11 @@ Item { property int conferenceLayout: call ? call.core.conferenceVideoLayout : LinphoneEnums.ConferenceLayout.ActiveSpeaker property int participantDeviceCount: conference ? conference.core.participantDeviceCount : -1 property int lastConfLayoutBeforeSharing: -1 + property string localAddress: call + ? call.conference + ? call.conference.core.me.core.sipAddress + : call.core.localAddress + : "" onParticipantDeviceCountChanged: { setConferenceLayout() } diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index c15e7ce37..d80d40be1 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -453,7 +453,6 @@ ListView { id: mouseArea hoverEnabled: true anchors.fill: parent - focus: true acceptedButtons: Qt.RightButton | Qt.LeftButton onContainsMouseChanged: { if (containsMouse) diff --git a/Linphone/view/Control/Display/Chat/ChatMessage.qml b/Linphone/view/Control/Display/Chat/ChatMessage.qml index b5d878d7f..8235f9b48 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessage.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessage.qml @@ -317,7 +317,8 @@ Control.Control { : "" BusyIndicator { anchors.fill: parent - z: parent.z + 1 + Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 + Layout.preferredHeight: visible ? 14 * DefaultStyle.dp : 0 visible: mainItem.msgState === LinphoneEnums.ChatMessageState.StateIdle || mainItem.msgState === LinphoneEnums.ChatMessageState.StateInProgress || mainItem.msgState === LinphoneEnums.ChatMessageState.StateFileTransferInProgress diff --git a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml index 4d3475643..81aa39945 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml @@ -48,11 +48,6 @@ ListView { eventLogProxy.markIndexAsRead(index) }) } - - onChatChanged: { - lastItemVisible = false - forceActiveFocus() - } Button { visible: !mainItem.lastItemVisible @@ -77,15 +72,15 @@ ListView { chat.core.lMarkAsRead() } onAtYBeginningChanged: if (atYBeginning) { - if (eventLogProxy.haveMore) - eventLogProxy.displayMore() + eventLogProxy.displayMore() } model: EventLogProxy { id: eventLogProxy chatGui: mainItem.chat filterText: mainItem.filterText - initialDisplayItems: 10 + initialDisplayItems: 20 + displayItemsStep: 20 onEventInserted: (index, gui) => { if (!mainItem.visible) return if(mainItem.lastItemVisible) { diff --git a/Linphone/view/Control/Display/Chat/FileView.qml b/Linphone/view/Control/Display/Chat/FileView.qml index 649aa8945..615595b9a 100644 --- a/Linphone/view/Control/Display/Chat/FileView.qml +++ b/Linphone/view/Control/Display/Chat/FileView.qml @@ -70,7 +70,7 @@ Item { Image { anchors.fill: image z: image.z + 1 - visible: image.status == Image.Error || image.status == Image.Null + visible: image.status == Image.Error || image.status == Image.Null || image.frameCount === 0 source: AppIcons.fileImage sourceSize.width: mainItem.width sourceSize.height: mainItem.height diff --git a/Linphone/view/Control/Display/Chat/VideoFileView.qml b/Linphone/view/Control/Display/Chat/VideoFileView.qml index 90a3dc4b0..b3add571b 100644 --- a/Linphone/view/Control/Display/Chat/VideoFileView.qml +++ b/Linphone/view/Control/Display/Chat/VideoFileView.qml @@ -11,7 +11,7 @@ import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils Rectangle { id: mainItem - color: "transparent"//DefaultStyle.grey_1000 + color: DefaultStyle.grey_1000 property ChatMessageContentGui contentGui property string filePath: contentGui && contentGui.core.filePath property var fillMode: playbackState === MediaPlayer.PlayingState ? VideoOutput.PreserveAspectFit : VideoOutput.PreserveAspectCrop diff --git a/Linphone/view/Control/Display/Contact/AllContactListView.qml b/Linphone/view/Control/Display/Contact/AllContactListView.qml index 9f0b30587..ac0291e0a 100644 --- a/Linphone/view/Control/Display/Contact/AllContactListView.qml +++ b/Linphone/view/Control/Display/Contact/AllContactListView.qml @@ -147,7 +147,6 @@ Flickable { } } onSearchTextChanged: { - console.log("search texte changed, loading…") loading = true } diff --git a/Linphone/view/Page/Form/Settings/SettingsPage.qml b/Linphone/view/Page/Form/Settings/SettingsPage.qml index 9f46fa253..8ad2444b3 100644 --- a/Linphone/view/Page/Form/Settings/SettingsPage.qml +++ b/Linphone/view/Page/Form/Settings/SettingsPage.qml @@ -24,7 +24,7 @@ AbstractSettingsMenu { //: "Affichage" //{title: qsTr("settings_user_interface_title"), layout: "DisplaySettingsLayout"}, //: "Security" - {title: qsTr("settings_security_title"), layout: "SecuritySettingsLayout"}, + // {title: qsTr("settings_security_title"), layout: "SecuritySettingsLayout"}, //: "Réseau" {title: qsTr("settings_network_title"), layout: "NetworkSettingsLayout"}, //: "Paramètres avancés" diff --git a/Linphone/view/Page/Layout/Main/MainLayout.qml b/Linphone/view/Page/Layout/Main/MainLayout.qml index ca2fb2262..9ad85bd33 100644 --- a/Linphone/view/Page/Layout/Main/MainLayout.qml +++ b/Linphone/view/Page/Layout/Main/MainLayout.qml @@ -471,7 +471,10 @@ Item { icon.height: Math.round(32 * DefaultStyle.dp) text: qsTr("settings_title") icon.source: AppIcons.settings - onClicked: openContextualMenuComponent(settingsPageComponent) + onClicked: { + var page = settingsPageComponent.createObject(parent); + openContextualMenuComponent(page) + } KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem( 2) : null @@ -503,8 +506,10 @@ Item { //: "Aide" text: qsTr("help_title") icon.source: AppIcons.question - onClicked: openContextualMenuComponent( - helpPageComponent) + onClicked: { + var page = helpPageComponent.createObject(parent); + openContextualMenuComponent(page) + } KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem( 4) : null diff --git a/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml b/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml index cb920aab0..6f326067d 100644 --- a/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml @@ -68,8 +68,9 @@ AbstractSettingsLayout { toValidate: true Connections { + enabled: account target: account.core - function onMwiServerAddressAddressChanged() { + function onMwiServerAddressChanged() { if (mwiServerAddressField.text != mwiServerAddressField.propertyOwnerGui.core[mwiServerAddressField.propertyName]) mwiServerAddressField.text = mwiServerAddressField.propertyOwnerGui.core[mwiServerAddressField.propertyName] } @@ -80,14 +81,14 @@ AbstractSettingsLayout { propertyName: "voicemailAddress" propertyOwnerGui: account //: "URI de messagerie vocale" - title: qsTr("account_settings_voicemail_uri_title") Layout.fillWidth: true toValidate: true Connections { + enabled: account target: account.core - function onVoicemailAddressAddressChanged() { + function onVoicemailAddressChanged() { if (voicemailAddressField.text != voicemailAddressField.propertyOwnerGui.core[voicemailAddressField.propertyName]) voicemailAddressField.text = voicemailAddressField.propertyOwnerGui.core[voicemailAddressField.propertyName] }