mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
32df0ab0da
The DiveItem and TripItem classes were wrappers around dive * and dive_trip * used to extract tabular data. With the rework of DiveTripModel they lost all their state besides the pointer itself. The usage was: DiveItem item(d); item.data(...); This can now be simplified to the much more idiomatic diveData(d, ...); and analoguously for TripItem. While adapting the data() function to be part of DiveTripModel, change the QVariant ret switch(...) { ... case ...: ret = ...; break; ... } return ret; style to switch(...) { ... case ...: return ...; } Not only is this shorter and easier to reason about, it generally also improves the generated code. The compiler can directly construct the return value in the buffer provided by the caller. Though modern compilers start to be very good at avoiding unnecessary copies. In total this cleanup results in a net-reduction of 190 lines of code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> |
||
---|---|---|
.. | ||
cleanertablemodel.cpp | ||
cleanertablemodel.h | ||
CMakeLists.txt | ||
completionmodels.cpp | ||
completionmodels.h | ||
cylindermodel.cpp | ||
cylindermodel.h | ||
divecomputerextradatamodel.cpp | ||
divecomputerextradatamodel.h | ||
divecomputermodel.cpp | ||
divecomputermodel.h | ||
diveimportedmodel.cpp | ||
diveimportedmodel.h | ||
divelistmodel.cpp | ||
divelistmodel.h | ||
divelocationmodel.cpp | ||
divelocationmodel.h | ||
divepicturemodel.cpp | ||
divepicturemodel.h | ||
diveplannermodel.cpp | ||
diveplannermodel.h | ||
diveplotdatamodel.cpp | ||
diveplotdatamodel.h | ||
divetripmodel.cpp | ||
divetripmodel.h | ||
filtermodels.cpp | ||
filtermodels.h | ||
gpslistmodel.cpp | ||
gpslistmodel.h | ||
maplocationmodel.cpp | ||
maplocationmodel.h | ||
messagehandlermodel.cpp | ||
messagehandlermodel.h | ||
models.cpp | ||
models.h | ||
tankinfomodel.cpp | ||
tankinfomodel.h | ||
treemodel.cpp | ||
treemodel.h | ||
weightmodel.cpp | ||
weightmodel.h | ||
weightsysteminfomodel.cpp | ||
weightsysteminfomodel.h | ||
yearlystatisticsmodel.cpp | ||
yearlystatisticsmodel.h |