aboutsummaryrefslogtreecommitdiffstats
path: root/profile-widget/profilewidget2.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-06-30 11:36:37 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-07-08 11:00:44 -0700
commit3d7865cf269d8b2f9e06084586ee76e8a44faff1 (patch)
tree0473244d27775664edf717cd45cf2f62613c77b6 /profile-widget/profilewidget2.h
parentb28dba6087f0433af8ece176b64fcac54ca370a4 (diff)
downloadsubsurface-3d7865cf269d8b2f9e06084586ee76e8a44faff1.tar.gz
Dive pictures: detach ProfileWidget2 from DivePictureModel
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>
Diffstat (limited to 'profile-widget/profilewidget2.h')
-rw-r--r--profile-widget/profilewidget2.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h
index 7c01a8139..c7db09a92 100644
--- a/profile-widget/profilewidget2.h
+++ b/profile-widget/profilewidget2.h
@@ -20,6 +20,7 @@
#include "profile-widget/diveprofileitem.h"
#include "core/display.h"
#include "core/color.h"
+#include "core/units.h"
class RulerItem2;
struct dive;
@@ -110,7 +111,7 @@ slots: // Necessary to call from QAction's signals.
void replot(dive *d = 0);
#ifndef SUBSURFACE_MOBILE
void plotPictures();
- void removePictures(const QModelIndex &, int first, int last);
+ void removePictures(const QVector<QString> &fileUrls);
void setPlanState();
void setAddState();
void changeGas();
@@ -126,7 +127,7 @@ slots: // Necessary to call from QAction's signals.
void deleteCurrentDC();
void pointInserted(const QModelIndex &parent, int start, int end);
void pointsRemoved(const QModelIndex &, int start, int end);
- void updatePictures(const QModelIndex &from, const QModelIndex &to);
+ void updateThumbnail(QString filename, QImage thumbnail);
/* this is called for every move on the handlers. maybe we can speed up this a bit? */
void recreatePlannedDive();
@@ -228,8 +229,17 @@ private:
//specifics for ADD and PLAN
#ifndef SUBSURFACE_MOBILE
- // Use std::vector<> and std::unique_ptr<>, because QVector<QScopedPointer<...>> is unsupported.
- std::vector<std::unique_ptr<DivePictureItem>> pictures;
+ // The list of pictures in this plot. The pictures are sorted by offset in seconds.
+ // For the same offset, sort by filename.
+ // Pictures that are outside of the dive time are not shown.
+ struct PictureEntry {
+ offset_t offset;
+ QString filename;
+ std::unique_ptr<DivePictureItem> thumbnail;
+ PictureEntry (offset_t offsetIn, const QString &filenameIn);
+ bool operator< (const PictureEntry &e) const;
+ };
+ std::vector<PictureEntry> pictures;
QList<DiveHandler *> handles;
void repositionDiveHandlers();