summaryrefslogtreecommitdiffstats
path: root/qt-models/divetripmodel.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2017-10-02 17:52:07 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-10-02 09:52:58 -0700
commitd5ab03ef4e84820f9530152dbf4ffc29dec6e652 (patch)
tree6d6ccfa5b085cba75d750a90b0956f6b5274a928 /qt-models/divetripmodel.cpp
parent516527e1bd4af1591abf212deb75bc26cbfa132b (diff)
downloadsubsurface-d5ab03ef4e84820f9530152dbf4ffc29dec6e652.tar.gz
[Divesite] Hook qt model for country
See #144 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models/divetripmodel.cpp')
-rw-r--r--qt-models/divetripmodel.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index 5c6dd30ff..4082fa989 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -36,6 +36,7 @@ static QVariant dive_table_alignment(int column)
case DiveTripModel::CYLINDER:
case DiveTripModel::GAS:
case DiveTripModel::PHOTOS:
+ case DiveTripModel::COUNTRY:
case DiveTripModel::LOCATION:
retVal = int(Qt::AlignLeft | Qt::AlignVCenter);
break;
@@ -137,6 +138,9 @@ QVariant DiveItem::data(int column, int role) const
case PHOTOS:
retVal = countPhotos(dive);
break;
+ case COUNTRY:
+ retVal = QString(get_dive_country(dive));
+ break;
case LOCATION:
retVal = QString(get_dive_location(dive));
break;
@@ -180,6 +184,9 @@ QVariant DiveItem::data(int column, int role) const
break;
case PHOTOS:
break;
+ case COUNTRY:
+ retVal = QString(get_dive_country(dive));
+ break;
case LOCATION:
retVal = QString(get_dive_location(dive));
break;
@@ -192,6 +199,10 @@ QVariant DiveItem::data(int column, int role) const
break;
case Qt::DecorationRole:
switch (column) {
+ //TODO: ADD A FLAG
+ case COUNTRY:
+ retVal = QVariant();
+ break;
case LOCATION:
if (dive_has_gps_location(dive)) {
IconMetrics im = defaultIconMetrics();
@@ -253,6 +264,9 @@ QVariant DiveItem::data(int column, int role) const
case PHOTOS:
retVal = tr("Photos before/during/after dive");
break;
+ case COUNTRY:
+ retVal = tr("Country");
+ break;
case LOCATION:
retVal = tr("Location");
break;
@@ -461,6 +475,9 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int
case PHOTOS:
ret = tr("Photos");
break;
+ case COUNTRY:
+ ret = tr("Country");
+ break;
case LOCATION:
ret = tr("Location");
break;