subsurface/core/CMakeLists.txt
Berthold Stoeger ec7d85835f Dive list: implement proper Qt-model semantics for DiveTripModel
Previously, each dive-list modifying function would lead to a
full model reset. Instead, implement proper Qt-model semantics
using beginInsertRows()/endInsertRows(), beginRemoveRows()/
endRemoveRows(), dataChange().

To do so, a DiveListNotifer singleton is generatated, which
broadcasts all changes to the dive-list. Signals are sent by
the commands and received by the DiveTripModel. Signals are
batched by dive-trip. This seems to be an adequate compromise
for the two kinds of list-views (tree and list). In the common
usecase mostly dives of a single trip are affected.

Thus, batching of dives is performed in two positions:
- At command-level to batch by trip
- In DiveTripModel to feed batches of contiguous elements
  to Qt's begin*/end*-functions.

This is conceptually simple, but rather complex code. To avoid
repetition of complex loops, the batching is implemented in
templated-functions, which are passed lambda-functions, which
are called for each batch.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-11 16:22:27 -07:00

136 lines
2.9 KiB
CMake

set(PLATFORM_SRC unknown_platform.c)
message(STATUS "system name ${CMAKE_SYSTEM_NAME}")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(ANDROID)
set(PLATFORM_SRC android.cpp)
else()
set(PLATFORM_SRC unix.c)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(PLATFORM_SRC android.cpp)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(PLATFORM_SRC macos.c)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(PLATFORM_SRC windows.c)
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
set(PLATFORM_SRC unix.c)
endif()
if(FTDISUPPORT)
set(SERIAL_FTDI serial_ftdi.c)
endif()
if(BTSUPPORT)
add_definitions(-DBT_SUPPORT)
set(BT_SRC_FILES desktop-widgets/btdeviceselectiondialog.cpp)
set(BT_CORE_SRC_FILES qtserialbluetooth.cpp btdiscovery.cpp)
endif()
if(BLESUPPORT)
add_definitions(-DBLE_SUPPORT)
set(BT_CORE_SRC_FILES ${BT_CORE_SRC_FILES} qt-ble.cpp)
endif()
# compile the core library part in C, part in C++
set(SUBSURFACE_CORE_LIB_SRCS
checkcloudconnection.cpp
cloudstorage.cpp
cochran.c
color.cpp
configuredivecomputer.cpp
configuredivecomputerthreads.cpp
connectionlistmodel.cpp
datatrak.c
deco.c
device.c
devicedetails.cpp
dive.c
divecomputer.cpp
divelogexportlogic.cpp
divesite.c
divesitehelpers.cpp
divesite-helper.cpp
divelist.c
downloadfromdcthread.cpp
equipment.c
errorhelper.c
exif.cpp
file.c
format.cpp
gaspressures.c
gas-model.c
gettextfromc.cpp
git-access.c
gpslocation.cpp
imagedownloader.cpp
isocialnetworkintegration.cpp
libdivecomputer.c
liquivision.c
load-git.c
membuffer.c
metadata.cpp
xmp_parser.cpp
metrics.cpp
ostctools.c
parse-xml.c
parse.c
import-suunto.c
import-shearwater.c
import-cobalt.c
import-divinglog.c
import-csv.c
planner.c
plannernotes.c
pluginmanager.cpp
profile.c
qthelper.cpp
qt-init.cpp
save-git.c
save-xml.c
save-html.c
sha1.c
statistics.c
strtod.c
subsurfacestartup.c
subsurfacesysinfo.cpp
taxonomy.c
time.c
uemis.c
uemis-downloader.c
version.c
videoframeextractor.cpp
windowtitleupdate.cpp
worldmap-save.c
# classes to manage struct preferences for QWidget and QML
settings/qPref.cpp
settings/qPrefCloudStorage.cpp
settings/qPrefDisplay.cpp
settings/qPrefDiveComputer.cpp
settings/qPrefDivePlanner.cpp
settings/qPrefFacebook.cpp
settings/qPrefGeneral.cpp
settings/qPrefGeocoding.cpp
settings/qPrefLanguage.cpp
settings/qPrefLocationService.cpp
settings/qPrefPartialPressureGas.cpp
settings/qPrefPrivate.cpp
settings/qPrefProxy.cpp
settings/qPrefTechnicalDetails.cpp
settings/qPrefUnit.cpp
settings/qPrefUpdateManager.cpp
#Subsurface Qt have the Subsurface structs QObjectified for easy access via QML.
subsurface-qt/DiveObjectHelper.cpp
subsurface-qt/CylinderObjectHelper.cpp
subsurface-qt/DiveListNotifier.cpp
${SERIAL_FTDI}
${PLATFORM_SRC}
${BT_CORE_SRC_FILES}
)
source_group("Subsurface Core" FILES ${SUBSURFACE_CORE_LIB_SRCS})
add_library(subsurface_corelib STATIC ${SUBSURFACE_CORE_LIB_SRCS} )
target_link_libraries(subsurface_corelib ${QT_LIBRARIES})