mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
Divelist: remove units from header, add tooltip
This should help with the issues we are having with alignment / visibility of the relevant information in the divelist. Most people will never switch the units (or maybe switch them once, the first time they use Subsurface). So having the units shown in the table header quickly becomes redundant - yet having the units in there causes all kinds of layout issues. This patch adds a tooltip to both the header and the main data area of the divelist. The tooltip shows the column name plus unit and the column header no longer shows the units. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
669da22d8c
commit
3515ad71c1
1 changed files with 94 additions and 0 deletions
|
@ -1209,6 +1209,54 @@ QVariant DiveItem::data(int column, int role) const
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case Qt::ToolTipRole:
|
||||
switch (column) {
|
||||
case NR:
|
||||
retVal = tr("#");
|
||||
break;
|
||||
case DATE:
|
||||
retVal = tr("Date");
|
||||
break;
|
||||
case RATING:
|
||||
retVal = tr("Rating");
|
||||
break;
|
||||
case DEPTH:
|
||||
retVal = tr("Depth(%1)").arg((get_units()->length == units::METERS) ? tr("m") : tr("ft"));
|
||||
break;
|
||||
case DURATION:
|
||||
retVal = tr("Duration");
|
||||
break;
|
||||
case TEMPERATURE:
|
||||
retVal = tr("Temp(%1%2)").arg(UTF8_DEGREE).arg((get_units()->temperature == units::CELSIUS) ? "C" : "F");
|
||||
break;
|
||||
case TOTALWEIGHT:
|
||||
retVal = tr("Weight(%1)").arg((get_units()->weight == units::KG) ? tr("kg") : tr("lbs"));
|
||||
break;
|
||||
case SUIT:
|
||||
retVal = tr("Suit");
|
||||
break;
|
||||
case CYLINDER:
|
||||
retVal = tr("Cyl");
|
||||
break;
|
||||
case GAS:
|
||||
retVal = tr("Gas");
|
||||
break;
|
||||
case SAC:
|
||||
const char *unit;
|
||||
get_volume_units(0, NULL, &unit);
|
||||
retVal = tr("SAC(%1)").arg(QString(unit).append(tr("/min")));
|
||||
break;
|
||||
case OTU:
|
||||
retVal = tr("OTU");
|
||||
break;
|
||||
case MAXCNS:
|
||||
retVal = tr("Max CNS");
|
||||
break;
|
||||
case LOCATION:
|
||||
retVal = tr("Location");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (role == DiveTripModel::STAR_ROLE) {
|
||||
|
@ -1359,6 +1407,52 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int
|
|||
ret = defaultModelFont();
|
||||
break;
|
||||
case Qt::DisplayRole:
|
||||
switch (section) {
|
||||
case NR:
|
||||
ret = tr("#");
|
||||
break;
|
||||
case DATE:
|
||||
ret = tr("Date");
|
||||
break;
|
||||
case RATING:
|
||||
ret = tr("Rating");
|
||||
break;
|
||||
case DEPTH:
|
||||
ret = tr("Depth");
|
||||
break;
|
||||
case DURATION:
|
||||
ret = tr("Duration");
|
||||
break;
|
||||
case TEMPERATURE:
|
||||
ret = tr("Temp");
|
||||
break;
|
||||
case TOTALWEIGHT:
|
||||
ret = tr("Weight");
|
||||
break;
|
||||
case SUIT:
|
||||
ret = tr("Suit");
|
||||
break;
|
||||
case CYLINDER:
|
||||
ret = tr("Cyl");
|
||||
break;
|
||||
case GAS:
|
||||
ret = tr("Gas");
|
||||
break;
|
||||
case SAC:
|
||||
ret = tr("SAC");
|
||||
break;
|
||||
case OTU:
|
||||
ret = tr("OTU");
|
||||
break;
|
||||
case MAXCNS:
|
||||
ret = tr("Max CNS");
|
||||
break;
|
||||
case LOCATION:
|
||||
ret = tr("Location");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Qt::ToolTipRole:
|
||||
switch (section) {
|
||||
case NR:
|
||||
ret = tr("#");
|
||||
|
|
Loading…
Reference in a new issue