feat(app): many fixes and better cmake file

This commit is contained in:
Ronan Abhamon 2017-01-06 09:23:43 +01:00
parent 6b2a7a12e4
commit e361a6a602
4 changed files with 15 additions and 13 deletions

View file

@ -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})

View file

@ -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);
}

View file

@ -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:

View file

@ -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