From 7d37a3f5a65d03df917e63614a76fb95e8bc966f Mon Sep 17 00:00:00 2001 From: Jan Darowski Date: Sat, 14 Mar 2015 15:35:47 +0100 Subject: Refactored image timestamp checking. Seperated getting image timestamp from picture_load_exif_data() and ShiftImageTimesDialog::syncCameraClicked() into picture_get_timestamp() and seperated checking timestamp from dive_create_picture() to dive_check_picture_time(). Signed-off-by: Jan Darowski Signed-off-by: Dirk Hohndel --- qt-ui/simplewidgets.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index ecb8a8bc9..8a0f2b090 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -272,9 +272,7 @@ void ShiftImageTimesDialog::buttonClicked(QAbstractButton *button) void ShiftImageTimesDialog::syncCameraClicked() { - struct memblock mem; - EXIFInfo exiv; - int retval; + timestamp_t timestamp; QPixmap picture; QDateTime dcDateTime = QDateTime(); QStringList fileNames = QFileDialog::getOpenFileNames(this, @@ -290,13 +288,9 @@ void ShiftImageTimesDialog::syncCameraClicked() scene->addPixmap(picture.scaled(ui.DCImage->size())); ui.DCImage->setScene(scene); - if (readfile(fileNames.at(0).toUtf8().data(), &mem) <= 0) - return; - retval = exiv.parseFrom((const unsigned char *)mem.buffer, (unsigned)mem.size); - free(mem.buffer); - if (retval != PARSE_EXIF_SUCCESS) - return; - dcImageEpoch = exiv.epoch(); + + picture_get_timestamp(fileNames.at(0).toUtf8().data(), ×tamp); + dcImageEpoch = timestamp; dcDateTime.setTime_t(dcImageEpoch); ui.dcTime->setDateTime(dcDateTime); connect(ui.dcTime, SIGNAL(dateTimeChanged(const QDateTime &)), this, SLOT(dcDateTimeChanged(const QDateTime &))); -- cgit v1.2.3-70-g09d2