mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-15 10:04:13 +02:00
Merge master into feat/qetz-db-truth-v2
The .qetz files take this branch's side: it already holds #1473, and adds the folio parts to join(). qetscriptapi.cpp: #1456 gave setConductorProperty() the voltage that crosses a function separated terminal element; here that function hands its work to applyConductorProperties(), so the change goes there, with the properties captured before the pushes. The database path for folios not built already gives up at such a terminal, so it builds the folio and takes the same route. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+20
-5
@@ -49,6 +49,7 @@
|
||||
#include "qetversion.h"
|
||||
#include "undocommand/adddiagramcommand.h"
|
||||
|
||||
#include <QCryptographicHash>
|
||||
#include <QElapsedTimer>
|
||||
#include <QHash>
|
||||
#include <QTimer>
|
||||
@@ -417,11 +418,25 @@ QUuid QETProject::derivedUuid(const QByteArray &content)
|
||||
static const QUuid project_namespace(
|
||||
QStringLiteral("{c8c75719-0fea-4b1c-9f4b-2dd179fb2f0c}"));
|
||||
|
||||
QByteArray normalized(content);
|
||||
normalized.replace('\r', QByteArray());
|
||||
return QUuid::createUuidV5(project_namespace,
|
||||
QByteArrayLiteral("qet-project-legacy\n")
|
||||
+ normalized);
|
||||
//Same result as QUuid::createUuidV5(project_namespace,
|
||||
//"qet-project-legacy\n" + content without '\r'), hashed in place :
|
||||
//copying the content twice took 2 s of opening a 263 MB project.
|
||||
QCryptographicHash hash(QCryptographicHash::Sha1);
|
||||
hash.addData(project_namespace.toRfc4122());
|
||||
hash.addData(QByteArrayView("qet-project-legacy\n"));
|
||||
const QByteArrayView view(content);
|
||||
qsizetype start = 0;
|
||||
while (start < view.size()) {
|
||||
qsizetype cr = view.indexOf('\r', start);
|
||||
if (cr < 0)
|
||||
cr = view.size();
|
||||
hash.addData(view.sliced(start, cr - start));
|
||||
start = cr + 1;
|
||||
}
|
||||
QByteArray bytes = hash.result().left(16);
|
||||
bytes[6] = char((bytes[6] & 0x0F) | 0x50); // version 5
|
||||
bytes[8] = char((bytes[8] & 0x3F) | 0x80); // RFC 4122 variant
|
||||
return QUuid::fromRfc4122(bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user