diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-06-02 18:28:02 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-02 23:59:29 -0700 |
commit | d95d1735b5f0fec2941696a4bb1720eb00a6f59c (patch) | |
tree | eae15bb2c25d051150292de7b17429d074c65d36 /qt-ui/simplewidgets.cpp | |
parent | 13e8aba7daee2104c859e17de3363a24c5a885c0 (diff) | |
download | subsurface-d95d1735b5f0fec2941696a4bb1720eb00a6f59c.tar.gz |
Break picture handling code from C++ to C.
This commit breaks the loading of images that were done in the divelist
into smaller bits. A bit of code refactor was done in order to correct the
placement of a few methods.
ShiftTimesDialog::EpochFromExiv got moved to Exif::epoch dive_add_picture
is now used instead of add_event picture_load_exif_data got implemented
using the old listview code. dive_set_geodata_from_picture got
implemented using the old listview code.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 18e176b0d..bb6d2ff2d 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -247,31 +247,12 @@ void ShiftImageTimesDialog::syncCameraClicked() free(mem.buffer); if (retval != PARSE_EXIF_SUCCESS) return; - dcImageEpoch = epochFromExiv(&exiv); + dcImageEpoch = exiv.epoch(); dcDateTime.setTime_t(dcImageEpoch); ui.dcTime->setDateTime(dcDateTime); connect(ui.dcTime, SIGNAL(dateTimeChanged(const QDateTime &)), this, SLOT(dcDateTimeChanged(const QDateTime &))); } -//TODO: This should be moved to C-Code. -time_t ShiftImageTimesDialog::epochFromExiv(EXIFInfo *exif) -{ - struct tm tm; - int year, month, day, hour, min, sec; - - if (strlen(exif->DateTimeOriginal.c_str())) - sscanf(exif->DateTimeOriginal.c_str(), "%d:%d:%d %d:%d:%d", &year, &month, &day, &hour, &min, &sec); - else - sscanf(exif->DateTime.c_str(), "%d:%d:%d %d:%d:%d", &year, &month, &day, &hour, &min, &sec); - tm.tm_year = year; - tm.tm_mon = month - 1; - tm.tm_mday = day; - tm.tm_hour = hour; - tm.tm_min = min; - tm.tm_sec = sec; - return (utc_mktime(&tm)); -} - void ShiftImageTimesDialog::dcDateTimeChanged(const QDateTime &newDateTime) { if (!dcImageEpoch) |