aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models/divepicturemodel.h
AgeCommit message (Collapse)Author
2018-08-01Cleanup: remove all override modifiersGravatar Berthold Stoeger
Commit df156a56c08a56eb380711a507ef739d8150a71f replaced "virtual" by "override" where appropriate. Unfortunately, this had the unintended consequence of producing numerous clang warnings. If clang finds a override-modified function in a class definition, it warns for *all* overriden virtual functions without the override modifier. To solve this, go the easy route and remove all overrides. At least it is consistent. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-31Cleanup: replace virtual by override where appropriateGravatar Berthold Stoeger
The keyword "virtual" signalizes that the function is virtual, i.e. the function of the derived class is called, even if the call is on the parent class. It is not necessary to repeat the "virtual" keyword in derived classes. To highlight derived virtual functions, the keyword "override" should be used instead. It results in a hard compile- error, if no function is overridden, thus avoiding subtle bugs. Replace "virtual" by "override" where appropriate. Moreover, replace Q_DECL_OVERRIDE by override, since we require reasonably recent compilers anyway. Likewise, replace /* reimp */ by "override" for consistency and compiler support. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-23Dive video: paint duration-bar above thumbnail in profile plotGravatar Berthold Stoeger
Paint a rectangle on top of thumbnails indicating the run-time of the video. Use the z=100.0-101.0 range for painting the thumbnails, whereby the z-value increases uniformly from first to last thumbnail (sorted by timestamp). The duration-bars are placed at z-values midway between those of the thumbnails. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-13Dive pictures: don't update all images on drag&drop to profileGravatar Berthold Stoeger
Gracefully handle drag & drop to the profile, which changes the offset of the pictures. To do this, keep the pictures in the DivePictureModel and the ProfileWidget2 sorted by offset and re-arrange if needed to keep the list sorted. This needs some code reshuffling. Introduce a helper-function that moves ranges in arrays. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-08Dive pictures: detach ProfileWidget2 from DivePictureModelGravatar Berthold Stoeger
As long as ProfileWidget2 and DivePictureModel showed the same set of pictures and any change would lead to a full recalculation of the set, it made sense to let ProfileWidget2 use DivePictureModel's data. Recently, keeping the two lists in sync become more and more of a burden. Therefore, disconnect ProfileWidget2 and DivePictureModel. This will lead to some code-duplication and perhaps a temporary drop in UI-performance, but in the end the code is distinctly simpler and also more flexible. Thus, for example the DivePhotoTab could be changed to support headings without having to touch ProfileWidget2 at all. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-04Dive pictures: find moved pictures based on filenameGravatar Berthold Stoeger
Users might have edited their pictures. Therefore, instead of identifying pictures by the hash of the file-content, use the file path. The match between original and new filename is graded by a score. Currently, this is the number of path components that match, starting from the filename. Camparison is case-insensitive. After having identified the matching images, write the caches so that they are saved even if the user doesn't cleanly quit the application. Since the new code uses significantly less resources, it can be run in a single background thread. Thus, the multi-threading can be simplified. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-21Dive pictures: don't repopulate DivePictureModel on deletionGravatar Berthold Stoeger
On deletion of a single or multiple pictures, the whole DivePictureModel was repopulated, which was clearly visible in the UI, owing to the reconstructing of all images in the profile plot. To avoid this vexing behavior, implement proper deletion routines in DivePictureModel and ProfileWidget2. Since this needs sensible erase() semantics the QList<PictureEntry> member of DivePictureModel was replaced by a QVector. A QVector should be the default anyway, unless there are very specific reasons to use a QList (which actually is a deque, not a classical linked list). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-21Dive pictures: change removePicture() interfaceGravatar Berthold Stoeger
The function removePicture() had a flag "last", which would indicate that the called had finished removing pictures. Only then would the model be recalculated. This is a strange interface and, matter of fact, the caller was buggy: if the last picture to be removed didn't have a proper url, removePicture() was never called with "last" being set. Change the interface to take a list of pictures to be deleted. This will allow us to make picture deletion smarter in follow-up commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: Don't update all pictures on drag & drop to profileGravatar Berthold Stoeger
In the old code, we used to reload the whole picture list on drag & drop to the profile. Instead, only update the drag&dropped picture and repaint the profile-pictures. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: Move thumbnail-size to Thumbnailer classGravatar Berthold Stoeger
The size of the to-be-created thumbnails was passed from DivePictureModel to Thumbnailer. This became more and more bothersome, because the size had to be stored with the request. Calling from Thumbnailer into DivePictureModel was not an option, since this is not linked to all tests. Therefore, move these functions to the Thumbnailer class. Since the maximum thumbnail size is now known to the thumbnailer, the dummy and failure images can be precalculated, which makes switching between dives faster. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: Update pictures when thumbnails are readyGravatar Berthold Stoeger
Connect the thumbnailer signal to the dive picture model slot. This needs some code-reshuffling in the dive picture model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: Scale thumbnails on demandGravatar Berthold Stoeger
To potentially conserve memory, don't keep copies of scaled thumbnails. Scale the thumbnails on demand. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-18Implement different zoom levels for dive photos tabGravatar Berthold Stoeger
This implements different zoom levels for the dive photos tab as suggested by Stefan Fuchs <sfuchs@gmx.de> in #898. The zoom level can be changed using a slider or CTRL+mousewheel. Zoom levels range from a third of the standard thumbnail size to thrice the standard thumbnail size. Thumbnails are cached in maximum resolution and scaled down on the fly. Because the profile widget took its pictures from the photo list model, an extra picture copy with a fixed size had to be introduced. The UI is still a bit crude. Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-18Make protected DivePictureModel members privateGravatar Berthold Stoeger
The constructor and the list of pictures was protected, but the class neither had friends nor subclasses (a subclass was removed in a recent commit). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-18Make scaleImages() a static functionGravatar Berthold Stoeger
It was only used by the DivePictureModel class, no need to export it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-13Dive pictures show pictures of all selected divesGravatar Stefan Fuchs
In the dive picture tab show pictures of all selected dive. But at the same moment take care that in the profile only pictures from displayed_dive are displayed. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-10Remove outdated commentGravatar Berthold Stoeger
The removed comment in qt-models/divepicturemodel.h described todo items which were already implemented. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-10Simplify DivePictureModelGravatar Berthold Stoeger
The code of DivePictureModel used a QHash to keep track of thumbnails. Not only was the code rather complex - it also had the consequence that pictures are sorted according to the hash function, i.e. seemingly random. This commit replaces the QHash by a simple QList which keeps track of thumbnails and some meta-data. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-10Whitespace fixes in qt-models/divepicturemodel.cppGravatar Berthold Stoeger
Note that constructs like QList<QFuture<void>> is incompatible with pre-C++11 compilers. But the code base is so full of C++11isms that we may just as well remove asymmetric eye-sores of the kind "QList<QFuture<void> >". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-04-29Add SPDX header to Qt modelsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-06Move ImageDownloader out of the desktop widgetsGravatar Dirk Hohndel
This required a bit more untangling, but with this it seems we can build subsurface-mobile again (at least on the desktop). Interesting is the removal from inside the ImageDownloader of the call to DivePictureModel::instance()->updateDivePictures() - which actually could cause some interesting recursion issues. If it turns out we did indeed need this, it needs to be re-architected. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-03Context menu for images: change DivePicture modelGravatar Guido Lerch
Altering DivePicture model to allow deleting images from the QListView without immediate updating of the list. Updating is determined by an additioanl parameter Signed-off-by: Guido Lerch <guido.lerch@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15Remove obsolete commentGravatar Tomaz Canabrava
We don't allow building against Qt4 anymore. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15Add DiveSitePicturesModelGravatar Tomaz Canabrava
This model should be used inside the Edit Dive Site mode. It should display all photos from all dives that are part of this dive site, ignoring trips. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move DivePictureModel to qt-modelsGravatar Tomaz Canabrava
This class will surely be used on the mobile version, and it was very tangled inside divepicturewidget. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>