Browse Source

RemoteIDManager: QString::mid instead of sliced.

QString::sliced is only introduced with Qt6.

Signed-off-by: Julian Oes <julian@oes.ch>
QGC4.4
Julian Oes 11 months ago
parent
commit
5c1eb25660
No known key found for this signature in database
GPG Key ID: F0ED380FEA56DE41
  1. 8
      src/Vehicle/RemoteIDManager.cc

8
src/Vehicle/RemoteIDManager.cc

@ -423,7 +423,7 @@ void RemoteIDManager::setOperatorID()
_operatorIDGood = _settings->operatorIDValid()->rawValue() == true; _operatorIDGood = _settings->operatorIDValid()->rawValue() == true;
if (_operatorIDGood) { if (_operatorIDGood) {
// Strip private part // Strip private part
_settings->operatorID()->setRawValue(operatorID.sliced(0, 16)); _settings->operatorID()->setRawValue(operatorID.mid(0, 16));
} }
} else { } else {
@ -443,15 +443,15 @@ bool RemoteIDManager::_isEUOperatorIDValid(const QString& operatorID) const
return false; return false;
} }
const QString countryCode = operatorID.sliced(0,3); const QString countryCode = operatorID.mid(0,3);
if (!countryCode.isUpper()) { if (!countryCode.isUpper()) {
qCDebug(RemoteIDManagerLog) << "OperatorID country code not uppercase"; qCDebug(RemoteIDManagerLog) << "OperatorID country code not uppercase";
return false; return false;
} }
const QString number = operatorID.sliced(3, 12); const QString number = operatorID.mid(3, 12);
const QChar checksum = operatorID.at(15); const QChar checksum = operatorID.at(15);
const QString secret = containsDash ? operatorID.sliced(17, 3) : operatorID.sliced(16, 3); const QString secret = containsDash ? operatorID.mid(17, 3) : operatorID.mid(16, 3);
const QString combination = number + secret; const QString combination = number + secret;
const QChar result = _calculateLuhnMod36(combination); const QChar result = _calculateLuhnMod36(combination);

Loading…
Cancel
Save