Skip to content

Commit

Permalink
Use standard validation display for operator id
Browse files Browse the repository at this point in the history
  • Loading branch information
DonLakeFlyer committed Dec 21, 2024
1 parent 6f7af6d commit d606c2b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/UI/preferences/RemoteIDSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,6 @@ SettingsPage {
SettingsGroupLayout {
heading: qsTr("Operator ID")
Layout.fillWidth: true
outerBorderColor: (_regionOperation === RemoteIDSettings.RegionOperation.EU || remoteIDSettings.sendOperatorID.value) ?
(_activeRID && !_remoteIDManager.operatorIDGood ? qgcPal.colorRed : defaultBorderColor) : defaultBorderColor

FactCheckBoxSlider {
text: qsTr("Broadcast%1").arg(isEURegion ? " (EU Required)" : "")
Expand Down Expand Up @@ -375,12 +373,24 @@ SettingsPage {
}

QGCTextField {
id: operatorIDTextField
Layout.preferredWidth: textFieldWidth
Layout.fillWidth: true
text: operatorIDFact.valueString
visible: operatorIDFact.visible
maximumLength: 20 // Maximum defined by Mavlink definition of OPEN_DRONE_ID_OPERATOR_ID message

property bool operatorIDInvalid: ((_regionOperation === RemoteIDSettings.RegionOperation.EU || remoteIDSettings.sendOperatorID.value) &&
_activeRID && !_remoteIDManager.operatorIDGood)

onOperatorIDInvalidChanged: {
if (operatorIDInvalid) {
operatorIDTextField.showValidationError(qsTr("Invalid Operator ID"), operatorIDFact.valueString, false /* preventViewSwitch */)
} else {
operatorIDTextField.clearValidationError(false /* preventViewSwitch */)
}
}

onTextChanged: {
operatorIDFact.value = text
if (_activeVehicle) {
Expand Down

0 comments on commit d606c2b

Please sign in to comment.