mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-14 17:44:13 +02:00
.qetz: no columns for where a block sat; open a later format read-only
The database held where each moved block sat among its parent's children (props_at, info_at, links_at), though reading only asked whether there was one: the marker the folio file keeps says that, and where it goes back. The columns are gone; format 2 files leave the same markers and still open. A .qetz of a later format whose min-reader allows this version was still refused by the database's own format check. It opens now, read-only, with a message: saving it here could lose what this version does not know. Save As writes a copy in this version's format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-2
@@ -456,7 +456,8 @@ QETProject::ProjectState QETProject::openFile(QFile *file)
|
||||
// QetContainer::parse() does exactly that, for a .qet and for each part
|
||||
// of a .qetz alike.
|
||||
QString read_error;
|
||||
if (!QetContainer::readDocument(content, &xml_project, &read_error))
|
||||
int container_format = 0;
|
||||
if (!QetContainer::readDocument(content, &xml_project, &read_error, &container_format))
|
||||
{
|
||||
qWarning().noquote() << "Unable to read" << fi.fileName() << ":" << read_error;
|
||||
if(opened_here) {
|
||||
@@ -489,9 +490,16 @@ QETProject::ProjectState QETProject::openFile(QFile *file)
|
||||
<< xml_parse_ms / 1000.0 << ", content "
|
||||
<< (total_ms - xml_parse_ms) / 1000.0 << ")";
|
||||
|
||||
if (!fi.isWritable()) {
|
||||
//Written by a later QElectroTech that lets this one read it: saving
|
||||
//here would drop what this version does not know
|
||||
m_from_later_version = container_format > QetContainer::Format;
|
||||
if (!fi.isWritable() || m_from_later_version) {
|
||||
setReadOnly(true);
|
||||
}
|
||||
if (m_from_later_version) {
|
||||
qInfo().noquote() << QStringLiteral("Project %1 is of .qetz format %2 (this version writes %3): opened read-only")
|
||||
.arg(fi.fileName()).arg(container_format).arg(QetContainer::Format);
|
||||
}
|
||||
if(opened_here) {
|
||||
file->close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user