mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Add getFingerprint method to detect all changes in UserMetricSettings
Fixes #3838
This commit is contained in:
@@ -179,11 +179,11 @@ quint16
|
||||
RideMetric::userMetricFingerprint(QList<UserMetricSettings> these)
|
||||
{
|
||||
// run through loaded metrics and compute a fingerprint CRC
|
||||
QByteArray fingers;
|
||||
quint16 fingerprint = 0;
|
||||
foreach(UserMetricSettings x, these)
|
||||
fingers += x.fingerprint.toLocal8Bit();
|
||||
fingerprint += x.getFingerprint();
|
||||
|
||||
return qChecksum(fingers.constData(), fingers.size());
|
||||
return fingerprint;
|
||||
}
|
||||
|
||||
QHash<QString,RideMetricPtr>
|
||||
|
||||
@@ -45,24 +45,23 @@ class UserMetricSettings {
|
||||
|
||||
public:
|
||||
|
||||
bool operator!= (UserMetricSettings right) const {
|
||||
qint16 getFingerprint() const {
|
||||
|
||||
// mostly used to see if it changed when editing
|
||||
if (this->symbol != right.symbol ||
|
||||
this->name != right.name ||
|
||||
this->description != right.description ||
|
||||
this->unitsMetric != right.unitsMetric ||
|
||||
this->unitsImperial != right.unitsImperial ||
|
||||
this->conversion != right.conversion ||
|
||||
this->conversionSum != right.conversionSum ||
|
||||
this->program != right.program ||
|
||||
this->precision != right.precision ||
|
||||
this->istime != right.istime ||
|
||||
this->aggzero != right.aggzero ||
|
||||
this->fingerprint != right.fingerprint)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
QByteArray ba = QString(this->symbol +
|
||||
this->name +
|
||||
this->description +
|
||||
this->unitsMetric +
|
||||
this->unitsImperial +
|
||||
this->type +
|
||||
this->precision +
|
||||
this->aggzero +
|
||||
this->istime +
|
||||
this->conversion +
|
||||
this->conversionSum +
|
||||
this->program).toUtf8();
|
||||
|
||||
return qChecksum(ba, ba.length());
|
||||
}
|
||||
|
||||
QString symbol,
|
||||
|
||||
Reference in New Issue
Block a user