Add dive mode as possible column

Signed-off-by: Anton Lundin <glance@ac2.se>
This commit is contained in:
Anton Lundin 2023-09-22 23:35:17 +02:00 committed by Michael Keller
parent c7b7c3f691
commit bfe61b2dff
3 changed files with 11 additions and 0 deletions

View file

@ -1,3 +1,4 @@
desktop: add divemode as a possible dive list column
desktop: hide only events with the same severity when 'Hide similar events' is used desktop: hide only events with the same severity when 'Hide similar events' is used
equipment: mark gas mixes reported by the dive computer as 'inactive' as 'not used' equipment: mark gas mixes reported by the dive computer as 'inactive' as 'not used'
equipment: include unused cylinders in merged dive if the preference is enabled equipment: include unused cylinders in merged dive if the preference is enabled

View file

@ -59,6 +59,7 @@ static QVariant dive_table_alignment(int column)
case DiveTripModelBase::DIVEGUIDE: case DiveTripModelBase::DIVEGUIDE:
case DiveTripModelBase::LOCATION: case DiveTripModelBase::LOCATION:
case DiveTripModelBase::NOTES: case DiveTripModelBase::NOTES:
case DiveTripModelBase::DIVEMODE:
return int(Qt::AlignLeft | Qt::AlignVCenter); return int(Qt::AlignLeft | Qt::AlignVCenter);
} }
return QVariant(); return QVariant();
@ -260,6 +261,8 @@ QString DiveTripModelBase::getDescription(int column)
return tr("Location"); return tr("Location");
case NOTES: case NOTES:
return tr("Notes"); return tr("Notes");
case DIVEMODE:
return tr("Divemode");
default: default:
return QString(); return QString();
} }
@ -359,6 +362,8 @@ QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role)
return formatDiveGasString(d); return formatDiveGasString(d);
case NOTES: case NOTES:
return QString(d->notes); return QString(d->notes);
case DIVEMODE:
return QString(divemode_text_ui[(int)d->dc.divemode]);
} }
break; break;
case Qt::DecorationRole: case Qt::DecorationRole:
@ -449,6 +454,8 @@ QVariant DiveTripModelBase::headerData(int section, Qt::Orientation orientation,
return tr("Location"); return tr("Location");
case NOTES: case NOTES:
return tr("Notes"); return tr("Notes");
case DIVEMODE:
return tr("Divemode");
} }
break; break;
case Qt::ToolTipRole: case Qt::ToolTipRole:
@ -1778,5 +1785,7 @@ bool DiveTripModelList::lessThan(const QModelIndex &i1, const QModelIndex &i2) c
return lessThanHelper(strCmp(get_dive_location(d1), get_dive_location(d2)), row_diff); return lessThanHelper(strCmp(get_dive_location(d1), get_dive_location(d2)), row_diff);
case NOTES: case NOTES:
return lessThanHelper(strCmp(d1->notes, d2->notes), row_diff); return lessThanHelper(strCmp(d1->notes, d2->notes), row_diff);
case DIVEMODE:
return lessThanHelper((int)d1->dc.divemode - (int)d2->dc.divemode, row_diff);
} }
} }

View file

@ -44,6 +44,7 @@ public:
COUNTRY, COUNTRY,
LOCATION, LOCATION,
NOTES, NOTES,
DIVEMODE,
COLUMNS COLUMNS
}; };