From ef8b2e6bb75e79b3f600980e8b7d89389df18970 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 8 Dec 2017 08:13:08 -0600 Subject: Cleanup: rename file to avoid confusion Depending on the tooling, both divesite.c and divesite.cpp would compile into divesite.o. Signed-off-by: Dirk Hohndel --- core/CMakeLists.txt | 2 +- core/divesite-helper.cpp | 52 ++++++++++++++++++++++ core/divesite.cpp | 52 ---------------------- .../ios/Subsurface-mobile/Subsurface-mobile.pro | 2 +- 4 files changed, 54 insertions(+), 54 deletions(-) create mode 100644 core/divesite-helper.cpp delete mode 100644 core/divesite.cpp diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 4bf9f9bf6..87b276872 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -37,7 +37,7 @@ set(SUBSURFACE_CORE_LIB_SRCS device.c dive.c divesite.c - divesite.cpp + divesite-helper.cpp divelist.c equipment.c errorhelper.c diff --git a/core/divesite-helper.cpp b/core/divesite-helper.cpp new file mode 100644 index 000000000..56030afd1 --- /dev/null +++ b/core/divesite-helper.cpp @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "divesite.h" +#include "pref.h" + +QString constructLocationTags(struct dive_site *ds, bool for_maintab) +{ + QString locationTag; + + if (!ds || !ds->taxonomy.nr) + return locationTag; + + /* Check if the user set any of the 3 geocoding categories */ + bool prefs_set = false; + for (int i = 0; i < 3; i++) { + if (prefs.geocoding.category[i] != TC_NONE) + prefs_set = true; + } + + if (!prefs_set && !for_maintab) { + locationTag = QString("") + QObject::tr("No dive site layout categories set in preferences!") + + QString(""); + return locationTag; + } + else if (!prefs_set) + return locationTag; + + if (for_maintab) + locationTag = QString("(") + QObject::tr("Tags") + QString(": "); + else + locationTag = QString(""); + QString connector; + for (int i = 0; i < 3; i++) { + if (prefs.geocoding.category[i] == TC_NONE) + continue; + for (int j = 0; j < ds->taxonomy.nr; j++) { + if (ds->taxonomy.category[j].category == prefs.geocoding.category[i]) { + QString tag = ds->taxonomy.category[j].value; + if (!tag.isEmpty()) { + locationTag += connector + tag; + connector = " / "; + } + break; + } + } + } + + if (for_maintab) + locationTag += ")"; + else + locationTag += ""; + return locationTag; +} diff --git a/core/divesite.cpp b/core/divesite.cpp deleted file mode 100644 index 56030afd1..000000000 --- a/core/divesite.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include "divesite.h" -#include "pref.h" - -QString constructLocationTags(struct dive_site *ds, bool for_maintab) -{ - QString locationTag; - - if (!ds || !ds->taxonomy.nr) - return locationTag; - - /* Check if the user set any of the 3 geocoding categories */ - bool prefs_set = false; - for (int i = 0; i < 3; i++) { - if (prefs.geocoding.category[i] != TC_NONE) - prefs_set = true; - } - - if (!prefs_set && !for_maintab) { - locationTag = QString("") + QObject::tr("No dive site layout categories set in preferences!") + - QString(""); - return locationTag; - } - else if (!prefs_set) - return locationTag; - - if (for_maintab) - locationTag = QString("(") + QObject::tr("Tags") + QString(": "); - else - locationTag = QString(""); - QString connector; - for (int i = 0; i < 3; i++) { - if (prefs.geocoding.category[i] == TC_NONE) - continue; - for (int j = 0; j < ds->taxonomy.nr; j++) { - if (ds->taxonomy.category[j].category == prefs.geocoding.category[i]) { - QString tag = ds->taxonomy.category[j].value; - if (!tag.isEmpty()) { - locationTag += connector + tag; - connector = " / "; - } - break; - } - } - } - - if (for_maintab) - locationTag += ")"; - else - locationTag += ""; - return locationTag; -} diff --git a/packaging/ios/Subsurface-mobile/Subsurface-mobile.pro b/packaging/ios/Subsurface-mobile/Subsurface-mobile.pro index f8d4d9738..5ab9f5ae5 100644 --- a/packaging/ios/Subsurface-mobile/Subsurface-mobile.pro +++ b/packaging/ios/Subsurface-mobile/Subsurface-mobile.pro @@ -23,7 +23,7 @@ SOURCES += ../../../subsurface-mobile-main.cpp \ ../../../core/configuredivecomputer.cpp \ ../../../core/divecomputer.cpp \ ../../../core/divelogexportlogic.cpp \ - ../../../core/divesite.cpp \ + ../../../core/divesite-helper.cpp \ ../../../core/divesitehelpers.cpp \ ../../../core/errorhelper.c \ ../../../core/exif.cpp \ -- cgit v1.2.3-70-g09d2