Code cleanup

We called the helper functions way too often.
Whitespace / coding style adjustments.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-02-17 20:34:09 -08:00
parent 8a4a693cb7
commit 240e269f19

View file

@ -834,33 +834,26 @@ void DiveListView::loadImages()
for_each_dive(j, dive){ for_each_dive(j, dive){
if (!dive->selected) if (!dive->selected)
continue; continue;
// FIXME: this adds the events only to the first DC
if (dive->when - 3600 < imagetime && dive->when + dive->duration.seconds + 3600 > imagetime){ if (dive->when - 3600 < imagetime && dive->when + dive->duration.seconds + 3600 > imagetime){
if (dive->when > imagetime) { if (dive->when > imagetime) {
; // Before dive // Before dive
add_event(&(dive->dc), 0, 123, 0, 0, fileNames.at(i).toUtf8().data()); add_event(&(dive->dc), 0, 123, 0, 0, fileNames.at(i).toUtf8().data());
MainWindow::instance()->refreshDisplay(); } else if (dive->when + dive->duration.seconds < imagetime){
mark_divelist_changed(true); // After dive
}
else if (dive->when + dive->duration.seconds < imagetime){
; // After dive
add_event(&(dive->dc), dive->duration.seconds, 123, 0, 0, fileNames.at(i).toUtf8().data()); add_event(&(dive->dc), dive->duration.seconds, 123, 0, 0, fileNames.at(i).toUtf8().data());
MainWindow::instance()->refreshDisplay(); } else {
mark_divelist_changed(true);
}
else {
add_event(&(dive->dc), imagetime - dive->when, 123, 0, 0, fileNames.at(i).toUtf8().data()); add_event(&(dive->dc), imagetime - dive->when, 123, 0, 0, fileNames.at(i).toUtf8().data());
MainWindow::instance()->refreshDisplay();
mark_divelist_changed(true);
} }
if (!dive->latitude.udeg && !IS_FP_SAME(exif.GeoLocation.Latitude, 0.0)){ if (!dive->latitude.udeg && !IS_FP_SAME(exif.GeoLocation.Latitude, 0.0)){
dive->latitude.udeg = lrint(1000000.0 * exif.GeoLocation.Latitude); dive->latitude.udeg = lrint(1000000.0 * exif.GeoLocation.Latitude);
dive->longitude.udeg = lrint(1000000.0 * exif.GeoLocation.Longitude); dive->longitude.udeg = lrint(1000000.0 * exif.GeoLocation.Longitude);
}
mark_divelist_changed(true); mark_divelist_changed(true);
}
}
}
MainWindow::instance()->refreshDisplay(); MainWindow::instance()->refreshDisplay();
}
}
}
}
} }
void DiveListView::uploadToDivelogsDE() void DiveListView::uploadToDivelogsDE()