diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-11 17:41:56 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-05-06 13:58:09 -0700 |
commit | 989d6a3f96b818e5eacc5a2ccb1cc82e6dd8354c (patch) | |
tree | 006daeb578ac4d3e68044ecfc36e7e12b1604ee8 /qt-models/divepicturemodel.cpp | |
parent | 282041e228d4a60ff7108fbfd1fc23caffd59ba4 (diff) | |
download | subsurface-989d6a3f96b818e5eacc5a2ccb1cc82e6dd8354c.tar.gz |
media: use table instead of linked list for media
For consistency with equipment, use our table macros for pictures.
Generally tables (arrays) are preferred over linked lists, because
they allow random access.
This is mostly copy & paste of the equipment code.
Sadly, our table macros are quite messy and need some revamping.
Therefore, the resulting code is likewise somewhat messy.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divepicturemodel.cpp')
-rw-r--r-- | qt-models/divepicturemodel.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/qt-models/divepicturemodel.cpp b/qt-models/divepicturemodel.cpp index 799c49c0e..306030c4e 100644 --- a/qt-models/divepicturemodel.cpp +++ b/qt-models/divepicturemodel.cpp @@ -116,8 +116,10 @@ static bool removePictureFromSelectedDive(const char *fileUrl) int i; struct dive *dive; for_each_dive (i, dive) { - if (dive->selected && dive_remove_picture(dive, fileUrl)) + if (dive->selected && remove_picture(&dive->pictures, fileUrl)) { + invalidate_dive_cache(dive); return true; + } } return false; } |