From e361a6a6027e48f7ade5a9e13f97084b2297fc19 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Fri, 6 Jan 2017 09:23:43 +0100 Subject: [PATCH] feat(app): many fixes and better cmake file --- tests/CMakeLists.txt | 12 +++++------- tests/src/components/chat/ChatProxyModel.cpp | 4 ++-- tests/src/components/chat/ChatProxyModel.hpp | 10 +++++++--- tests/ui/modules/Linphone/Chat/Chat.qml | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 14aca3a33..883fd8cce 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.1) project(linphone) -set(LINPHONE_EXEC linphone) +set(LINPHONE_EXEC linphone-qt) set(CMAKE_CXX_STANDARD 11) # Use automatically moc from Qt5. @@ -46,11 +46,9 @@ foreach (package ${QT5_PACKAGES}) endif () endforeach () -list(APPEND LIBS "${CMAKE_SOURCE_DIR}/../OUTPUT/desktop/lib64/liblinphone.so") +find_package(Linphone REQUIRED) + list(APPEND LIBS "${CMAKE_SOURCE_DIR}/../OUTPUT/desktop/lib64/liblinphone++.so") -list(APPEND LIBS "${CMAKE_SOURCE_DIR}/../OUTPUT/desktop/lib64/libbelcard.so") -list(APPEND LIBS "${CMAKE_SOURCE_DIR}/../OUTPUT/desktop/lib64/libbellesip.so") -list(APPEND LIBS "${CMAKE_SOURCE_DIR}/../OUTPUT/desktop/lib64/libbctoolbox.so") set(SOURCES src/app/App.cpp @@ -180,6 +178,6 @@ add_executable(${LINPHONE_EXEC} ${SOURCES} ${HEADERS} ${RESOURCES}) add_dependencies(${LINPHONE_EXEC} update_translations) add_dependencies(update_translations check_qml) -target_include_directories(${LINPHONE_EXEC} SYSTEM PRIVATE "${CMAKE_SOURCE_DIR}/../OUTPUT/desktop/include/") +target_include_directories(${LINPHONE_EXEC} SYSTEM PRIVATE "${LINPHONE_INCLUDE_DIRS}") -target_link_libraries(${LINPHONE_EXEC} ${LIBS}) +target_link_libraries(${LINPHONE_EXEC} ${LIBS} ${LINPHONE_LIBRARIES}) diff --git a/tests/src/components/chat/ChatProxyModel.cpp b/tests/src/components/chat/ChatProxyModel.cpp index 7fc845e80..c1e966308 100644 --- a/tests/src/components/chat/ChatProxyModel.cpp +++ b/tests/src/components/chat/ChatProxyModel.cpp @@ -18,7 +18,7 @@ bool ChatModelFilter::filterAcceptsRow (int source_row, const QModelIndex &) con void ChatModelFilter::setEntryTypeFilter (ChatModel::EntryType type) { m_entry_type_filter = type; - invalidateFilter(); + invalidate(); } // ============================================================================= @@ -49,7 +49,7 @@ void ChatProxyModel::loadMoreEntries () { } void ChatProxyModel::setEntryTypeFilter (ChatModel::EntryType type) { - if (m_chat_model_filter.m_entry_type_filter != type) { + if (m_chat_model_filter.getEntryTypeFilter() != type) { m_chat_model_filter.setEntryTypeFilter(type); emit entryTypeFilterChanged(type); } diff --git a/tests/src/components/chat/ChatProxyModel.hpp b/tests/src/components/chat/ChatProxyModel.hpp index 2fd0cc14a..4b6f5ece0 100644 --- a/tests/src/components/chat/ChatProxyModel.hpp +++ b/tests/src/components/chat/ChatProxyModel.hpp @@ -12,18 +12,21 @@ // Cannot be used as a nested class by Qt and `Q_OBJECT` macro // must be used in header c++ file. class ChatModelFilter : public QSortFilterProxyModel { - friend class ChatProxyModel; Q_OBJECT; public: ChatModelFilter (QObject *parent = Q_NULLPTR); + ChatModel::EntryType getEntryTypeFilter () { + return m_entry_type_filter; + } + + void setEntryTypeFilter (ChatModel::EntryType type); + protected: bool filterAcceptsRow (int source_row, const QModelIndex &parent) const override; private: - void setEntryTypeFilter (ChatModel::EntryType type); - ChatModel m_chat_model; ChatModel::EntryType m_entry_type_filter = ChatModel::EntryType::GenericEntry; }; @@ -58,6 +61,7 @@ public: signals: void sipAddressChanged (const QString &sipAddress); void moreEntriesLoaded (int n); + void entryTypeFilterChanged (ChatModel::EntryType type); protected: diff --git a/tests/ui/modules/Linphone/Chat/Chat.qml b/tests/ui/modules/Linphone/Chat/Chat.qml index e911d8a32..68c3c394d 100644 --- a/tests/ui/modules/Linphone/Chat/Chat.qml +++ b/tests/ui/modules/Linphone/Chat/Chat.qml @@ -184,7 +184,7 @@ ColumnLayout { _tryToLoadMoreEntries = false } - // Received only if more entries was loaded. + // Received only if more entries were loaded. proxyModel.moreEntriesLoaded.connect(function (n) { positionViewAtIndex(n - 1, ListView.Beginning) _tryToLoadMoreEntries = false