aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-30 07:40:22 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-30 07:40:22 -0700
commit3515ad71c159804e37552550add8e89cf3031b33 (patch)
tree773dacfb159013f35ac102b010746e33ac70363e /qt-ui
parent669da22d8cc8cc8373a5c500e6207d2b97813a18 (diff)
downloadsubsurface-3515ad71c159.tar.gz
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>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/models.cpp94
1 files changed, 94 insertions, 0 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index f548d3730..1e41dc173 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -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) {
@@ -1370,6 +1418,52 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int
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("#");
+ break;
+ case DATE:
+ ret = tr("Date");
+ break;
+ case RATING:
+ ret = tr("Rating");
+ break;
+ case DEPTH:
ret = tr("Depth(%1)").arg((get_units()->length == units::METERS) ? tr("m") : tr("ft"));
break;
case DURATION: