From 7bcc90c38ffbe9e07332524545e7d607cca0b686 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 1 Dec 2016 11:26:55 +0100 Subject: [PATCH] feat(app): force the usage of `override` keyword --- tests/CMakeLists.txt | 2 ++ tests/src/components/chat/ChatModel.hpp | 8 ++++---- tests/src/components/chat/ChatProxyModel.hpp | 4 ++-- tests/src/components/contacts/ContactsListModel.hpp | 8 ++++---- tests/src/components/contacts/ContactsListProxyModel.hpp | 4 ++-- tests/src/components/timeline/TimelineModel.hpp | 6 +++--- tests/ui/views/App/Calls/Calls.qml | 1 + 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0f9144f42..5b07992f2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,6 +25,8 @@ set(CUSTOM_FLAGS "\ -Wpointer-arith \ -Wuninitialized \ -Wunused \ +-Wsuggest-override \ +-Werror=suggest-override \ ") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CUSTOM_FLAGS}") diff --git a/tests/src/components/chat/ChatModel.hpp b/tests/src/components/chat/ChatModel.hpp index e5fd948c0..02e945f7d 100644 --- a/tests/src/components/chat/ChatModel.hpp +++ b/tests/src/components/chat/ChatModel.hpp @@ -47,13 +47,13 @@ public: ChatModel (QObject *parent = Q_NULLPTR) : QAbstractListModel(parent) {} - int rowCount (const QModelIndex &index = QModelIndex()) const; + int rowCount (const QModelIndex &index = QModelIndex()) const override; - QHash roleNames () const; - QVariant data (const QModelIndex &index, int role) const; + QHash roleNames () const override; + QVariant data (const QModelIndex &index, int role) const override; bool removeRow (int row, const QModelIndex &parent = QModelIndex()); - bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()); + bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override; public slots: void removeEntry (int id); diff --git a/tests/src/components/chat/ChatProxyModel.hpp b/tests/src/components/chat/ChatProxyModel.hpp index e0054c0f4..c4f9b43f3 100644 --- a/tests/src/components/chat/ChatProxyModel.hpp +++ b/tests/src/components/chat/ChatProxyModel.hpp @@ -19,7 +19,7 @@ public: ChatModelFilter (QObject *parent = Q_NULLPTR); protected: - bool filterAcceptsRow (int source_row, const QModelIndex &parent) const; + bool filterAcceptsRow (int source_row, const QModelIndex &parent) const override; private: void setEntryTypeFilter (ChatModel::EntryType type); @@ -60,7 +60,7 @@ public slots: } protected: - bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const; + bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override; private: QString getSipAddress () const { diff --git a/tests/src/components/contacts/ContactsListModel.hpp b/tests/src/components/contacts/ContactsListModel.hpp index 3f09033e6..d4d3decaa 100644 --- a/tests/src/components/contacts/ContactsListModel.hpp +++ b/tests/src/components/contacts/ContactsListModel.hpp @@ -16,13 +16,13 @@ class ContactsListModel : public QAbstractListModel { public: ContactsListModel (QObject *parent = Q_NULLPTR); - int rowCount (const QModelIndex &index = QModelIndex()) const; + int rowCount (const QModelIndex &index = QModelIndex()) const override; - QHash roleNames () const; - QVariant data (const QModelIndex &index, int role) const; + QHash roleNames () const override; + QVariant data (const QModelIndex &index, int role) const override; bool removeRow (int row, const QModelIndex &parent = QModelIndex()); - bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()); + bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override; public slots: // See: http://doc.qt.io/qt-5/qtqml-cppintegration-data.html#data-ownership diff --git a/tests/src/components/contacts/ContactsListProxyModel.hpp b/tests/src/components/contacts/ContactsListProxyModel.hpp index 57511983d..77bf673e8 100644 --- a/tests/src/components/contacts/ContactsListProxyModel.hpp +++ b/tests/src/components/contacts/ContactsListProxyModel.hpp @@ -30,8 +30,8 @@ public slots: } protected: - bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const; - bool lessThan (const QModelIndex &left, const QModelIndex &right) const; + bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override; + bool lessThan (const QModelIndex &left, const QModelIndex &right) const override; private: float computeStringWeight (const QString &string, float percentage) const; diff --git a/tests/src/components/timeline/TimelineModel.hpp b/tests/src/components/timeline/TimelineModel.hpp index 432f9ef46..30bb1eb83 100644 --- a/tests/src/components/timeline/TimelineModel.hpp +++ b/tests/src/components/timeline/TimelineModel.hpp @@ -13,9 +13,9 @@ class TimelineModel : public QAbstractListModel { public: TimelineModel (const ContactsListModel *contacts_list); - int rowCount (const QModelIndex &) const; - QHash roleNames () const; - QVariant data (const QModelIndex &index, int role) const; + int rowCount (const QModelIndex &) const override; + QHash roleNames () const override; + QVariant data (const QModelIndex &index, int role) const override; private: void init_entries (); diff --git a/tests/ui/views/App/Calls/Calls.qml b/tests/ui/views/App/Calls/Calls.qml index 7ec75df7a..3e581d260 100644 --- a/tests/ui/views/App/Calls/Calls.qml +++ b/tests/ui/views/App/Calls/Calls.qml @@ -86,6 +86,7 @@ Window { childA: AbstractCall { anchors.fill: parent callTypeLabel: 'INCOMING VIDEO CALL' + sipAddress: 'sip:erwan.croze@sip.linphone.org' } childB: Rectangle {