Massive automated whitespace cleanup

I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-02-27 20:09:57 -08:00
parent 006265d7a0
commit 76e6420f6b
114 changed files with 4370 additions and 3717 deletions

View file

@ -9,23 +9,23 @@
#define tr(_arg) MainWindow::instance()->information()->tr(_arg)
DiveComputerList::DiveComputerList()
{
}
DiveComputerList::~DiveComputerList()
{
}
bool DiveComputerNode::operator == (const DiveComputerNode &a) const {
bool DiveComputerNode::operator==(const DiveComputerNode &a) const
{
return this->model == a.model &&
this->deviceId == a.deviceId &&
this->firmware == a.firmware &&
this->serialNumber == a.serialNumber &&
this->nickName == a.nickName;
this->deviceId == a.deviceId &&
this->firmware == a.firmware &&
this->serialNumber == a.serialNumber &&
this->nickName == a.nickName;
}
bool DiveComputerNode::operator !=(const DiveComputerNode &a) const {
bool DiveComputerNode::operator!=(const DiveComputerNode &a) const
{
return !(*this == a);
}
@ -36,13 +36,13 @@ bool DiveComputerNode::changesValues(const DiveComputerNode &b) const
return false;
}
return (b.firmware != "" && this->firmware != b.firmware) ||
(b.serialNumber != "" && this->serialNumber != b.serialNumber) ||
(b.nickName != "" && this->nickName != b.nickName);
(b.serialNumber != "" && this->serialNumber != b.serialNumber) ||
(b.nickName != "" && this->nickName != b.nickName);
}
const DiveComputerNode *DiveComputerList::getExact(QString m, uint32_t d)
{
for (QMap<QString,DiveComputerNode>::iterator it = dcMap.find(m); it != dcMap.end() && it.key() == m; ++it)
for (QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m); it != dcMap.end() && it.key() == m; ++it)
if (it->deviceId == d)
return &*it;
return NULL;
@ -50,7 +50,7 @@ const DiveComputerNode *DiveComputerList::getExact(QString m, uint32_t d)
const DiveComputerNode *DiveComputerList::get(QString m)
{
QMap<QString,DiveComputerNode>::iterator it = dcMap.find(m);
QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m);
if (it != dcMap.end())
return &*it;
return NULL;
@ -90,21 +90,26 @@ QString weight_string(int weight_in_grams)
if (get_units()->weight == units::KG) {
int gr = weight_in_grams % 1000;
int kg = weight_in_grams / 1000;
if (kg >= 20.0) {
str = QString("0");
} else {
str = QString("%1.%2").arg(kg).arg((unsigned)(gr) / 100);
}
if (kg >= 20.0) {
str = QString("0");
} else {
str = QString("%1.%2").arg(kg).arg((unsigned)(gr) / 100);
}
} else {
double lbs = grams_to_lbs(weight_in_grams);
str = QString("%1").arg(lbs, 0, 'f', lbs >= 40.0 ? 0 : 1 );
str = QString("%1").arg(lbs, 0, 'f', lbs >= 40.0 ? 0 : 1);
}
return (str);
}
bool parseGpsText(const QString& gps_text, double *latitude, double *longitude)
bool parseGpsText(const QString &gps_text, double *latitude, double *longitude)
{
enum { ISO6709D, SECONDS, MINUTES, DECIMAL } gpsStyle = ISO6709D;
enum {
ISO6709D,
SECONDS,
MINUTES,
DECIMAL
} gpsStyle = ISO6709D;
int eastWest = 4;
int northSouth = 1;
QString regExp;
@ -123,41 +128,59 @@ bool parseGpsText(const QString& gps_text, double *latitude, double *longitude)
if (gps_text.at(0).isDigit() && (gps_text.count(",") % 2) == 0) {
gpsStyle = ISO6709D;
regExp = QString("(\\d+)[" UTF8_DEGREE "\\s](\\d+)[\'\\s](\\d+)([,\\.](\\d+))?[\"\\s]([NS%1%2])"
"\\s*(\\d+)[" UTF8_DEGREE "\\s](\\d+)[\'\\s](\\d+)([,\\.](\\d+))?[\"\\s]([EW%3%4])")
.arg(tr("N")).arg(tr("S")).arg(tr("E")).arg(tr("W"));
"\\s*(\\d+)[" UTF8_DEGREE "\\s](\\d+)[\'\\s](\\d+)([,\\.](\\d+))?[\"\\s]([EW%3%4])")
.arg(tr("N"))
.arg(tr("S"))
.arg(tr("E"))
.arg(tr("W"));
} else if (gps_text.count(QChar('"')) == 2) {
gpsStyle = SECONDS;
regExp = QString("\\s*([NS%1%2])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)[\'\\s]+(\\d+)([,\\.](\\d+))?[^EW%3%4]*"
"([EW%6%7])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)[\'\\s]+(\\d+)([,\\.](\\d+))?")
.arg(tr("N")).arg(tr("S")).arg(tr("E")).arg(tr("W")).arg(tr("E")).arg(tr("W"));
"([EW%6%7])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)[\'\\s]+(\\d+)([,\\.](\\d+))?")
.arg(tr("N"))
.arg(tr("S"))
.arg(tr("E"))
.arg(tr("W"))
.arg(tr("E"))
.arg(tr("W"));
} else if (gps_text.count(QChar('\'')) == 2) {
gpsStyle = MINUTES;
regExp = QString("\\s*([NS%1%2])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)([,\\.](\\d+))?[^EW%3%4]*"
"([EW%6%7])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)([,\\.](\\d+))?")
.arg(tr("N")).arg(tr("S")).arg(tr("E")).arg(tr("W")).arg(tr("E")).arg(tr("W"));
"([EW%6%7])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)([,\\.](\\d+))?")
.arg(tr("N"))
.arg(tr("S"))
.arg(tr("E"))
.arg(tr("W"))
.arg(tr("E"))
.arg(tr("W"));
} else {
gpsStyle = DECIMAL;
regExp = QString("\\s*([-NS%1%2]?)\\s*(\\d+)[,\\.](\\d+)[^-EW%3%4\\d]*([-EW%5%6]?)\\s*(\\d+)[,\\.](\\d+)")
.arg(tr("N")).arg(tr("S")).arg(tr("E")).arg(tr("W")).arg(tr("E")).arg(tr("W"));
.arg(tr("N"))
.arg(tr("S"))
.arg(tr("E"))
.arg(tr("W"))
.arg(tr("E"))
.arg(tr("W"));
}
QRegExp r(regExp);
if (r.indexIn(gps_text) != -1) {
// qDebug() << "Hemisphere" << r.cap(1) << "deg" << r.cap(2) << "min" << r.cap(3) << "decimal" << r.cap(4);
// qDebug() << "Hemisphere" << r.cap(5) << "deg" << r.cap(6) << "min" << r.cap(7) << "decimal" << r.cap(8);
switch(gpsStyle) {
switch (gpsStyle) {
case ISO6709D:
*latitude = r.cap(1).toInt() + r.cap(2).toInt() / 60.0 +
(r.cap(3) + QString(".") + r.cap(5)).toDouble() / 3600.0;
(r.cap(3) + QString(".") + r.cap(5)).toDouble() / 3600.0;
*longitude = r.cap(7).toInt() + r.cap(8).toInt() / 60.0 +
(r.cap(9) + QString(".") + r.cap(11)).toDouble() / 3600.0;
(r.cap(9) + QString(".") + r.cap(11)).toDouble() / 3600.0;
northSouth = 6;
eastWest = 12;
break;
case SECONDS:
*latitude = r.cap(2).toInt() + r.cap(3).toInt() / 60.0 +
(r.cap(4) + QString(".") + r.cap(6)).toDouble() / 3600.0;
(r.cap(4) + QString(".") + r.cap(6)).toDouble() / 3600.0;
*longitude = r.cap(8).toInt() + r.cap(9).toInt() / 60.0 +
(r.cap(10) + QString(".") + r.cap(12)).toDouble() / 3600.0;
(r.cap(10) + QString(".") + r.cap(12)).toDouble() / 3600.0;
eastWest = 7;
break;
case MINUTES:
@ -166,7 +189,7 @@ bool parseGpsText(const QString& gps_text, double *latitude, double *longitude)
eastWest = 6;
break;
case DECIMAL:
default:
default:
*latitude = (r.cap(2) + QString(".") + r.cap(3)).toDouble();
*longitude = (r.cap(5) + QString(".") + r.cap(6)).toDouble();
break;
@ -181,7 +204,7 @@ bool parseGpsText(const QString& gps_text, double *latitude, double *longitude)
return false;
}
bool gpsHasChanged(struct dive *dive, struct dive *master, const QString& gps_text, bool *parsed)
bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed)
{
double latitude, longitude;
int latudeg, longudeg;
@ -207,12 +230,12 @@ bool gpsHasChanged(struct dive *dive, struct dive *master, const QString& gps_te
return true;
}
QList< int > getDivesInTrip ( dive_trip_t* trip )
QList<int> getDivesInTrip(dive_trip_t *trip)
{
QList<int> ret;
for(int i = 0; i < dive_table.nr; i++){
for (int i = 0; i < dive_table.nr; i++) {
struct dive *d = get_dive(i);
if (d->divetrip == trip){
if (d->divetrip == trip) {
ret.push_back(get_divenr(d));
}
}