Merge master into feat/changed-on-disk-check

Conflicts: QETProject::write() now checks for a change on disk before it
keeps the previous version; both new tests kept in tests/qttest/CMakeLists.txt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MgPFANhWgD66V3v9KVKV58
This commit is contained in:
ispyisail
2026-10-16 17:44:42 +13:00
26 changed files with 1213 additions and 70 deletions
+19
View File
@@ -48,6 +48,7 @@
#include "qetinformation.h"
#include "qetversion.h"
#include "undocommand/adddiagramcommand.h"
#include "utils/previousversions.h"
#include <QCryptographicHash>
#include <QElapsedTimer>
@@ -521,6 +522,7 @@ QETProject::ProjectState QETProject::openFile(QFile *file)
if (!read)
{
qWarning().noquote() << "Unable to read" << fi.fileName() << ":" << read_error;
m_open_error = read_error;
m_container_pictures.clear();
m_folio_parts.clear();
if(opened_here) {
@@ -609,6 +611,16 @@ QETProject::ProjectState QETProject::state() const
return(m_state);
}
/**
@brief QETProject::openError
@return why the file could not be read, when state() is
XmlParsingFailed: "picture ... is missing", say; empty otherwise
*/
QString QETProject::openError() const
{
return m_open_error;
}
/**
@return la liste des schemas de ce projet
*/
@@ -2832,6 +2844,13 @@ QETResult QETProject::write(bool overwrite_changed)
.arg(QLocale::system().toString(when, QLocale::ShortFormat))));
}
//The file as it was goes among its previous versions first
//(Settings > General > Projects); a copy that fails does not stop
//the save
QString backup_error;
if (!PreviousVersions::keep(m_file_path, PreviousVersions::count(), &backup_error))
qWarning().noquote() << "Previous version of" << m_file_path << "not kept:" << backup_error;
QString error_message;
if (isContainerPath(m_file_path))
{