diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-11-17 00:29:17 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-11-16 15:03:35 -0800 |
commit | a34dfe82847dce2db083f4b37554279df0b26307 (patch) | |
tree | a4e3bfc94722ddad934a930323f53f9efd00e661 /subsurface-core/qthelper.cpp | |
parent | 7de22e69b25a90648106c4ecd394828bcaefc50d (diff) | |
download | subsurface-a34dfe82847dce2db083f4b37554279df0b26307.tar.gz |
qthelper.cpp: define EMPTY_DIVE_STRING
The macro is used as a common replacer for the "--"
string when the Dive class members return no particular
information for a "struct dive" property.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/qthelper.cpp')
-rw-r--r-- | subsurface-core/qthelper.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp index 5b499b068..3da904ed3 100644 --- a/subsurface-core/qthelper.cpp +++ b/subsurface-core/qthelper.cpp @@ -38,6 +38,8 @@ static QLocale loc; #define translate(_context, arg) trGettext(arg) static const QString DEGREE_SIGNS("dD" UTF8_DEGREE); +#define EMPTY_DIVE_STRING "--" + Dive::Dive() : m_number(-1), dive(NULL) @@ -156,7 +158,7 @@ int Dive::rating() const void Dive::put_divemaster() { if (!dive->divemaster) - m_divemaster = "--"; + m_divemaster = EMPTY_DIVE_STRING; else m_divemaster = dive->divemaster; } @@ -178,7 +180,7 @@ void Dive::put_location() { m_location = QString::fromUtf8(get_dive_location(dive)); if (m_location.isEmpty()) { - m_location = "--"; + m_location = EMPTY_DIVE_STRING; } } @@ -195,7 +197,7 @@ void Dive::put_duration() void Dive::put_buddy() { if (!dive->buddy) - m_buddy = "--"; + m_buddy = EMPTY_DIVE_STRING; else m_buddy = dive->buddy; } @@ -205,10 +207,10 @@ void Dive::put_temp() m_airTemp = get_temperature_string(dive->airtemp, true); m_waterTemp = get_temperature_string(dive->watertemp, true); if (m_airTemp.isEmpty()) { - m_airTemp = "--"; + m_airTemp = EMPTY_DIVE_STRING; } if (m_waterTemp.isEmpty()) { - m_waterTemp = "--"; + m_waterTemp = EMPTY_DIVE_STRING; } } @@ -216,7 +218,7 @@ void Dive::put_notes() { m_notes = QString::fromUtf8(dive->notes); if (m_notes.isEmpty()) { - m_notes = "--"; + m_notes = EMPTY_DIVE_STRING; return; } if (same_string(dive->dc.model, "planned dive")) { |