Random whitespace cleanup

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-01-11 06:14:45 -08:00
parent 3c1a111404
commit 19e95efd6f
5 changed files with 92 additions and 97 deletions

View file

@ -11,35 +11,34 @@ static QString EMPTY_DIVE_STRING = QStringLiteral("--");
static QString getFormattedWeight(struct dive *dive, unsigned int idx)
{
weightsystem_t *weight = &dive->weightsystem[idx];
if (!weight->description)
return QString(EMPTY_DIVE_STRING);
QString fmt = QString(weight->description);
fmt += ", " + get_weight_string(weight->weight, true);
return fmt;
weightsystem_t *weight = &dive->weightsystem[idx];
if (!weight->description)
return QString(EMPTY_DIVE_STRING);
QString fmt = QString(weight->description);
fmt += ", " + get_weight_string(weight->weight, true);
return fmt;
}
static QString getFormattedCylinder(struct dive *dive, unsigned int idx)
{
cylinder_t *cyl = &dive->cylinder[idx];
const char *desc = cyl->type.description;
if (!desc && idx > 0)
return QString(EMPTY_DIVE_STRING);
QString fmt = desc ? QString(desc) : QObject::tr("unknown");
fmt += ", " + get_volume_string(cyl->type.size, true, 0);
fmt += ", " + get_pressure_string(cyl->type.workingpressure, true);
fmt += ", " + get_pressure_string(cyl->start, false) + " - " + get_pressure_string(cyl->end, true);
fmt += ", " + get_gas_string(cyl->gasmix);
return fmt;
cylinder_t *cyl = &dive->cylinder[idx];
const char *desc = cyl->type.description;
if (!desc && idx > 0)
return QString(EMPTY_DIVE_STRING);
QString fmt = desc ? QString(desc) : QObject::tr("unknown");
fmt += ", " + get_volume_string(cyl->type.size, true, 0);
fmt += ", " + get_pressure_string(cyl->type.workingpressure, true);
fmt += ", " + get_pressure_string(cyl->start, false) + " - " + get_pressure_string(cyl->end, true);
fmt += ", " + get_gas_string(cyl->gasmix);
return fmt;
}
DiveObjectHelper::DiveObjectHelper(struct dive *d) :
m_number(d->number),
DiveObjectHelper::DiveObjectHelper(struct dive *d) : m_number(d->number),
m_id(d->id),
m_rating(d->rating),
m_timestamp(d->when),
m_location(get_dive_location(d) ? QString::fromUtf8(get_dive_location(d)) : EMPTY_DIVE_STRING),
m_duration(get_dive_duration_string(d->duration.seconds, QObject::tr("h:"), QObject::tr("min"))),
m_duration(get_dive_duration_string(d->duration.seconds, QObject::tr("h:"), QObject::tr("min"))),
m_depth(get_depth_string(d->dc.maxdepth.mm, true, true)),
m_divemaster(d->divemaster ? d->divemaster : EMPTY_DIVE_STRING),
m_buddy(d->buddy ? d->buddy : EMPTY_DIVE_STRING),
@ -68,7 +67,7 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) :
if (same_string(d->dc.model, "planned dive")) {
QTextDocument notes;
QString notesFormatted = m_notes;
#define _NOTES_BR "&#92n"
#define _NOTES_BR "&#92n"
notesFormatted = notesFormatted.replace("<thead>", "<thead>" _NOTES_BR);
notesFormatted = notesFormatted.replace("<br>", "<br>" _NOTES_BR);
notesFormatted = notesFormatted.replace("<tr>", "<tr>" _NOTES_BR);
@ -76,7 +75,7 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) :
notes.setHtml(notesFormatted);
m_notes = notes.toPlainText();
m_notes.replace(_NOTES_BR, "<br>");
#undef _NOTES_BR
#undef _NOTES_BR
} else {
m_notes.replace("\n", "<br>");
}
@ -213,7 +212,7 @@ QString DiveObjectHelper::sac() const
QStringList DiveObjectHelper::weights() const
{
return m_weights;
return m_weights;
}
QString DiveObjectHelper::weight(int idx) const

View file

@ -7,7 +7,7 @@
#include <QStringList>
class DiveObjectHelper : public QObject {
Q_OBJECT
Q_OBJECT
Q_PROPERTY(int number READ number CONSTANT)
Q_PROPERTY(int id READ id CONSTANT)
Q_PROPERTY(int rating READ rating CONSTANT)
@ -32,62 +32,62 @@ class DiveObjectHelper : public QObject {
Q_PROPERTY(QString maxcns READ maxcns CONSTANT)
Q_PROPERTY(QString otu READ otu CONSTANT)
public:
DiveObjectHelper(struct dive *dive = NULL);
~DiveObjectHelper();
int number() const;
int id() const;
int rating() const;
QString date() const;
timestamp_t timestamp() const;
QString time() const;
QString location() const;
QString gps() const;
QString duration() const;
QString depth() const;
QString divemaster() const;
QString buddy() const;
QString airTemp() const;
QString waterTemp() const;
QString notes() const;
QString tags() const;
QString gas() const;
QString sac() const;
QStringList weights() const;
QString weight(int idx) const;
QString suit() const;
QStringList cylinders() const;
QString cylinder(int idx) const;
QString trip() const;
QString maxcns() const;
QString otu() const;
private:
int m_number;
int m_id;
int m_rating;
QString m_date;
timestamp_t m_timestamp;
QString m_time;
QString m_location;
QString m_gps;
QString m_duration;
QString m_depth;
QString m_divemaster;
QString m_buddy;
QString m_airTemp;
QString m_waterTemp;
QString m_notes;
QString m_tags;
QString m_gas;
QString m_sac;
QStringList m_weights;
QString m_suit;
QStringList m_cylinders;
QString m_trip;
QString m_maxcns;
QString m_otu;
struct dive *m_dive;
DiveObjectHelper(struct dive *dive = NULL);
~DiveObjectHelper();
int number() const;
int id() const;
int rating() const;
QString date() const;
timestamp_t timestamp() const;
QString time() const;
QString location() const;
QString gps() const;
QString duration() const;
QString depth() const;
QString divemaster() const;
QString buddy() const;
QString airTemp() const;
QString waterTemp() const;
QString notes() const;
QString tags() const;
QString gas() const;
QString sac() const;
QStringList weights() const;
QString weight(int idx) const;
QString suit() const;
QStringList cylinders() const;
QString cylinder(int idx) const;
QString trip() const;
QString maxcns() const;
QString otu() const;
private:
int m_number;
int m_id;
int m_rating;
QString m_date;
timestamp_t m_timestamp;
QString m_time;
QString m_location;
QString m_gps;
QString m_duration;
QString m_depth;
QString m_divemaster;
QString m_buddy;
QString m_airTemp;
QString m_waterTemp;
QString m_notes;
QString m_tags;
QString m_gas;
QString m_sac;
QStringList m_weights;
QString m_suit;
QStringList m_cylinders;
QString m_trip;
QString m_maxcns;
QString m_otu;
struct dive *m_dive;
};
Q_DECLARE_METATYPE(DiveObjectHelper*)
Q_DECLARE_METATYPE(DiveObjectHelper *)
#endif