diff --git a/tests/src/components/chat/ChatModel.cpp b/tests/src/components/chat/ChatModel.cpp index 7b31ecfb4..133cc45d2 100644 --- a/tests/src/components/chat/ChatModel.cpp +++ b/tests/src/components/chat/ChatModel.cpp @@ -11,7 +11,7 @@ using namespace std; -// =================================================================== +// ============================================================================= QHash ChatModel::roleNames () const { QHash roles; @@ -62,7 +62,7 @@ bool ChatModel::removeRows (int row, int count, const QModelIndex &parent) { return true; } -// ------------------------------------------------------------------- +// ----------------------------------------------------------------------------- void ChatModel::removeEntry (int id) { qInfo() << QStringLiteral("Removing chat entry: %1 of %2.") @@ -85,7 +85,7 @@ void ChatModel::removeAllEntries () { endResetModel(); } -// ------------------------------------------------------------------- +// ----------------------------------------------------------------------------- void ChatModel::fillMessageEntry ( QVariantMap &dest, @@ -125,7 +125,7 @@ void ChatModel::fillCallEndEntry ( dest["isStart"] = false; } -// ------------------------------------------------------------------- +// ----------------------------------------------------------------------------- void ChatModel::removeEntry (ChatEntryData &pair) { int type = pair.first["type"].toInt(); diff --git a/tests/src/components/chat/ChatModel.hpp b/tests/src/components/chat/ChatModel.hpp index 02e945f7d..62b041fef 100644 --- a/tests/src/components/chat/ChatModel.hpp +++ b/tests/src/components/chat/ChatModel.hpp @@ -1,12 +1,12 @@ #ifndef CHAT_MODEL_H_ #define CHAT_MODEL_H_ -#include #include +#include -// =================================================================== +// ============================================================================= // Fetch all N messages of a ChatRoom. -// =================================================================== +// ============================================================================= class ChatModel : public QAbstractListModel { friend class ChatProxyModel; @@ -20,9 +20,6 @@ class ChatModel : public QAbstractListModel { NOTIFY sipAddressChanged ); -signals: - void sipAddressChanged (const QString &sipAddress); - public: typedef QPair > ChatEntryData; @@ -36,6 +33,7 @@ public: MessageEntry, CallEntry }; + Q_ENUM(EntryType); enum CallStatus { @@ -43,6 +41,7 @@ public: CallStatusMissed = linphone::CallStatusMissed, CallStatusSuccess = linphone::CallStatusSuccess }; + Q_ENUM(CallStatus); ChatModel (QObject *parent = Q_NULLPTR) : QAbstractListModel(parent) {} @@ -59,6 +58,9 @@ public slots: void removeEntry (int id); void removeAllEntries (); +signals: + void sipAddressChanged (const QString &sipAddress); + private: void fillMessageEntry ( QVariantMap &dest, diff --git a/tests/src/components/chat/ChatProxyModel.cpp b/tests/src/components/chat/ChatProxyModel.cpp index e8c213d66..a2007d2a7 100644 --- a/tests/src/components/chat/ChatProxyModel.cpp +++ b/tests/src/components/chat/ChatProxyModel.cpp @@ -1,6 +1,6 @@ #include "ChatProxyModel.hpp" -// =================================================================== +// ============================================================================= ChatModelFilter::ChatModelFilter (QObject *parent) : QSortFilterProxyModel(parent) { setSourceModel(&m_chat_model); @@ -11,9 +11,7 @@ bool ChatModelFilter::filterAcceptsRow (int source_row, const QModelIndex &) con return true; QModelIndex index = sourceModel()->index(source_row, 0, QModelIndex()); - const QVariantMap &data = qvariant_cast( - index.data() - ); + const QVariantMap &data = qvariant_cast(index.data()); return data["type"].toInt() == m_entry_type_filter; } @@ -23,7 +21,7 @@ void ChatModelFilter::setEntryTypeFilter (ChatModel::EntryType type) { invalidateFilter(); } -// =================================================================== +// ============================================================================= const unsigned int ChatProxyModel::ENTRIES_CHUNK_SIZE = 50; diff --git a/tests/src/components/chat/ChatProxyModel.hpp b/tests/src/components/chat/ChatProxyModel.hpp index dd9a2e1ec..ddb559acc 100644 --- a/tests/src/components/chat/ChatProxyModel.hpp +++ b/tests/src/components/chat/ChatProxyModel.hpp @@ -5,9 +5,9 @@ #include "ChatModel.hpp" -// =================================================================== +// ============================================================================= // Fetch the L last filtered chat entries. -// =================================================================== +// ============================================================================= // Cannot be used as a nested class by Qt and `Q_OBJECT` macro // must be used in header c++ file. @@ -28,7 +28,7 @@ private: ChatModel::EntryType m_entry_type_filter = ChatModel::EntryType::GenericEntry; }; -// =================================================================== +// ============================================================================= class ChatProxyModel : public QSortFilterProxyModel { Q_OBJECT; @@ -40,11 +40,6 @@ class ChatProxyModel : public QSortFilterProxyModel { NOTIFY sipAddressChanged ); -signals: - void sipAddressChanged (const QString &sipAddress); - void moreEntriesLoaded (int n); - void entryTypeFilterChanged (ChatModel::EntryType type); - public: ChatProxyModel (QObject *parent = Q_NULLPTR); @@ -59,6 +54,11 @@ public slots: static_cast(m_chat_model_filter.sourceModel())->removeAllEntries(); } +signals: + void sipAddressChanged (const QString &sipAddress); + void moreEntriesLoaded (int n); + void entryTypeFilterChanged (ChatModel::EntryType type); + protected: bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override; @@ -74,7 +74,6 @@ private: } ChatModelFilter m_chat_model_filter; - int m_n_max_displayed_entries = ENTRIES_CHUNK_SIZE; static const unsigned int ENTRIES_CHUNK_SIZE; diff --git a/tests/src/components/contact/ContactModel.cpp b/tests/src/components/contact/ContactModel.cpp index aa5fc3531..08c55c0ad 100644 --- a/tests/src/components/contact/ContactModel.cpp +++ b/tests/src/components/contact/ContactModel.cpp @@ -1,5 +1,3 @@ -#include - #include "../../app/App.hpp" #include "ContactModel.hpp" diff --git a/tests/src/components/contact/ContactModel.hpp b/tests/src/components/contact/ContactModel.hpp index 2700026d8..2bc787cc9 100644 --- a/tests/src/components/contact/ContactModel.hpp +++ b/tests/src/components/contact/ContactModel.hpp @@ -37,7 +37,7 @@ public slots: } void abortEdit () { - // TODO. + // TODO: call linphone friend abort function. // m_linphone_friend->abort(); }