diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/dive.h | 4 | ||||
-rw-r--r-- | core/pref.h | 1 | ||||
-rw-r--r-- | core/prefs-macros.h | 10 | ||||
-rw-r--r-- | core/subsurface-qt/DiveObjectHelper.cpp | 18 | ||||
-rw-r--r-- | core/subsurface-qt/DiveObjectHelper.h | 2 | ||||
-rw-r--r-- | core/subsurfacestartup.h | 1 |
6 files changed, 26 insertions, 10 deletions
diff --git a/core/dive.h b/core/dive.h index 0f6fe192d..81396d352 100644 --- a/core/dive.h +++ b/core/dive.h @@ -525,10 +525,6 @@ static inline depth_t gas_mnd(struct gasmix *mix, depth_t end, struct dive *dive #define SURFACE_THRESHOLD 750 /* somewhat arbitrary: only below 75cm is it really diving */ -/* this is a global spot for a temporary dive structure that we use to - * be able to edit a dive without unintended side effects */ -extern struct dive edit_dive; - extern short autogroup; /* random threashold: three days without diving -> new trip * this works very well for people who usually dive as part of a trip and don't diff --git a/core/pref.h b/core/pref.h index 198d4b9fe..d25115c8e 100644 --- a/core/pref.h +++ b/core/pref.h @@ -189,6 +189,7 @@ extern const char *system_default_directory(void); extern const char *system_default_filename(); extern bool subsurface_ignore_font(const char *font); extern void subsurface_OS_pref_setup(); +extern void copy_prefs(struct preferences *src, struct preferences *dest); #ifdef __cplusplus } diff --git a/core/prefs-macros.h b/core/prefs-macros.h index 6f1b665fd..15a9a9867 100644 --- a/core/prefs-macros.h +++ b/core/prefs-macros.h @@ -18,10 +18,10 @@ else \ prefs.units.field = default_prefs.units.field -#define GET_UNIT_BOOL(name, field) \ +#define GET_UNIT_BOOL(name, field) \ v = s.value(QString(name)); \ if (v.isValid()) \ - prefs.units.field = v.toBool(); \ + prefs.units.field = v.toBool(); \ else \ prefs.units.field = default_prefs.units.field @@ -53,10 +53,10 @@ else \ prefs.field = default_prefs.field -#define GET_INT_DEF(name, field, defval) \ +#define GET_INT_DEF(name, field, defval) \ v = s.value(QString(name)); \ if (v.isValid()) \ - prefs.field = v.toInt(); \ + prefs.field = v.toInt(); \ else \ prefs.field = defval @@ -65,7 +65,7 @@ if (v.isValid()) \ prefs.field = strdup(v.toString().toUtf8().constData()); \ else \ - prefs.field = default_prefs.field + prefs.field = copy_string(default_prefs.field) #define SAVE_OR_REMOVE_SPECIAL(_setting, _default, _compare, _value) \ if (_compare != _default) \ diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp index 8e5890b4c..8ea8b6370 100644 --- a/core/subsurface-qt/DiveObjectHelper.cpp +++ b/core/subsurface-qt/DiveObjectHelper.cpp @@ -426,6 +426,24 @@ QStringList DiveObjectHelper::suitList() const return suits; } +QStringList DiveObjectHelper::locationList() const +{ + QStringList locations; + struct dive *d; + struct dive_site *ds; + int i = 0; + for_each_dive (i, d) { + if ((ds = get_dive_site_by_uuid(d->dive_site_uuid)) != NULL) { + QString temp = ds->name; + if (!temp.isEmpty()) + locations << temp; + } + } + locations.removeDuplicates(); + locations.sort(); + return locations; +} + QStringList DiveObjectHelper::buddyList() const { QStringList buddies; diff --git a/core/subsurface-qt/DiveObjectHelper.h b/core/subsurface-qt/DiveObjectHelper.h index 83aea4841..49542ca62 100644 --- a/core/subsurface-qt/DiveObjectHelper.h +++ b/core/subsurface-qt/DiveObjectHelper.h @@ -50,6 +50,7 @@ class DiveObjectHelper : public QObject { Q_PROPERTY(QStringList suitList READ suitList CONSTANT) Q_PROPERTY(QStringList buddyList READ buddyList CONSTANT) Q_PROPERTY(QStringList divemasterList READ divemasterList CONSTANT) + Q_PROPERTY(QStringList locationList READ locationList CONSTANT) public: DiveObjectHelper(struct dive *dive = NULL); ~DiveObjectHelper(); @@ -93,6 +94,7 @@ public: QString endPressure() const; QString firstGas() const; QStringList suitList() const; + QStringList locationList() const; QStringList buddyList() const; QStringList divemasterList() const; diff --git a/core/subsurfacestartup.h b/core/subsurfacestartup.h index b26c99025..40de09723 100644 --- a/core/subsurfacestartup.h +++ b/core/subsurfacestartup.h @@ -17,7 +17,6 @@ extern bool imported; void setup_system_prefs(void); void parse_argument(const char *arg); void free_prefs(void); -void copy_prefs(struct preferences *src, struct preferences *dest); void print_files(void); void print_version(void); |