summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r--qt-ui/models.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 98a84d7f9..ff8cb5eaf 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -822,6 +822,9 @@ QVariant TripItem::data(int column, int role) const
{
QVariant ret;
+ if (role == SORT_ROLE)
+ return (qulonglong)trip->when;
+
if (role == Qt::DisplayRole) {
switch (column) {
case LOCATION:
@@ -848,6 +851,13 @@ struct DiveItem : public TreeItemDT {
int weight() const;
};
+static int nitrox_sort_value(struct dive *dive)
+{
+ int o2, he, o2low;
+ get_dive_gas(dive, &o2, &he, &o2low);
+ return he*1000 + o2;
+}
+
QVariant DiveItem::data(int column, int role) const
{
QVariant retVal;
@@ -865,6 +875,23 @@ QVariant DiveItem::data(int column, int role) const
break;
}
break;
+ case SORT_ROLE:
+ switch (column) {
+ case NR: return dive->number;
+ case DATE: return (qulonglong) dive->when;
+ case DEPTH: return dive->maxdepth.mm;
+ case DURATION: return dive->duration.seconds;
+ case TEMPERATURE: return dive->watertemp.mkelvin;
+ case TOTALWEIGHT: return total_weight(dive);
+ case SUIT: return QString(dive->suit);
+ case CYLINDER: return QString(dive->cylinder[0].type.description);
+ case NITROX: return nitrox_sort_value(dive);
+ case SAC: return dive->sac;
+ case OTU: return dive->otu;
+ case MAXCNS: return dive->maxcns;
+ case LOCATION: return QString(dive->location);
+ }
+ break;
case Qt::DisplayRole:
switch (column) {
case NR: