successfully transmit block map

Requires a binary data type, which requires a new project serializer
This commit is contained in:
itsmattkc
2023-02-20 14:56:04 -08:00
parent 43f1be9c06
commit ffec819eef
16 changed files with 1611 additions and 501 deletions
+10 -2
View File
@@ -32,6 +32,7 @@
#include "serializer210907.h"
#include "serializer211228.h"
#include "serializer220403.h"
#include "serializer230220.h"
namespace olive {
@@ -48,6 +49,7 @@ void ProjectSerializer::Initialize()
instances_.append(new ProjectSerializer210907);
instances_.append(new ProjectSerializer211228);
instances_.append(new ProjectSerializer220403);
instances_.append(new ProjectSerializer230220);
}
void ProjectSerializer::Destroy()
@@ -64,9 +66,9 @@ ProjectSerializer::Result ProjectSerializer::Load(Project *project, const QStrin
// Some project files are compressed, marked with "OVEC" at the beginning of the file. Check for
// that signature now.
std::unique_ptr<QXmlStreamReader> reader;
QByteArray b = project_file.read(4);
if (!memcmp(b.data(), "OVEC", 4)) {
if (CheckCompressedID(&project_file)) {
// File is compressed, decompress into memory
QByteArray b;
b = qUncompress(project_file.readAll());
reader.reset(new QXmlStreamReader(b));
} else {
@@ -256,6 +258,12 @@ ProjectSerializer::Result ProjectSerializer::Copy(const SaveData &data, const QS
return res;
}
bool ProjectSerializer::CheckCompressedID(QFile *file)
{
QByteArray b = file->read(4);
return !memcmp(b.data(), "OVEC", 4);
}
bool ProjectSerializer::IsCancelled() const
{
return false;