From 19ce57e6801be0bf8ecee399b98d196700e94c22 Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Thu, 29 Feb 2024 08:56:59 +0100 Subject: [PATCH] PersistentData: save only if data has changed --- src/ATBAPP/support/PersistentData.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ATBAPP/support/PersistentData.cpp b/src/ATBAPP/support/PersistentData.cpp index cfcf305..e3b70ce 100644 --- a/src/ATBAPP/support/PersistentData.cpp +++ b/src/ATBAPP/support/PersistentData.cpp @@ -30,7 +30,10 @@ PersistentData::PersistentData(const QString &datafileName, QObject *parent) void PersistentData::serializeToFile() { - this->save(); + if (this->isChangedFlag) { + qCritical() << "PersistentData::isChanged -> save"; + this->save(); + } } void PersistentData::save() @@ -44,6 +47,8 @@ void PersistentData::save() out << this->hash; fileOut.flush(); fileOut.close(); + + this->isChangedFlag = false; } }