old render cleanup part 3
This commit is contained in:
45 files changed
+1057
-1135
No files matched your search
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QCryptographicHash>
|
||||
#include <QFile>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -22,4 +24,15 @@ public:
|
||||
// MD5 of the source. For archives: MD5 of file bytes.
|
||||
// For directories: MD5 of sorted "name:size\n" lines.
|
||||
virtual QByteArray contentHash() const = 0;
|
||||
|
||||
// Shared MD5 calculation for files on disk.
|
||||
static QByteArray hashFileMd5(const QString &filePath)
|
||||
{
|
||||
if (filePath.isEmpty())
|
||||
return {};
|
||||
QFile f(filePath);
|
||||
if (f.open(QIODevice::ReadOnly))
|
||||
return QCryptographicHash::hash(f.readAll(), QCryptographicHash::Md5);
|
||||
return {};
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user