From 2a4cacda2174f1fdacaf042c975204f40e7dd0d0 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 17 Jul 2015 08:39:49 -0700 Subject: Better invalid dive site name This should ensure that no one ever might end up with our "invalid" name for real. And it allows us to more easily test elsewhere for that invalid value. Signed-off-by: Dirk Hohndel --- divesite.h | 2 ++ qt-models/divelocationmodel.cpp | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/divesite.h b/divesite.h index e0418b203..7dab210f1 100644 --- a/divesite.h +++ b/divesite.h @@ -63,6 +63,8 @@ void clear_dive_site(struct dive_site *ds); unsigned int get_distance(degrees_t lat1, degrees_t lon1, degrees_t lat2, degrees_t lon2); uint32_t find_or_create_dive_site_with_name(const char *name); +#define INVALID_DIVE_SITE_NAME "development use only - not a valid dive site name" + #ifdef __cplusplus } #endif diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index 05d7df709..5aa3a3ac8 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -69,9 +69,10 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons if (index.row() == 1) { struct dive_site *ds = get_dive_site_name_start_which_str(textField->text()); if (!ds) - return "NOT HERE"; + return INVALID_DIVE_SITE_NAME; if (QString(ds->name) == textField->text()) - return "NOT HERE"; + return INVALID_DIVE_SITE_NAME; + } return textField->text(); } -- cgit v1.2.3-70-g09d2