Commit e361a6a6 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(app): many fixes and better cmake file

parent 6b2a7a12
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 3.1)
project(linphone) project(linphone)
set(LINPHONE_EXEC linphone) set(LINPHONE_EXEC linphone-qt)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
# Use automatically moc from Qt5. # Use automatically moc from Qt5.
...@@ -46,11 +46,9 @@ foreach (package ${QT5_PACKAGES}) ...@@ -46,11 +46,9 @@ foreach (package ${QT5_PACKAGES})
endif () endif ()
endforeach () 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/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 set(SOURCES
src/app/App.cpp src/app/App.cpp
...@@ -180,6 +178,6 @@ add_executable(${LINPHONE_EXEC} ${SOURCES} ${HEADERS} ${RESOURCES}) ...@@ -180,6 +178,6 @@ add_executable(${LINPHONE_EXEC} ${SOURCES} ${HEADERS} ${RESOURCES})
add_dependencies(${LINPHONE_EXEC} update_translations) add_dependencies(${LINPHONE_EXEC} update_translations)
add_dependencies(update_translations check_qml) 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})
...@@ -18,7 +18,7 @@ bool ChatModelFilter::filterAcceptsRow (int source_row, const QModelIndex &) con ...@@ -18,7 +18,7 @@ bool ChatModelFilter::filterAcceptsRow (int source_row, const QModelIndex &) con
void ChatModelFilter::setEntryTypeFilter (ChatModel::EntryType type) { void ChatModelFilter::setEntryTypeFilter (ChatModel::EntryType type) {
m_entry_type_filter = type; m_entry_type_filter = type;
invalidateFilter(); invalidate();
} }
// ============================================================================= // =============================================================================
...@@ -49,7 +49,7 @@ void ChatProxyModel::loadMoreEntries () { ...@@ -49,7 +49,7 @@ void ChatProxyModel::loadMoreEntries () {
} }
void ChatProxyModel::setEntryTypeFilter (ChatModel::EntryType type) { 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); m_chat_model_filter.setEntryTypeFilter(type);
emit entryTypeFilterChanged(type); emit entryTypeFilterChanged(type);
} }
......
...@@ -12,18 +12,21 @@ ...@@ -12,18 +12,21 @@
// Cannot be used as a nested class by Qt and `Q_OBJECT` macro // Cannot be used as a nested class by Qt and `Q_OBJECT` macro
// must be used in header c++ file. // must be used in header c++ file.
class ChatModelFilter : public QSortFilterProxyModel { class ChatModelFilter : public QSortFilterProxyModel {
friend class ChatProxyModel;
Q_OBJECT; Q_OBJECT;
public: public:
ChatModelFilter (QObject *parent = Q_NULLPTR); ChatModelFilter (QObject *parent = Q_NULLPTR);
ChatModel::EntryType getEntryTypeFilter () {
return m_entry_type_filter;
}
void setEntryTypeFilter (ChatModel::EntryType type);
protected: protected:
bool filterAcceptsRow (int source_row, const QModelIndex &parent) const override; bool filterAcceptsRow (int source_row, const QModelIndex &parent) const override;
private: private:
void setEntryTypeFilter (ChatModel::EntryType type);
ChatModel m_chat_model; ChatModel m_chat_model;
ChatModel::EntryType m_entry_type_filter = ChatModel::EntryType::GenericEntry; ChatModel::EntryType m_entry_type_filter = ChatModel::EntryType::GenericEntry;
}; };
...@@ -58,6 +61,7 @@ public: ...@@ -58,6 +61,7 @@ public:
signals: signals:
void sipAddressChanged (const QString &sipAddress); void sipAddressChanged (const QString &sipAddress);
void moreEntriesLoaded (int n); void moreEntriesLoaded (int n);
void entryTypeFilterChanged (ChatModel::EntryType type); void entryTypeFilterChanged (ChatModel::EntryType type);
protected: protected:
......
...@@ -184,7 +184,7 @@ ColumnLayout { ...@@ -184,7 +184,7 @@ ColumnLayout {
_tryToLoadMoreEntries = false _tryToLoadMoreEntries = false
} }
// Received only if more entries was loaded. // Received only if more entries were loaded.
proxyModel.moreEntriesLoaded.connect(function (n) { proxyModel.moreEntriesLoaded.connect(function (n) {
positionViewAtIndex(n - 1, ListView.Beginning) positionViewAtIndex(n - 1, ListView.Beginning)
_tryToLoadMoreEntries = false _tryToLoadMoreEntries = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment