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>
This commit is contained in:
Dirk Hohndel 2020-01-06 12:43:09 -08:00
parent e1dbf65672
commit daf3821fcc

View file

@ -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;
}