aboutsummaryrefslogtreecommitdiffstats
path: root/core/metadata.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-06 12:43:09 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-10 02:37:03 +0900
commitdaf3821fcceda2407bfff0a11ed2412401d05333 (patch)
tree85f0f8622abbb4738321ddefe840d84f02986b4e /core/metadata.cpp
parente1dbf656720d08c6cddd4082bfd22ef6b80b2494 (diff)
downloadsubsurface-daf3821fcceda2407bfff0a11ed2412401d05333.tar.gz
code cleanup: replace created() with birthTime() for Qt >= 5.10
We still support Qt5.9 for now, so we need the version check as birthTime() wasn't available in 5.9. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/metadata.cpp')
-rw-r--r--core/metadata.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/metadata.cpp b/core/metadata.cpp
index dae261b93..8692ea30f 100644
--- a/core/metadata.cpp
+++ b/core/metadata.cpp
@@ -540,9 +540,12 @@ extern "C" mediatype_t get_metadata(const char *filename_in, metadata *data)
// If we couldn't get a creation date from the file (for example AVI files don't
// have a standard way of storing this datum), use the file creation date of the file.
- // TODO: QFileInfo::created is deprecated in newer Qt versions.
if (data->timestamp == 0)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ data->timestamp = QFileInfo(filename).birthTime().toMSecsSinceEpoch() / 1000;
+#else
data->timestamp = QFileInfo(filename).created().toMSecsSinceEpoch() / 1000;
+#endif
return res;
}