Printing: insert placeholders in empty feilds

Don't leave fields empty, this may corrupt the layout, a better way is
to insert placeholders for empty data, which also provides a better UX.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
This commit is contained in:
Gehad elrobey 2015-08-09 01:12:15 +02:00 committed by Lubomir I. Ivanov
parent d72ba4f15a
commit 06e2fab291

View file

@ -211,7 +211,7 @@ int Dive::rating() const
void Dive::put_divemaster() void Dive::put_divemaster()
{ {
if (!dive->divemaster) if (!dive->divemaster)
m_divemaster = ""; m_divemaster = "--";
else else
m_divemaster = dive->divemaster; m_divemaster = dive->divemaster;
} }
@ -227,6 +227,9 @@ void Dive::put_date_time()
void Dive::put_location() void Dive::put_location()
{ {
m_location = QString::fromUtf8(get_dive_location(dive)); m_location = QString::fromUtf8(get_dive_location(dive));
if (m_location.isEmpty()) {
m_location = "--";
}
} }
void Dive::put_depth() void Dive::put_depth()
@ -242,7 +245,7 @@ void Dive::put_duration()
void Dive::put_buddy() void Dive::put_buddy()
{ {
if (!dive->buddy) if (!dive->buddy)
m_buddy = ""; m_buddy = "--";
else else
m_buddy = dive->buddy; m_buddy = dive->buddy;
} }
@ -251,11 +254,20 @@ void Dive::put_temp()
{ {
m_airTemp = get_temperature_string(dive->airtemp, true); m_airTemp = get_temperature_string(dive->airtemp, true);
m_waterTemp = get_temperature_string(dive->watertemp, true); m_waterTemp = get_temperature_string(dive->watertemp, true);
if (m_airTemp.isEmpty()) {
m_airTemp = "--";
}
if (m_waterTemp.isEmpty()) {
m_waterTemp = "--";
}
} }
void Dive::put_notes() void Dive::put_notes()
{ {
m_notes = QString::fromUtf8(dive->notes); m_notes = QString::fromUtf8(dive->notes);
if (m_notes.isEmpty()) {
m_notes = "--";
}
} }
void Dive::put_tags() void Dive::put_tags()