From 3589029ec503b6b93741ab96f05aa09257eabcf7 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Wed, 16 Oct 2024 15:12:14 +0200 Subject: [PATCH] Refreshing optimizations: - Reset data list and initialization on single step. - Just add a log on new call log. - Remove updateView : it should not be needed as contains are updated automatically from its items. - Clean AbstractListProxy from LimitProxy implementation. - Avoid to reset left panel if not needed to not reload lists. - Fix missing objectName in history list view. Fix display on new call button. --- Linphone/core/account/AccountList.cpp | 3 +- .../address-books/carddav/CarddavList.cpp | 3 +- Linphone/core/address-books/ldap/LdapList.cpp | 3 +- .../core/call-history/CallHistoryCore.cpp | 3 +- .../core/call-history/CallHistoryCore.hpp | 1 + .../core/call-history/CallHistoryList.cpp | 50 ++++++------- .../core/call-history/CallHistoryProxy.cpp | 4 -- .../core/call-history/CallHistoryProxy.hpp | 1 - Linphone/core/call/CallList.cpp | 3 +- .../core/conference/ConferenceInfoList.cpp | 3 +- .../participant/ParticipantDeviceList.cpp | 3 +- Linphone/core/participant/ParticipantList.cpp | 3 +- .../core/payload-type/PayloadTypeList.cpp | 3 +- .../core/phone-number/PhoneNumberList.cpp | 3 +- Linphone/core/proxy/AbstractListProxy.hpp | 71 ++++++++----------- Linphone/core/proxy/LimitProxy.cpp | 17 ++++- Linphone/core/proxy/LimitProxy.hpp | 3 + Linphone/core/proxy/ListProxy.hpp | 31 ++++---- Linphone/core/proxy/Proxy.cpp | 43 ----------- Linphone/core/proxy/Proxy.hpp | 21 ------ Linphone/core/proxy/SortFilterProxy.cpp | 3 +- Linphone/core/search/MagicSearchList.cpp | 3 +- Linphone/core/timezone/TimeZoneList.cpp | 5 +- Linphone/view/Page/Form/Call/NewCallForm.qml | 2 +- Linphone/view/Page/Layout/Main/MainLayout.qml | 2 +- Linphone/view/Page/Main/Call/CallPage.qml | 17 ++--- 26 files changed, 111 insertions(+), 193 deletions(-) diff --git a/Linphone/core/account/AccountList.cpp b/Linphone/core/account/AccountList.cpp index ab58fb10..a11ceb7d 100644 --- a/Linphone/core/account/AccountList.cpp +++ b/Linphone/core/account/AccountList.cpp @@ -65,8 +65,7 @@ void AccountList::setSelf(QSharedPointer me) { } mModelConnection->invokeToCore([this, accounts, defaultAccountCore]() { mustBeInMainThread(getClassName()); - resetData(); - add(*accounts); + resetData(*accounts); setHaveAccount(accounts->size() > 0); setDefaultAccount(defaultAccountCore); delete accounts; diff --git a/Linphone/core/address-books/carddav/CarddavList.cpp b/Linphone/core/address-books/carddav/CarddavList.cpp index e1f87433..cad9790e 100644 --- a/Linphone/core/address-books/carddav/CarddavList.cpp +++ b/Linphone/core/address-books/carddav/CarddavList.cpp @@ -67,8 +67,7 @@ void CarddavList::setSelf(QSharedPointer me) { } mModelConnection->invokeToCore([this, carddavs]() { mustBeInMainThread(getClassName()); - resetData(); - add(*carddavs); + resetData(*carddavs); delete carddavs; }); }); diff --git a/Linphone/core/address-books/ldap/LdapList.cpp b/Linphone/core/address-books/ldap/LdapList.cpp index aebabc34..417d64d9 100644 --- a/Linphone/core/address-books/ldap/LdapList.cpp +++ b/Linphone/core/address-books/ldap/LdapList.cpp @@ -64,8 +64,7 @@ void LdapList::setSelf(QSharedPointer me) { } mModelConnection->invokeToCore([this, ldaps]() { mustBeInMainThread(getClassName()); - resetData(); - add(*ldaps); + resetData(*ldaps); delete ldaps; }); }); diff --git a/Linphone/core/call-history/CallHistoryCore.cpp b/Linphone/core/call-history/CallHistoryCore.cpp index 85242f7e..b447d26f 100644 --- a/Linphone/core/call-history/CallHistoryCore.cpp +++ b/Linphone/core/call-history/CallHistoryCore.cpp @@ -54,6 +54,7 @@ CallHistoryCore::CallHistoryCore(const std::shared_ptr &callL mIsOutgoing = callLog->getDir() == linphone::Call::Dir::Outgoing; mDuration = QString::number(callLog->getDuration()); mIsConference = callLog->wasConference(); + mCallId = Utils::coreStringToAppString(callLog->getCallId()); if (mIsConference) { auto confinfo = callLog->getConferenceInfo(); mConferenceInfo = ConferenceInfoCore::create(confinfo); @@ -98,4 +99,4 @@ void CallHistoryCore::setDuration(const QString &duration) { void CallHistoryCore::remove() { mHistoryModelConnection->invokeToModel([this]() { mCallHistoryModel->removeCallHistory(); }); -} \ No newline at end of file +} diff --git a/Linphone/core/call-history/CallHistoryCore.hpp b/Linphone/core/call-history/CallHistoryCore.hpp index 7e4024dd..4584d3ac 100644 --- a/Linphone/core/call-history/CallHistoryCore.hpp +++ b/Linphone/core/call-history/CallHistoryCore.hpp @@ -62,6 +62,7 @@ public: bool mIsOutgoing; bool mIsConference = false; LinphoneEnums::CallStatus mStatus; + QString mCallId; signals: void durationChanged(QString duration); diff --git a/Linphone/core/call-history/CallHistoryList.cpp b/Linphone/core/call-history/CallHistoryList.cpp index 11855fac..ca331dee 100644 --- a/Linphone/core/call-history/CallHistoryList.cpp +++ b/Linphone/core/call-history/CallHistoryList.cpp @@ -71,28 +71,35 @@ void CallHistoryList::setSelf(QSharedPointer me) { } mModelConnection->invokeToCore([this, callLogs]() { mustBeInMainThread(getClassName()); - resetData(); - add(*callLogs); - - /* - if (callLogs->size() > 0) { - int count = qMin(callLogs->size(), mMaxDisplayItems); - // QModelIndex firstIndex = index(0, 0); - beginInsertRows(QModelIndex(), 0, count - 1); - for (auto i : *callLogs) - mList << i.template objectCast(); - endInsertRows(); - // auto lastIndex = index(count - 1, 0); - // emit dataChanged(firstIndex, lastIndex); - }*/ + resetData(*callLogs); delete callLogs; }); }); }); mModelConnection->makeConnectToModel(&CoreModel::defaultAccountChanged, [this]() { mModelConnection->invokeToCore([this]() { lUpdate(); }); }); - mModelConnection->makeConnectToModel(&CoreModel::callLogUpdated, - [this]() { mModelConnection->invokeToCore([this]() { lUpdate(); }); }); + mModelConnection->makeConnectToModel( + &CoreModel::callLogUpdated, + [this](const std::shared_ptr &core, const std::shared_ptr &callLog) { + QSharedPointer *callLogs = new QSharedPointer[1]; + auto model = createCallHistoryCore(callLog); + callLogs[0] = model; + mModelConnection->invokeToCore([this, callLogs]() { + auto oldLog = std::find_if(mList.begin(), mList.end(), [callLogs](QSharedPointer log) { + return (*callLogs)->mCallId == log.objectCast()->mCallId; + }); + if (oldLog == mList.end()) { // New + prepend(*callLogs); + } else { // Update + qWarning() << log() + .arg("LinphoneCore::onCallLogUpdated has been call for an existant log which " + "should not be the " + "case. Check with the SDK. CallID=%1") + .arg((*callLogs)->mCallId); + } + delete[] callLogs; + }); + }); emit lUpdate(); } @@ -121,14 +128,3 @@ QVariant CallHistoryList::data(const QModelIndex &index, int role) const { } return QVariant(); } -/* -void CallHistoryList::displayMore() { - int oldCount = qMin(mList.size(), mDisplayCount); - int newCount = qMin(mList.size(), mDisplayCount + mDisplayStep); - if (newCount != oldCount) { - mDisplayCount = newCount; - beginInsertRows(QModelIndex(), oldCount, mDisplayCount - 1); - endInsertRows(); - } -} -*/ diff --git a/Linphone/core/call-history/CallHistoryProxy.cpp b/Linphone/core/call-history/CallHistoryProxy.cpp index 4d839b8f..9a01529b 100644 --- a/Linphone/core/call-history/CallHistoryProxy.cpp +++ b/Linphone/core/call-history/CallHistoryProxy.cpp @@ -47,10 +47,6 @@ void CallHistoryProxy::removeEntriesWithFilter() { } } -void CallHistoryProxy::updateView() { - mHistoryList->lUpdate(); -} - //------------------------------------------------------------------------------------------ bool CallHistoryProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { diff --git a/Linphone/core/call-history/CallHistoryProxy.hpp b/Linphone/core/call-history/CallHistoryProxy.hpp index 8bbb5d63..afe8fd6e 100644 --- a/Linphone/core/call-history/CallHistoryProxy.hpp +++ b/Linphone/core/call-history/CallHistoryProxy.hpp @@ -39,7 +39,6 @@ public: Q_INVOKABLE void removeAllEntries(); Q_INVOKABLE void removeEntriesWithFilter(); - Q_INVOKABLE void updateView(); protected: QSharedPointer mHistoryList; diff --git a/Linphone/core/call/CallList.cpp b/Linphone/core/call/CallList.cpp index 1adefddd..a0f03003 100644 --- a/Linphone/core/call/CallList.cpp +++ b/Linphone/core/call/CallList.cpp @@ -71,8 +71,7 @@ void CallList::setSelf(QSharedPointer me) { } mModelConnection->invokeToCore([this, calls, currentCallCore]() { mustBeInMainThread(getClassName()); - resetData(); - add(*calls); + resetData(*calls); setHaveCall(calls->size() > 0); setCurrentCall(currentCallCore); delete calls; diff --git a/Linphone/core/conference/ConferenceInfoList.cpp b/Linphone/core/conference/ConferenceInfoList.cpp index ce5e9770..a73507fb 100644 --- a/Linphone/core/conference/ConferenceInfoList.cpp +++ b/Linphone/core/conference/ConferenceInfoList.cpp @@ -67,9 +67,8 @@ void ConferenceInfoList::setSelf(QSharedPointer me) { } mCoreModelConnection->invokeToCore([this, items]() { mustBeInMainThread(getClassName()); - resetData(); int currentDateIndex = sort(*items); - add(*items); + resetData(*items); updateHaveCurrentDate(); if (mLastConfInfoInserted) { int index = -1; diff --git a/Linphone/core/participant/ParticipantDeviceList.cpp b/Linphone/core/participant/ParticipantDeviceList.cpp index c33c2003..13869bbb 100644 --- a/Linphone/core/participant/ParticipantDeviceList.cpp +++ b/Linphone/core/participant/ParticipantDeviceList.cpp @@ -74,8 +74,7 @@ QSharedPointer ParticipantDeviceList::getMe() const { void ParticipantDeviceList::setDevices(QList> devices) { mustBeInMainThread(log().arg(Q_FUNC_INFO)); - resetData(); - add(devices); + resetData(devices); lDebug() << log().arg("Add %1 devices").arg(devices.size()); } diff --git a/Linphone/core/participant/ParticipantList.cpp b/Linphone/core/participant/ParticipantList.cpp index 00798318..c9c56102 100644 --- a/Linphone/core/participant/ParticipantList.cpp +++ b/Linphone/core/participant/ParticipantList.cpp @@ -70,8 +70,7 @@ void ParticipantList::setSelf(QSharedPointer me) { participantList->push_back(meModel); mConferenceModelConnection->invokeToCore([this, participantList]() { mustBeInMainThread(getClassName()); - resetData(); - add(*participantList); + resetData(*participantList); delete participantList; }); }); diff --git a/Linphone/core/payload-type/PayloadTypeList.cpp b/Linphone/core/payload-type/PayloadTypeList.cpp index 60710f00..3e09e747 100644 --- a/Linphone/core/payload-type/PayloadTypeList.cpp +++ b/Linphone/core/payload-type/PayloadTypeList.cpp @@ -67,8 +67,7 @@ void PayloadTypeList::setSelf(QSharedPointer me) { } mModelConnection->invokeToCore([this, payloadTypes]() { mustBeInMainThread(getClassName()); - resetData(); - add(*payloadTypes); + resetData(*payloadTypes); delete payloadTypes; }); }); diff --git a/Linphone/core/phone-number/PhoneNumberList.cpp b/Linphone/core/phone-number/PhoneNumberList.cpp index 3c8bd7c6..a3287ae7 100644 --- a/Linphone/core/phone-number/PhoneNumberList.cpp +++ b/Linphone/core/phone-number/PhoneNumberList.cpp @@ -48,8 +48,7 @@ PhoneNumberList::PhoneNumberList(QObject *parent) : ListProxy(parent) { // Invoke for adding stuffs in caller thread QMetaObject::invokeMethod(this, [this, numbers]() { mustBeInMainThread(this->log().arg(Q_FUNC_INFO)); - resetData(); - add(*numbers); + resetData(*numbers); delete numbers; }); }); diff --git a/Linphone/core/proxy/AbstractListProxy.hpp b/Linphone/core/proxy/AbstractListProxy.hpp index f1c0b6b4..222300ea 100644 --- a/Linphone/core/proxy/AbstractListProxy.hpp +++ b/Linphone/core/proxy/AbstractListProxy.hpp @@ -35,9 +35,9 @@ public: virtual ~AbstractListProxy() { clearData(); } - + virtual int rowCount(const QModelIndex &index = QModelIndex()) const override { - return getDisplayCount(mList.size()); + return mList.size(); } virtual QHash roleNames() const override { @@ -45,7 +45,7 @@ public: roles[Qt::DisplayRole] = "$modelData"; return roles; } - + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override { int row = index.row(); if (!index.isValid() || row < 0 || row >= mList.count()) return QVariant(); @@ -61,31 +61,23 @@ public: // Add functions virtual void add(T item) { int row = rowCount(); - if (mMaxDisplayItems > 0 && row + 1 >= mMaxDisplayItems) {// New item is not in display range - mList << item; - }else{ - beginInsertRows(QModelIndex(), row, row); - mList << item; - endInsertRows(); - auto lastIndex = index(mList.size() - 1, 0); - emit dataChanged(lastIndex, lastIndex); - } - + beginInsertRows(QModelIndex(), row, row); + mList << item; + endInsertRows(); + auto lastIndex = index(mList.size() - 1, 0); + emit dataChanged(lastIndex, lastIndex); } virtual void add(QList items) { int count = items.size(); - if (count > 0 ) { + if (count > 0) { int currentCount = rowCount(); - int newCount = getDisplayCount(mList.size() + count); - if(newCount != currentCount){ - beginInsertRows(QModelIndex(), currentCount, newCount - 1); - mList << items; - endInsertRows(); - QModelIndex firstIndex = currentCount > 0 ? index(currentCount-1, 0) : index(0, 0); - auto lastIndex = index(newCount - 1, 0); - emit dataChanged(firstIndex, lastIndex); - }else - mList << items; + int newCount = mList.size() + count; + beginInsertRows(QModelIndex(), currentCount, newCount - 1); + mList << items; + endInsertRows(); + QModelIndex firstIndex = currentCount > 0 ? index(currentCount - 1, 0) : index(0, 0); + auto lastIndex = index(newCount - 1, 0); + emit dataChanged(firstIndex, lastIndex); } } @@ -94,9 +86,6 @@ public: beginInsertRows(QModelIndex(), 0, 0); mList.prepend(item); endInsertRows(); - if(mMaxDisplayItems > 0 && currentCount + 1 >= mMaxDisplayItems){ - setMaxDisplayItems(mMaxDisplayItems+1); - } emit dataChanged(index(0), index(0)); } @@ -109,9 +98,6 @@ public: items << mList; mList = items; endInsertRows(); - if(mMaxDisplayItems > 0 && newCount >= mMaxDisplayItems){ - setMaxDisplayItems(newCount); - } emit dataChanged(index(0), index(items.size() - 1)); } } @@ -133,24 +119,23 @@ public: virtual void clearData() override { mList.clear(); - setMaxDisplayItems(getInitialDisplayItems()); } - virtual void resetData() override { + virtual void resetData(QList newData = QList()) { beginResetModel(); - clearData(); + mList = newData; endResetModel(); } -/* - void displayMore() { - int oldCount = rowCount(); - int newCount = getDisplayCount(oldCount + mList.size(), mMaxDisplayItems + mDisplayItemsStep); - if (newCount != oldCount) { - setMaxDisplayItems(newCount); - beginInsertRows(QModelIndex(), oldCount, newCount - 1); - endInsertRows(); - } - }*/ + /* + void displayMore() { + int oldCount = rowCount(); + int newCount = getDisplayCount(oldCount + mList.size(), mMaxDisplayItems + mDisplayItemsStep); + if (newCount != oldCount) { + setMaxDisplayItems(newCount); + beginInsertRows(QModelIndex(), oldCount, newCount - 1); + endInsertRows(); + } + }*/ protected: QList mList; diff --git a/Linphone/core/proxy/LimitProxy.cpp b/Linphone/core/proxy/LimitProxy.cpp index 52d323df..2c2e7bee 100644 --- a/Linphone/core/proxy/LimitProxy.cpp +++ b/Linphone/core/proxy/LimitProxy.cpp @@ -38,8 +38,9 @@ bool LimitProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent void LimitProxy::setSourceModels(SortFilterProxy *firstList) { auto secondList = firstList->sourceModel(); - connect(secondList, &QAbstractItemModel::rowsInserted, this, &LimitProxy::invalidateFilter); - connect(secondList, &QAbstractItemModel::rowsRemoved, this, &LimitProxy::invalidateFilter); + connect(secondList, &QAbstractItemModel::rowsInserted, this, &LimitProxy::onAdded); + connect(secondList, &QAbstractItemModel::rowsRemoved, this, &LimitProxy::onRemoved); + connect(secondList, &QAbstractItemModel::modelReset, this, &LimitProxy::invalidateRowsFilter); connect(firstList, &SortFilterProxy::filterTextChanged, this, &LimitProxy::filterTextChanged); connect(firstList, &SortFilterProxy::filterTypeChanged, this, &LimitProxy::filterTypeChanged); @@ -149,3 +150,15 @@ void LimitProxy::displayMore() { setMaxDisplayItems(mMaxDisplayItems + mDisplayItemsStep); } } + +void LimitProxy::onAdded() { + int count = sourceModel()->rowCount(); + if (mMaxDisplayItems > 0 && mMaxDisplayItems <= count) setMaxDisplayItems(mMaxDisplayItems + 1); +} + +void LimitProxy::onRemoved() { + int count = sourceModel()->rowCount(); + if (mMaxDisplayItems > 0 && mMaxDisplayItems <= count) { + invalidateFilter(); + } +} diff --git a/Linphone/core/proxy/LimitProxy.hpp b/Linphone/core/proxy/LimitProxy.hpp index b4c329b9..eb4ed190 100644 --- a/Linphone/core/proxy/LimitProxy.hpp +++ b/Linphone/core/proxy/LimitProxy.hpp @@ -80,6 +80,9 @@ public: virtual void setFilterType(int filterType); //------------------------------------------------------------- + void onAdded(); + void onRemoved(); + int mInitialDisplayItems = -1; int mMaxDisplayItems = -1; int mDisplayItemsStep = 5; diff --git a/Linphone/core/proxy/ListProxy.hpp b/Linphone/core/proxy/ListProxy.hpp index de687763..78fdc51e 100644 --- a/Linphone/core/proxy/ListProxy.hpp +++ b/Linphone/core/proxy/ListProxy.hpp @@ -64,20 +64,16 @@ public: template void add(QList> items) { int count = items.size(); - if (count > 0 ) { + if (count > 0) { int currentCount = rowCount(); - int newCount = getDisplayCount(mList.size() + count); - if(newCount != currentCount){ - beginInsertRows(QModelIndex(), currentCount, newCount - 1); - for (auto i : items) - mList << i.template objectCast(); - endInsertRows(); - QModelIndex firstIndex = currentCount > 0 ? index(currentCount-1, 0) : index(0, 0); - auto lastIndex = index(newCount - 1, 0); - emit dataChanged(firstIndex, lastIndex); - }else - for (auto i : items) - mList << i.template objectCast(); + int newCount = mList.size() + count; + beginInsertRows(QModelIndex(), currentCount, newCount - 1); + for (auto i : items) + mList << i.template objectCast(); + endInsertRows(); + QModelIndex firstIndex = currentCount > 0 ? index(currentCount - 1, 0) : index(0, 0); + auto lastIndex = index(newCount - 1, 0); + emit dataChanged(firstIndex, lastIndex); } } @@ -91,6 +87,15 @@ public: AbstractListProxy>::prepend(items); } + template + void resetData(QList> items) { + beginResetModel(); + mList.clear(); + for (auto i : items) + mList << i.template objectCast(); + endResetModel(); + } + virtual bool remove(QObject *itemToRemove) override { bool removed = false; if (itemToRemove) { diff --git a/Linphone/core/proxy/Proxy.cpp b/Linphone/core/proxy/Proxy.cpp index 26423554..bb1a31b2 100644 --- a/Linphone/core/proxy/Proxy.cpp +++ b/Linphone/core/proxy/Proxy.cpp @@ -29,52 +29,9 @@ int Proxy::getCount() const { return rowCount(); } -int Proxy::getDisplayCount(int listCount) const { - return mMaxDisplayItems >= 0 ? qMin(listCount, mMaxDisplayItems) : listCount; -} - bool Proxy::remove(QObject *itemToRemove) { return false; } void Proxy::clearData() { } - -void Proxy::resetData() { -} - -int Proxy::getInitialDisplayItems() const { - return mInitialDisplayItems; -} - -void Proxy::setInitialDisplayItems(int initialItems) { - if (mInitialDisplayItems != initialItems) { - mInitialDisplayItems = initialItems; - if(getMaxDisplayItems() == -1) - setMaxDisplayItems(initialItems); - emit initialDisplayItemsChanged(); - } -} - -int Proxy::getMaxDisplayItems() const { - return mMaxDisplayItems; -} -void Proxy::setMaxDisplayItems(int maxItems) { - if (mMaxDisplayItems != maxItems) { - mMaxDisplayItems = maxItems; - if( getInitialDisplayItems() == -1) - setInitialDisplayItems(maxItems); - emit maxDisplayItemsChanged(); - } -} - -int Proxy::getDisplayItemsStep() const { - return mDisplayItemsStep; -} - -void Proxy::setDisplayItemsStep(int step) { - if (mDisplayItemsStep != step) { - mDisplayItemsStep = step; - emit displayItemsStepChanged(); - } -} diff --git a/Linphone/core/proxy/Proxy.hpp b/Linphone/core/proxy/Proxy.hpp index 4759a1c9..a193aed0 100644 --- a/Linphone/core/proxy/Proxy.hpp +++ b/Linphone/core/proxy/Proxy.hpp @@ -30,35 +30,14 @@ class Proxy : public QAbstractListModel { public: Q_PROPERTY(int count READ getCount NOTIFY countChanged) Q_PROPERTY(int length READ getCount NOTIFY countChanged) - Q_PROPERTY(int initialDisplayItems READ getInitialDisplayItems WRITE setInitialDisplayItems NOTIFY initialDisplayItemsChanged) - Q_PROPERTY(int maxDisplayItems READ getMaxDisplayItems WRITE setMaxDisplayItems NOTIFY maxDisplayItemsChanged) - Q_PROPERTY(int displayItemsStep READ getDisplayItemsStep WRITE setDisplayItemsStep NOTIFY displayItemsStepChanged) Proxy(QObject *parent = nullptr); Q_INVOKABLE virtual int getCount() const; - int getDisplayCount(int listCount) const; Q_INVOKABLE virtual bool remove(QObject *itemToRemove); Q_INVOKABLE virtual void clearData(); - Q_INVOKABLE virtual void resetData(); - - int getInitialDisplayItems() const; - void setInitialDisplayItems(int initialItems); - - int getMaxDisplayItems() const; - void setMaxDisplayItems(int maxItems); - - int getDisplayItemsStep() const; - void setDisplayItemsStep(int step); - - int mInitialDisplayItems = -1; - int mMaxDisplayItems = -1; - int mDisplayItemsStep = -1; signals: void countChanged(); - void initialDisplayItemsChanged(); - void maxDisplayItemsChanged(); - void displayItemsStepChanged(); }; #endif diff --git a/Linphone/core/proxy/SortFilterProxy.cpp b/Linphone/core/proxy/SortFilterProxy.cpp index 480fc7db..c063e521 100644 --- a/Linphone/core/proxy/SortFilterProxy.cpp +++ b/Linphone/core/proxy/SortFilterProxy.cpp @@ -19,7 +19,7 @@ */ #include "SortFilterProxy.hpp" -#include "Proxy.hpp" + SortFilterProxy::SortFilterProxy(QAbstractItemModel *list) : QSortFilterProxyModel(list) { connect(this, &SortFilterProxy::rowsInserted, this, &SortFilterProxy::countChanged); connect(this, &SortFilterProxy::rowsRemoved, this, &SortFilterProxy::countChanged); @@ -43,7 +43,6 @@ void SortFilterProxy::deleteSourceModel() { } void SortFilterProxy::setSourceModel(QAbstractItemModel *model) { - auto listModel = dynamic_cast(model); auto oldSourceModel = sourceModel(); if (oldSourceModel) disconnect(oldSourceModel); QSortFilterProxyModel::setSourceModel(model); diff --git a/Linphone/core/search/MagicSearchList.cpp b/Linphone/core/search/MagicSearchList.cpp index 30518e8b..0dd2ab3f 100644 --- a/Linphone/core/search/MagicSearchList.cpp +++ b/Linphone/core/search/MagicSearchList.cpp @@ -142,12 +142,11 @@ void MagicSearchList::setResults(const QList> &contac if (!isFriendCore) continue; disconnect(isFriendCore.get()); } - resetData(); + resetData(contacts); for (auto it : contacts) { connect(it.get(), &FriendCore::removed, this, qOverload(&MagicSearchList::remove)); connect(it.get(), &FriendCore::starredChanged, this, [this] { lSearch(mSearchFilter); }); } - add(contacts); } void MagicSearchList::addResult(const QSharedPointer &contact) { diff --git a/Linphone/core/timezone/TimeZoneList.cpp b/Linphone/core/timezone/TimeZoneList.cpp index dd247ba8..50466535 100644 --- a/Linphone/core/timezone/TimeZoneList.cpp +++ b/Linphone/core/timezone/TimeZoneList.cpp @@ -46,17 +46,18 @@ TimeZoneList::~TimeZoneList() { // ----------------------------------------------------------------------------- void TimeZoneList::initTimeZones() { - resetData(); + QList> models; for (auto id : QTimeZone::availableTimeZoneIds()) { auto model = QSharedPointer::create(QTimeZone(id)); if (std::find_if(mList.begin(), mList.end(), [id](const QSharedPointer &a) { return a.objectCast()->getTimeZone() == QTimeZone(id); }) == mList.end()) { if (model->getCountryName().toUpper() != "DEFAULT") { - add(model); + models << model; } } } + resetData(models); } QHash TimeZoneList::roleNames() const { diff --git a/Linphone/view/Page/Form/Call/NewCallForm.qml b/Linphone/view/Page/Form/Call/NewCallForm.qml index 8479af59..b1b946e4 100644 --- a/Linphone/view/Page/Form/Call/NewCallForm.qml +++ b/Linphone/view/Page/Form/Call/NewCallForm.qml @@ -70,6 +70,7 @@ FocusScope { id: grouCallButton visible: mainItem.groupCallVisible && !SettingsCpp.disableMeetingsFeature Layout.preferredWidth: 320 * DefaultStyle.dp + Layout.preferredHeight: 44 * DefaultStyle.dp padding: 0 KeyNavigation.up: searchBar KeyNavigation.down: contactList.count >0 ? contactList : searchList @@ -85,7 +86,6 @@ FocusScope { } contentItem: RowLayout { spacing: 16 * DefaultStyle.dp - anchors.verticalCenter: parent.verticalCenter Image { source: AppIcons.groupCall Layout.preferredWidth: 44 * DefaultStyle.dp diff --git a/Linphone/view/Page/Layout/Main/MainLayout.qml b/Linphone/view/Page/Layout/Main/MainLayout.qml index 75507bb9..7ab602a6 100644 --- a/Linphone/view/Page/Layout/Main/MainLayout.qml +++ b/Linphone/view/Page/Layout/Main/MainLayout.qml @@ -617,7 +617,7 @@ Item { Connections { target: mainItem function onOpenNewCallRequest(){ callPage.goToNewCall()} - function onCallCreated(){ callPage.resetLeftPanel()} + function onCallCreated(){ callPage.goToCallHistory()} function onOpenCallHistory(){ callPage.goToCallHistory()} function onOpenNumPadRequest(){ callPage.openNumPadRequest()} } diff --git a/Linphone/view/Page/Main/Call/CallPage.qml b/Linphone/view/Page/Main/Call/CallPage.qml index c348ffc5..92f8de38 100644 --- a/Linphone/view/Page/Main/Call/CallPage.qml +++ b/Linphone/view/Page/Main/Call/CallPage.qml @@ -17,7 +17,7 @@ AbstractMainPage { signal listViewUpdated() onVisibleChanged: if (!visible) { - resetLeftPanel() + goToCallHistory() } //Group call properties @@ -53,10 +53,6 @@ AbstractMainPage { showDefaultItem: listStackView.currentItem && listStackView.currentItem.listView && listStackView.currentItem.listView.count === 0 && listStackView.currentItem.listView.model.sourceModel.count === 0 || false - function resetLeftPanel() { - listStackView.clear() - listStackView.push(listStackView.initialItem) - } function goToNewCall() { if (listStackView.currentItem && listStackView.currentItem.objectName != "newCallItem") listStackView.push(newCallItem) } @@ -197,6 +193,7 @@ AbstractMainPage { Component { id: historyListItem FocusScope{ + objectName: "historyListItem" Control.StackView.onActivated: titleLoader.sourceComponent = historyListTitle ColumnLayout { anchors.fill: parent @@ -246,7 +243,9 @@ AbstractMainPage { onFilterTextChanged: maxDisplayItems = initialDisplayItems initialDisplayItems: historyListView.height / (56 * DefaultStyle.dp) + 5 displayItemsStep: initialDisplayItems / 2 + onCountChanged: console.log("callHistoryProxy : " +count) } + Component.onCompleted: console.log("historyListView completed") cacheBuffer: contentHeight>0 ? contentHeight : 0// cache all items flickDeceleration: 10000 spacing: 10 * DefaultStyle.dp @@ -276,6 +275,7 @@ AbstractMainPage { anchors.topMargin: 5 * DefaultStyle.dp anchors.bottomMargin: 5 * DefaultStyle.dp visible: !!modelData + Component.onCompleted: console.log(index + " => Completed "+visible) RowLayout { z: 1 anchors.fill: parent @@ -405,13 +405,6 @@ AbstractMainPage { onVisibleChanged: { if (!visible) currentIndex = -1 } - - Connections { - target: mainItem - function onListViewUpdated() { - historyListView.model.updateView() - } - } Control.ScrollBar.vertical: scrollbar } }