PersistentData: save only if data has changed
This commit is contained in:
		@@ -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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user