summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--desktop-widgets/divelistview.cpp2
-rw-r--r--icons/duringPhoto.pngbin5352 -> 2278 bytes
-rw-r--r--icons/inAndOutPhoto.pngbin5520 -> 2822 bytes
-rw-r--r--icons/outsidePhoto.pngbin3032 -> 2466 bytes
-rw-r--r--qt-models/divetripmodel.cpp29
5 files changed, 15 insertions, 16 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index 081cd93be..90ea3f5bd 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -25,7 +25,7 @@
#include "core/helpers.h"
// # Date Rtg Dpth Dur Tmp Wght Suit Cyl Gas SAC OTU CNS Px Loc
-static int defaultWidth[] = { 70, 140, 90, 50, 50, 50, 50, 70, 50, 50, 70, 50, 50, 25, 500};
+static int defaultWidth[] = { 70, 140, 90, 50, 50, 50, 50, 70, 50, 50, 70, 50, 50, 5, 500};
DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false), sortColumn(0),
currentOrder(Qt::DescendingOrder), dontEmitDiveChangedSignal(false), selectionSaved(false)
diff --git a/icons/duringPhoto.png b/icons/duringPhoto.png
index 6984b3041..c91aa201a 100644
--- a/icons/duringPhoto.png
+++ b/icons/duringPhoto.png
Binary files differ
diff --git a/icons/inAndOutPhoto.png b/icons/inAndOutPhoto.png
index cbbc112de..6693e0b05 100644
--- a/icons/inAndOutPhoto.png
+++ b/icons/inAndOutPhoto.png
Binary files differ
diff --git a/icons/outsidePhoto.png b/icons/outsidePhoto.png
index 8976bb7b4..fb1d5882a 100644
--- a/icons/outsidePhoto.png
+++ b/icons/outsidePhoto.png
Binary files differ
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index c7a7e9001..060fea721 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -22,7 +22,6 @@ static QVariant dive_table_alignment(int column)
case DiveTripModel::TOTALWEIGHT:
case DiveTripModel::SAC:
case DiveTripModel::OTU:
- case DiveTripModel::PHOTOS:
case DiveTripModel::MAXCNS:
// Right align numeric columns
retVal = int(Qt::AlignRight | Qt::AlignVCenter);
@@ -34,6 +33,7 @@ static QVariant dive_table_alignment(int column)
case DiveTripModel::SUIT:
case DiveTripModel::CYLINDER:
case DiveTripModel::GAS:
+ case DiveTripModel::PHOTOS:
case DiveTripModel::LOCATION:
retVal = int(Qt::AlignLeft | Qt::AlignVCenter);
break;
@@ -197,13 +197,13 @@ QVariant DiveItem::data(int column, int role) const
retVal = QIcon(":globe-icon").pixmap(im.sz_small, im.sz_small);
}
break;
- case PHOTOS: // if enabled, show photos icon: fish= photos during dive; sun=photos before/after dive
- if (dive->picture_list) // sun+fish=photos during dive as well as before/after
+ case PHOTOS:
+ if (dive->picture_list)
{
IconMetrics im = defaultIconMetrics();
retVal = QIcon(icon_names[countPhotos(dive)]).pixmap(im.sz_small, im.sz_small);
- }
- break;
+ } // If there are photos, show one of the three photo icons: fish= photos during dive;
+ break; // sun=photos before/after dive; sun+fish=photos during dive as well as before/after
}
break;
case Qt::ToolTipRole:
@@ -323,21 +323,20 @@ QString DiveItem::displayDepthWithUnit() const
}
int DiveItem::countPhotos(dive *dive) const
-{
- int diveDuration = dive->duration.seconds;
+{ // Determine whether dive has pictures, and whether they were taken during or before/after dive.
+ const int bufperiod = 120; // A 2-min buffer period. Photos within 2 min of dive are assumed as
+ int diveDuration = dive->duration.seconds; // taken during the dive, not before/after.
int pic_offset, icon_index = 0;
- struct picture *pic_list = dive->picture_list; // Point to 1st picture of dive
- if (!pic_list) return 0; // This dive does not contain pictures
- do {
- pic_offset = pic_list->offset.seconds;
- if ((pic_offset < 0) | (pic_offset > diveDuration)) {
+ FOR_EACH_PICTURE (dive) { // Step through each of the pictures for this dive:
+ if (!picture) break; // if there are no pictures for this dive, return 0
+ pic_offset = picture->offset.seconds;
+ if ((pic_offset < -bufperiod) | (pic_offset > diveDuration+bufperiod)) {
icon_index |= 0x02; // If picture is before/after the dive
} // then set the appropriate bit ...
else {
icon_index |= 0x01; // else set the bit for picture during the dive
}
- pic_list = pic_list->next; // look at next photo
- } while (pic_list);
+ }
return icon_index; // return value: 0=no pictures; 1=pictures during dive;
} // 2=pictures before/after; 3=pictures during as well as before/after
@@ -471,7 +470,7 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int
ret = tr("Max CNS");
break;
case PHOTOS:
- ret = tr("█");
+ ret = tr("Photos");
break;
case LOCATION:
ret = tr("Location");