mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Desktop: Add notes column to dive list table.
Add a column for dive notes to the dive list table. The column is disabled by default. As requested in https://groups.google.com/g/subsurface-divelog/c/PEFre85Ek1M. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
d44787a0b3
commit
5b263a8f4e
4 changed files with 27 additions and 13 deletions
|
@ -1,3 +1,4 @@
|
|||
desktop: add column for dive notes to the dive list table
|
||||
desktop: fix bug when printing a dive plan with multiple segments
|
||||
desktop: fix bug in bailout gas selection for CCR dives
|
||||
desktop: fix crash on cylinder update of multiple dives
|
||||
|
|
|
@ -69,15 +69,16 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent),
|
|||
QString title = QString("%1").arg(model()->headerData(i, Qt::Horizontal).toString());
|
||||
QString settingName = QString("showColumn%1").arg(i);
|
||||
QAction *a = new QAction(title, header());
|
||||
bool showHeaderFirstRun = !(i == DiveTripModelBase::MAXCNS ||
|
||||
i == DiveTripModelBase::GAS ||
|
||||
i == DiveTripModelBase::OTU ||
|
||||
i == DiveTripModelBase::TEMPERATURE ||
|
||||
i == DiveTripModelBase::TOTALWEIGHT ||
|
||||
i == DiveTripModelBase::SUIT ||
|
||||
i == DiveTripModelBase::CYLINDER ||
|
||||
i == DiveTripModelBase::SAC ||
|
||||
i == DiveTripModelBase::TAGS);
|
||||
bool showHeaderFirstRun = i == DiveTripModelBase::NR ||
|
||||
i == DiveTripModelBase::DATE ||
|
||||
i == DiveTripModelBase::RATING ||
|
||||
i == DiveTripModelBase::DEPTH ||
|
||||
i == DiveTripModelBase::DURATION ||
|
||||
i == DiveTripModelBase::PHOTOS ||
|
||||
i == DiveTripModelBase::BUDDIES ||
|
||||
i == DiveTripModelBase::DIVEGUIDE ||
|
||||
i == DiveTripModelBase::COUNTRY ||
|
||||
i == DiveTripModelBase::LOCATION;
|
||||
bool shown = s.value(settingName, showHeaderFirstRun).toBool();
|
||||
a->setCheckable(true);
|
||||
a->setChecked(shown);
|
||||
|
|
|
@ -57,6 +57,7 @@ static QVariant dive_table_alignment(int column)
|
|||
case DiveTripModelBase::BUDDIES:
|
||||
case DiveTripModelBase::DIVEGUIDE:
|
||||
case DiveTripModelBase::LOCATION:
|
||||
case DiveTripModelBase::NOTES:
|
||||
return int(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
}
|
||||
return QVariant();
|
||||
|
@ -256,6 +257,8 @@ QString DiveTripModelBase::getDescription(int column)
|
|||
return tr("Dive guide");
|
||||
case LOCATION:
|
||||
return tr("Location");
|
||||
case NOTES:
|
||||
return tr("Notes");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
|
@ -352,10 +355,14 @@ QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role)
|
|||
case LOCATION:
|
||||
return QString(get_dive_location(d));
|
||||
case GAS:
|
||||
char *gas_string = get_dive_gas_string(d);
|
||||
QString ret(gas_string);
|
||||
free(gas_string);
|
||||
return ret;
|
||||
{
|
||||
char *gas_string = get_dive_gas_string(d);
|
||||
QString ret(gas_string);
|
||||
free(gas_string);
|
||||
return ret;
|
||||
}
|
||||
case NOTES:
|
||||
return QString(d->notes);
|
||||
}
|
||||
break;
|
||||
case Qt::DecorationRole:
|
||||
|
@ -444,6 +451,8 @@ QVariant DiveTripModelBase::headerData(int section, Qt::Orientation orientation,
|
|||
return tr("Dive guide");
|
||||
case LOCATION:
|
||||
return tr("Location");
|
||||
case NOTES:
|
||||
return tr("Notes");
|
||||
}
|
||||
break;
|
||||
case Qt::ToolTipRole:
|
||||
|
@ -1745,5 +1754,7 @@ bool DiveTripModelList::lessThan(const QModelIndex &i1, const QModelIndex &i2) c
|
|||
return lessThanHelper(strCmp(d1->diveguide, d2->diveguide), row_diff);
|
||||
case LOCATION:
|
||||
return lessThanHelper(strCmp(get_dive_location(d1), get_dive_location(d2)), row_diff);
|
||||
case NOTES:
|
||||
return lessThanHelper(strCmp(d1->notes, d2->notes), row_diff);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
DIVEGUIDE,
|
||||
COUNTRY,
|
||||
LOCATION,
|
||||
NOTES,
|
||||
COLUMNS
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue