mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add "Tags" column in Desktop app's dive list view
Add DiveItem::displayTags helper method to return Tags as a QString New Tags column is by default inserted before "Photos" column by default disabled Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
This commit is contained in:
parent
78986589f0
commit
12dc1889c7
4 changed files with 33 additions and 1 deletions
|
@ -36,6 +36,7 @@ static QVariant dive_table_alignment(int column)
|
|||
case DiveTripModel::SUIT:
|
||||
case DiveTripModel::CYLINDER:
|
||||
case DiveTripModel::GAS:
|
||||
case DiveTripModel::TAGS:
|
||||
case DiveTripModel::PHOTOS:
|
||||
case DiveTripModel::COUNTRY:
|
||||
case DiveTripModel::LOCATION:
|
||||
|
@ -136,6 +137,9 @@ QVariant DiveItem::data(int column, int role) const
|
|||
case MAXCNS:
|
||||
retVal = dive->maxcns;
|
||||
break;
|
||||
case TAGS:
|
||||
retVal = displayTags();
|
||||
break;
|
||||
case PHOTOS:
|
||||
retVal = countPhotos(dive);
|
||||
break;
|
||||
|
@ -186,6 +190,9 @@ QVariant DiveItem::data(int column, int role) const
|
|||
else
|
||||
retVal = dive->maxcns;
|
||||
break;
|
||||
case TAGS:
|
||||
retVal = displayTags();
|
||||
break;
|
||||
case PHOTOS:
|
||||
break;
|
||||
case COUNTRY:
|
||||
|
@ -265,6 +272,9 @@ QVariant DiveItem::data(int column, int role) const
|
|||
case MAXCNS:
|
||||
retVal = tr("Max. CNS");
|
||||
break;
|
||||
case TAGS:
|
||||
retVal = tr("Tags");
|
||||
break;
|
||||
case PHOTOS:
|
||||
retVal = tr("Photos before/during/after dive");
|
||||
break;
|
||||
|
@ -409,6 +419,17 @@ QString DiveItem::displayWeightWithUnit() const
|
|||
return weight_string(weight()) + ((get_units()->weight == units::KG) ? tr("kg") : tr("lbs"));
|
||||
}
|
||||
|
||||
QString DiveItem::displayTags() const
|
||||
{
|
||||
struct dive *dive = get_dive_by_uniq_id(diveId);
|
||||
if (!dive->tag_list)
|
||||
return QString();
|
||||
|
||||
char buf[1024];
|
||||
taglist_get_tagstring(dive->tag_list, buf, 1024);
|
||||
return QString(buf);
|
||||
}
|
||||
|
||||
int DiveItem::weight() const
|
||||
{
|
||||
struct dive *dive = get_dive_by_uniq_id(diveId);
|
||||
|
@ -498,6 +519,9 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int
|
|||
case MAXCNS:
|
||||
ret = tr("Max CNS");
|
||||
break;
|
||||
case TAGS:
|
||||
ret = tr("Tags");
|
||||
break;
|
||||
case PHOTOS:
|
||||
ret = tr("Photos");
|
||||
break;
|
||||
|
@ -552,6 +576,9 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int
|
|||
case MAXCNS:
|
||||
ret = tr("Max CNS");
|
||||
break;
|
||||
case TAGS:
|
||||
ret = tr("Tags");
|
||||
break;
|
||||
case PHOTOS:
|
||||
ret = tr("Photos before/during/after dive");
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue