From b97b823fa607c9aee4403489d278685229ca2d6b Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Fri, 25 Nov 2016 17:52:55 +0100 Subject: [PATCH] unstable --- tests/assets/languages/en.ts | 4 ++-- tests/assets/languages/fr.ts | 4 ++-- tests/src/components/chat/ChatModel.hpp | 5 +++-- tests/src/components/chat/ChatProxyModel.cpp | 8 ++++++++ tests/src/components/chat/ChatProxyModel.hpp | 4 ++++ tests/src/components/contacts/ContactsListProxyModel.cpp | 8 +++++--- tests/src/components/contacts/ContactsListProxyModel.hpp | 2 +- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/tests/assets/languages/en.ts b/tests/assets/languages/en.ts index 251a18aff..e9e137d57 100644 --- a/tests/assets/languages/en.ts +++ b/tests/assets/languages/en.ts @@ -184,11 +184,11 @@ lostIncomingCall - Lost incoming call + Lost incoming call lostOutgoingCall - Lost outgoing call + Lost outgoing call endCall diff --git a/tests/assets/languages/fr.ts b/tests/assets/languages/fr.ts index 945d1f9af..dbd28d575 100644 --- a/tests/assets/languages/fr.ts +++ b/tests/assets/languages/fr.ts @@ -184,11 +184,11 @@ lostIncomingCall - Appel entrant manqué + Appel entrant manqué lostOutgoingCall - Appel sortant manqué + Appel sortant manqué endCall diff --git a/tests/src/components/chat/ChatModel.hpp b/tests/src/components/chat/ChatModel.hpp index 4df253047..2bea6cd1b 100644 --- a/tests/src/components/chat/ChatModel.hpp +++ b/tests/src/components/chat/ChatModel.hpp @@ -22,12 +22,15 @@ signals: void sipAddressChanged (const QString &sipAddress); public: + typedef QPair > ChatEntryData; + enum Roles { ChatEntry = Qt::DisplayRole, SectionDate }; enum EntryType { + BaseEntry, MessageEntry, CallEntry }; @@ -57,8 +60,6 @@ public slots: void removeAllEntries (); private: - typedef QPair > ChatEntryData; - void fillMessageEntry ( QVariantMap &dest, const std::shared_ptr &message diff --git a/tests/src/components/chat/ChatProxyModel.cpp b/tests/src/components/chat/ChatProxyModel.cpp index 80173afa3..afeaa02ae 100644 --- a/tests/src/components/chat/ChatProxyModel.cpp +++ b/tests/src/components/chat/ChatProxyModel.cpp @@ -1,5 +1,6 @@ #include "ChatProxyModel.hpp" +#include // =================================================================== ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent) { @@ -9,5 +10,12 @@ ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent) } bool ChatProxyModel::filterAcceptsRow (int source_row, const QModelIndex &source_parent) const { + QModelIndex index = sourceModel()->index(source_row, 0, source_parent); + const QVariantMap &data = qvariant_cast( + index.data() + ); + + qDebug() << data["type"]; + return true; // TODO. } diff --git a/tests/src/components/chat/ChatProxyModel.hpp b/tests/src/components/chat/ChatProxyModel.hpp index be3a0198d..6ee61203d 100644 --- a/tests/src/components/chat/ChatProxyModel.hpp +++ b/tests/src/components/chat/ChatProxyModel.hpp @@ -26,6 +26,10 @@ public slots: return &m_chat_model; } + void setEntryTypeFilter (ChatModel::EntryType type) { + // TODO. + } + protected: bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const; diff --git a/tests/src/components/contacts/ContactsListProxyModel.cpp b/tests/src/components/contacts/ContactsListProxyModel.cpp index 281ad42bd..204cdb881 100644 --- a/tests/src/components/contacts/ContactsListProxyModel.cpp +++ b/tests/src/components/contacts/ContactsListProxyModel.cpp @@ -151,7 +151,9 @@ float ContactsListProxyModel::computeContactWeight (const ContactModel &contact) // ------------------------------------------------------------------- -void ContactsListProxyModel::setConnectedFilter (bool useConnectedFilter) { - m_use_connected_filter = useConnectedFilter; - invalidate(); +void ContactsListProxyModel::setConnectedFilter (bool use_connected_filter) { + if (use_connected_filter != m_use_connected_filter) { + m_use_connected_filter = use_connected_filter; + invalidate(); + } } diff --git a/tests/src/components/contacts/ContactsListProxyModel.hpp b/tests/src/components/contacts/ContactsListProxyModel.hpp index 7d65453a4..4021b362d 100644 --- a/tests/src/components/contacts/ContactsListProxyModel.hpp +++ b/tests/src/components/contacts/ContactsListProxyModel.hpp @@ -35,7 +35,7 @@ private: bool isConnectedFilterUsed () const { return m_use_connected_filter; } - void setConnectedFilter (bool useConnectedFilter); + void setConnectedFilter (bool use_connected_filter); static const QRegExp m_search_separators;