diff options
author | Arno <arno@disconnect.de> | 2018-01-02 23:10:08 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-01-02 23:10:08 +0100 |
commit | aab351093e3ba713f1179a797d0f5929bdb4c92c (patch) | |
tree | 512b6858491e209f4d7be1f9fe46a0921c8523df /cachedfiledata.cpp | |
parent | b5dc8c10367537aec8ce7c061f608ca896ec9f36 (diff) | |
download | ShemovCleaner-aab351093e3ba713f1179a797d0f5929bdb4c92c.tar.gz ShemovCleaner-aab351093e3ba713f1179a797d0f5929bdb4c92c.tar.bz2 ShemovCleaner-aab351093e3ba713f1179a797d0f5929bdb4c92c.zip |
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.
Diffstat (limited to 'cachedfiledata.cpp')
-rw-r--r-- | cachedfiledata.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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; +} |