added image support

This commit is contained in:
Agel committed 2026-03-29 20:49:45 +02:00
1 parent 1c8277f7e9
commit bf31f5ca98
12 files changed
+644 -33

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
#pragma once
#include <QByteArray>
#include <minizip/unzip.h>
namespace ZipUtils {
// Read a single file from an open unzFile handle by name.
// Returns empty QByteArray on failure.
inline QByteArray readZipEntry(unzFile zf, const char *entryName)
{
if (unzLocateFile(zf, entryName, 0) != UNZ_OK)
return {};
if (unzOpenCurrentFile(zf) != UNZ_OK)
return {};
QByteArray result;
char buf[4096];
int bytesRead;
while ((bytesRead = unzReadCurrentFile(zf, buf, sizeof(buf))) > 0)
result.append(buf, bytesRead);
unzCloseCurrentFile(zf);
return (bytesRead == 0) ? result : QByteArray{};
}
} // namespace ZipUtils