aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-08-25 21:03:20 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-25 18:00:15 -0700
commitfc6d819616b69f7c69dc8743bc25aa8ad51708a4 (patch)
tree04df3ed15e35816c95f4190e01a9f2e827b8bfa4 /qt-models
parent0ba832ef12382939ef93bb5d7f81b63c9deb7e5d (diff)
downloadsubsurface-fc6d819616b69f7c69dc8743bc25aa8ad51708a4.tar.gz
Create a new dive site and edit it automatically
If the user clicks on the first or second option of the drop down list, subsurface will move him to the dive site edit panel automatically, since it's a new dive site and there's no information about it yet. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/divelocationmodel.cpp4
-rw-r--r--qt-models/divelocationmodel.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index 30b3f82ae..fca322dcf 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -53,7 +53,7 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons
// Special case to handle the 'create dive site' with name.
if (index.row() < 2) {
if (index.column() == UUID)
- return 0;
+ return RECENTLY_ADDED_DIVESITE;
switch(role) {
case Qt::DisplayRole : {
if (index.row() == 1) {
@@ -92,7 +92,7 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons
case Qt::DisplayRole :
switch(index.column()) {
case UUID: return ds->uuid;
- case NAME: return ds->name;
+ case NAME: return QString("%1, id:%2").arg(ds->name).arg(ds->uuid);
case LATITUDE: return ds->latitude.udeg;
case LONGITUDE: return ds->longitude.udeg;
case COORDS: return "TODO";
diff --git a/qt-models/divelocationmodel.h b/qt-models/divelocationmodel.h
index 77dbb7bca..3bf7161f5 100644
--- a/qt-models/divelocationmodel.h
+++ b/qt-models/divelocationmodel.h
@@ -7,6 +7,8 @@
class QLineEdit;
+#define RECENTLY_ADDED_DIVESITE 1
+
class LocationInformationModel : public QAbstractTableModel {
Q_OBJECT
public: