From aab351093e3ba713f1179a797d0f5929bdb4c92c Mon Sep 17 00:00:00 2001 From: Arno Date: Tue, 2 Jan 2018 23:10:08 +0100 Subject: Save CachedFileData to disk Since we already have the data, save it to speed up the start. Surprisingly, the hardest part was to figure out how to use QStandardPaths to find a location where to save the file. I went with the semi-hardcoded path HomeLocation/.shemovcleaner, even though we're on windows. --- cachedfiledata.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cachedfiledata.cpp') diff --git a/cachedfiledata.cpp b/cachedfiledata.cpp index 6f51edb..773f411 100644 --- a/cachedfiledata.cpp +++ b/cachedfiledata.cpp @@ -1,3 +1,13 @@ #include "cachedfiledata.h" CachedFileData::CachedFileData() : seconds(0), size(0), attr(-1), copied(false) {} + +QDataStream &operator<<(QDataStream &out, const CachedFileData &cfd){ + out << cfd.fullPath << cfd.name << cfd.mimeType << cfd.duration << cfd.md5Sum << cfd.seconds << cfd.size << cfd.attr << cfd.copied; + return out; +} + +QDataStream &operator>>(QDataStream &in, CachedFileData &cfd){ + in >> cfd.fullPath >> cfd.name >> cfd.mimeType >> cfd.duration >> cfd.md5Sum >> cfd.seconds >> cfd.size >> cfd.attr >> cfd.copied; + return in; +} -- cgit v1.2.3-70-g09d2