diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc b/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc index dbd6c164d2d54a044564ce69a8c43177a938c117..92a021f0de1a8b8d29ae8a4eda401899a89b1e4c 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc +++ b/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc @@ -196,7 +196,7 @@ void APMSensorsComponentController::_stopCalibration(APMSensorsComponentControll default: // Assume failed _hideAllCalAreas(); - qgcApp()->showMessage(QStringLiteral("Calibration failed. Calibration log will be displayed.")); + qgcApp()->showMessage(tr("Calibration failed. Calibration log will be displayed.")); break; } @@ -471,9 +471,9 @@ void APMSensorsComponentController::_handleUASTextMessage(int uasId, int compId, } if (_calTypeInProgress == CalTypeOffboardCompass) { - _orientationCalAreaHelpText->setProperty("text", "Rotate the vehicle continuously as shown in the diagram until marked as Completed"); + _orientationCalAreaHelpText->setProperty("text", tr("Rotate the vehicle continuously as shown in the diagram until marked as Completed")); } else { - _orientationCalAreaHelpText->setProperty("text", "Hold still in the current orientation"); + _orientationCalAreaHelpText->setProperty("text", tr("Hold still in the current orientation")); } emit orientationCalSidesInProgressChanged(); @@ -511,7 +511,7 @@ void APMSensorsComponentController::_handleUASTextMessage(int uasId, int compId, _orientationCalTailDownSideRotate = false; } - _orientationCalAreaHelpText->setProperty("text", "Place you vehicle into one of the orientations shown below and hold it still"); + _orientationCalAreaHelpText->setProperty("text", tr("Place you vehicle into one of the orientations shown below and hold it still")); emit orientationCalSidesInProgressChanged(); emit orientationCalSidesDoneChanged(); diff --git a/src/AutoPilotPlugins/PX4/AirframeComponentController.cc b/src/AutoPilotPlugins/PX4/AirframeComponentController.cc index 9679f8932f7a15698def29eb61c922c6d1ef2d73..122a39ff7df706c2bd8643a2b21e30f8ca965420 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponentController.cc +++ b/src/AutoPilotPlugins/PX4/AirframeComponentController.cc @@ -85,7 +85,7 @@ AirframeComponentController::~AirframeComponentController() void AirframeComponentController::changeAutostart(void) { if (qgcApp()->toolbox()->multiVehicleManager()->vehicles()->count() > 1) { - qgcApp()->showMessage("You cannot change airframe configuration while connected to multiple vehicles."); + qgcApp()->showMessage(tr("You cannot change airframe configuration while connected to multiple vehicles.")); return; } diff --git a/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc b/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc index 57818a6de2bb600aff38c721f55523d07d3bce32..de83f7847d5e03a9f8451a47c2d0f85c8bd5568b 100644 --- a/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc +++ b/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc @@ -154,7 +154,7 @@ void PX4AdvancedFlightModesController::_validateConfiguration(void) if (map < 0 || map > _channelCount) { _validConfiguration = false; - _configurationErrors += QString("%1 is set to %2. Mapping must between 0 and %3 (inclusive).\n").arg(switchParams[i]).arg(map).arg(_channelCount); + _configurationErrors += tr("%1 is set to %2. Mapping must between 0 and %3 (inclusive).\n").arg(switchParams[i]).arg(map).arg(_channelCount); } } @@ -170,7 +170,7 @@ void PX4AdvancedFlightModesController::_validateConfiguration(void) for (int j=0; jrawValue().toFloat(); if (threshold < 0.0f || threshold > 1.0f) { _validConfiguration = false; - _configurationErrors += QString("%1 is set to %2. Threshold must between 0.0 and 1.0 (inclusive).\n").arg(thresholdParam).arg(threshold); + _configurationErrors += tr("%1 is set to %2. Threshold must between 0.0 and 1.0 (inclusive).\n").arg(thresholdParam).arg(threshold); } } } diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc index 75b88512cdda4c0c9964999928338809f1fcffa8..c823235662febba594ac1ccd2b93ed8edacdacb5 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc @@ -140,8 +140,8 @@ void PX4AutoPilotPlugin::parametersReadyPreChecks(void) if (_vehicle->parameterManager()->parameterExists(FactSystem::defaultComponentId, "SENS_GYRO_XOFF") || _vehicle->parameterManager()->parameterExists(FactSystem::defaultComponentId, "COM_DL_LOSS_EN")) { _incorrectParameterVersion = true; - qgcApp()->showMessage("This version of GroundControl can only perform vehicle setup on a newer version of firmware. " - "Please perform a Firmware Upgrade if you wish to use Vehicle Setup."); + qgcApp()->showMessage(tr("This version of GroundControl can only perform vehicle setup on a newer version of firmware. " + "Please perform a Firmware Upgrade if you wish to use Vehicle Setup.")); } } diff --git a/src/AutoPilotPlugins/PX4/PX4TuningComponent.cc b/src/AutoPilotPlugins/PX4/PX4TuningComponent.cc index d20289909da94f4e82d5921abf85cad57193060c..500447b1d94764a59fe5779e6164e02478504606 100644 --- a/src/AutoPilotPlugins/PX4/PX4TuningComponent.cc +++ b/src/AutoPilotPlugins/PX4/PX4TuningComponent.cc @@ -14,7 +14,7 @@ PX4TuningComponent::PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : VehicleComponent(vehicle, autopilot, parent) - , _name("Tuning") + , _name(tr("Tuning")) { } diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentController.cc b/src/AutoPilotPlugins/PX4/SensorsComponentController.cc index b0016e76d29a68a1fb8e46d254676b88685b9d12..5ab1327fe8d354215aae1fac7eb9f1e8712202eb 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponentController.cc +++ b/src/AutoPilotPlugins/PX4/SensorsComponentController.cc @@ -164,7 +164,7 @@ void SensorsComponentController::_stopCalibration(SensorsComponentController::St switch (code) { case StopCalibrationSuccess: - _orientationCalAreaHelpText->setProperty("text", "Calibration complete"); + _orientationCalAreaHelpText->setProperty("text", tr("Calibration complete")); emit resetStatusTextArea(); if (_magCalInProgress) { emit setCompassRotations(); @@ -179,7 +179,7 @@ void SensorsComponentController::_stopCalibration(SensorsComponentController::St default: // Assume failed _hideAllCalAreas(); - qgcApp()->showMessage("Calibration failed. Calibration log will be displayed."); + qgcApp()->showMessage(tr("Calibration failed. Calibration log will be displayed.")); break; } @@ -264,7 +264,7 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in QStringList parts = text.split(" "); if (parts.count() != 2 && parts[0].toInt() != _supportedFirmwareCalVersion) { _unknownFirmwareVersion = true; - QString msg = "Unsupported calibration firmware version, using log"; + QString msg = tr("Unsupported calibration firmware version, using log"); _appendStatusLog(msg); qDebug() << msg; return; @@ -296,7 +296,7 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in _orientationCalTailDownSideVisible = false; _orientationCalNoseDownSideVisible = false; - _orientationCalAreaHelpText->setProperty("text", "Place your vehicle into one of the Incomplete orientations shown below and hold it still"); + _orientationCalAreaHelpText->setProperty("text", tr("Place your vehicle into one of the Incomplete orientations shown below and hold it still")); if (text == "accel") { _accelCalInProgress = true; @@ -377,9 +377,9 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in } if (_magCalInProgress) { - _orientationCalAreaHelpText->setProperty("text", "Rotate the vehicle continuously as shown in the diagram until marked as Completed"); + _orientationCalAreaHelpText->setProperty("text", tr("Rotate the vehicle continuously as shown in the diagram until marked as Completed")); } else { - _orientationCalAreaHelpText->setProperty("text", "Hold still in the current orientation"); + _orientationCalAreaHelpText->setProperty("text", tr("Hold still in the current orientation")); } emit orientationCalSidesInProgressChanged(); @@ -417,7 +417,7 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in _orientationCalTailDownSideRotate = false; } - _orientationCalAreaHelpText->setProperty("text", "Place you vehicle into one of the orientations shown below and hold it still"); + _orientationCalAreaHelpText->setProperty("text", tr("Place you vehicle into one of the orientations shown below and hold it still")); emit orientationCalSidesInProgressChanged(); emit orientationCalSidesDoneChanged(); @@ -426,7 +426,7 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in } if (text.endsWith("side already completed")) { - _orientationCalAreaHelpText->setProperty("text", "Orientation already completed, place you vehicle into one of the incomplete orientations shown below and hold it still"); + _orientationCalAreaHelpText->setProperty("text", tr("Orientation already completed, place you vehicle into one of the incomplete orientations shown below and hold it still")); return; } diff --git a/src/FactSystem/Fact.cc b/src/FactSystem/Fact.cc index 6086ee381d11233939b2ed8c40b1396374f6f512..a1fcf413e370aadba168302ad4192fe31fd51f0c 100644 --- a/src/FactSystem/Fact.cc +++ b/src/FactSystem/Fact.cc @@ -208,7 +208,7 @@ int Fact::enumIndex(void) index ++; } // Current value is not in list, add it manually - _metaData->addEnumInfo(QString("Unknown: %1").arg(rawValue().toString()), rawValue()); + _metaData->addEnumInfo(tr("Unknown: %1").arg(rawValue().toString()), rawValue()); emit enumsChanged(); return index; } diff --git a/src/FactSystem/FactControls/FactPanelController.cc b/src/FactSystem/FactControls/FactPanelController.cc index b7059d7768c8f1b6c8757a78b24b2ea3c5442172..dc19cb91f0a6aa1e696dd61bf89293fbdf438c28 100644 --- a/src/FactSystem/FactControls/FactPanelController.cc +++ b/src/FactSystem/FactControls/FactPanelController.cc @@ -116,7 +116,7 @@ bool FactPanelController::_allParametersExists(int componentId, QStringList name void FactPanelController::_checkForMissingFactPanel(void) { if (!_factPanel) { - _showInternalError("Incorrect FactPanel Qml implementation. FactPanelController used without passing in factPanel."); + _showInternalError(tr("Incorrect FactPanel Qml implementation. FactPanelController used without passing in factPanel.")); } } @@ -141,7 +141,7 @@ bool FactPanelController::parameterExists(int componentId, const QString& name) void FactPanelController::_showInternalError(const QString& errorMsg) { - _notifyPanelErrorMsg(QString("Internal Error: %1").arg(errorMsg)); + _notifyPanelErrorMsg(tr("Internal Error: %1").arg(errorMsg)); qCWarning(FactPanelControllerLog) << "Internal Error" << errorMsg; qgcApp()->showMessage(errorMsg); } diff --git a/src/FactSystem/FactMetaData.cc b/src/FactSystem/FactMetaData.cc index eff9cf1c5dfda2f8b0cf49c90c533aa284694240..71745883d6a412be0488a6e3cd5d2163219a686b 100644 --- a/src/FactSystem/FactMetaData.cc +++ b/src/FactSystem/FactMetaData.cc @@ -294,7 +294,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO typedValue = QVariant(rawValue.toInt(&convertOk)); if (!convertOnly && convertOk) { if (typedValue < rawMin() || typedValue > rawMax()) { - errorString = QString("Value must be within %1 and %2").arg(cookedMin().toInt()).arg(cookedMax().toInt()); + errorString = tr("Value must be within %1 and %2").arg(cookedMin().toInt()).arg(cookedMax().toInt()); } } break; @@ -304,7 +304,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO typedValue = QVariant(rawValue.toUInt(&convertOk)); if (!convertOnly && convertOk) { if (typedValue < rawMin() || typedValue > rawMax()) { - errorString = QString("Value must be within %1 and %2").arg(cookedMin().toUInt()).arg(cookedMax().toUInt()); + errorString = tr("Value must be within %1 and %2").arg(cookedMin().toUInt()).arg(cookedMax().toUInt()); } } break; @@ -312,7 +312,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO typedValue = QVariant(rawValue.toFloat(&convertOk)); if (!convertOnly && convertOk) { if (typedValue < rawMin() || typedValue > rawMax()) { - errorString = QString("Value must be within %1 and %2").arg(cookedMin().toFloat()).arg(cookedMax().toFloat()); + errorString = tr("Value must be within %1 and %2").arg(cookedMin().toFloat()).arg(cookedMax().toFloat()); } } break; @@ -321,7 +321,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO typedValue = QVariant(rawValue.toDouble(&convertOk)); if (!convertOnly && convertOk) { if (typedValue < rawMin() || typedValue > rawMax()) { - errorString = QString("Value must be within %1 and %2").arg(cookedMin().toDouble()).arg(cookedMax().toDouble()); + errorString = tr("Value must be within %1 and %2").arg(cookedMin().toDouble()).arg(cookedMax().toDouble()); } } break; @@ -340,7 +340,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO } if (!convertOk) { - errorString += "Invalid number"; + errorString += tr("Invalid number"); } return convertOk && errorString.isEmpty(); @@ -359,7 +359,7 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co typedValue = QVariant(cookedValue.toInt(&convertOk)); if (!convertOnly && convertOk) { if (cookedMin() > typedValue || typedValue > cookedMax()) { - errorString = QString("Value must be within %1 and %2").arg(cookedMin().toInt()).arg(cookedMax().toInt()); + errorString = tr("Value must be within %1 and %2").arg(cookedMin().toInt()).arg(cookedMax().toInt()); } } break; @@ -369,7 +369,7 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co typedValue = QVariant(cookedValue.toUInt(&convertOk)); if (!convertOnly && convertOk) { if (cookedMin() > typedValue || typedValue > cookedMax()) { - errorString = QString("Value must be within %1 and %2").arg(cookedMin().toUInt()).arg(cookedMax().toUInt()); + errorString = tr("Value must be within %1 and %2").arg(cookedMin().toUInt()).arg(cookedMax().toUInt()); } } break; @@ -377,7 +377,7 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co typedValue = QVariant(cookedValue.toFloat(&convertOk)); if (!convertOnly && convertOk) { if (cookedMin() > typedValue || typedValue > cookedMax()) { - errorString = QString("Value must be within %1 and %2").arg(cookedMin().toFloat()).arg(cookedMax().toFloat()); + errorString = tr("Value must be within %1 and %2").arg(cookedMin().toFloat()).arg(cookedMax().toFloat()); } } break; @@ -386,7 +386,7 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co typedValue = QVariant(cookedValue.toDouble(&convertOk)); if (!convertOnly && convertOk) { if (cookedMin() > typedValue || typedValue > cookedMax()) { - errorString = QString("Value must be within %1 and %2").arg(cookedMin().toDouble()).arg(cookedMax().toDouble()); + errorString = tr("Value must be within %1 and %2").arg(cookedMin().toDouble()).arg(cookedMax().toDouble()); } } break; @@ -405,7 +405,7 @@ bool FactMetaData::convertAndValidateCooked(const QVariant& cookedValue, bool co } if (!convertOk) { - errorString += "Invalid number"; + errorString += tr("Invalid number"); } return convertOk && errorString.isEmpty(); diff --git a/src/FactSystem/ParameterManager.cc b/src/FactSystem/ParameterManager.cc index e4df19e804714e280fbbd672a676073dcd3b316f..297f97b8d1c169ecf43cb76707a5185edd187a51 100644 --- a/src/FactSystem/ParameterManager.cc +++ b/src/FactSystem/ParameterManager.cc @@ -383,7 +383,7 @@ void ParameterManager::_valueUpdated(const QVariant& value) qCDebug(ParameterManagerLog) << _logVehiclePrefix(componentId) << "Set parameter - name:" << name << value << "(_waitingParamTimeoutTimer started)"; if (fact->rebootRequired() && !qgcApp()->runningUnitTests()) { - qgcApp()->showMessage(QStringLiteral("Change of parameter %1 requires a Vehicle reboot to take effect").arg(name)); + qgcApp()->showMessage(tr("Change of parameter %1 requires a Vehicle reboot to take effect").arg(name)); } } diff --git a/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc b/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc index 8f7f35953253c8e86e966aa25cf4753fd64a9e62..185cd8853a9108c35cf4834803f1ca5bb3821e65 100644 --- a/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc +++ b/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc @@ -376,7 +376,7 @@ bool APMFirmwarePlugin::_handleIncomingStatusText(Vehicle* vehicle, mavlink_mess if (supportedMajorNumber != -1) { if (firmwareVersion.majorNumber() < supportedMajorNumber || firmwareVersion.minorNumber() < supportedMinorNumber) { - qgcApp()->showMessage(QString("QGroundControl fully supports Version %1.%2 and above. You are using a version prior to that. This combination is untested, you may run into unpredictable results.").arg(supportedMajorNumber).arg(supportedMinorNumber)); + qgcApp()->showMessage(tr("QGroundControl fully supports Version %1.%2 and above. You are using a version prior to that. This combination is untested, you may run into unpredictable results.").arg(supportedMajorNumber).arg(supportedMinorNumber)); } } } @@ -858,7 +858,7 @@ void APMFirmwarePlugin::guidedModeRTL(Vehicle* vehicle) void APMFirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeChange) { if (qIsNaN(vehicle->altitudeRelative()->rawValue().toDouble())) { - qgcApp()->showMessage(QStringLiteral("Unable to change altitude, vehicle altitude not known.")); + qgcApp()->showMessage(tr("Unable to change altitude, vehicle altitude not known.")); return; } @@ -965,7 +965,7 @@ void APMFirmwarePlugin::startMission(Vehicle* vehicle) } if (!didTakeoff) { - qgcApp()->showMessage(QStringLiteral("Unable to start mission. Vehicle takeoff failed.")); + qgcApp()->showMessage(tr("Unable to start mission. Vehicle takeoff failed.")); return; } } else { @@ -974,7 +974,7 @@ void APMFirmwarePlugin::startMission(Vehicle* vehicle) } if (!_setFlightModeAndValidate(vehicle, missionFlightMode())) { - qgcApp()->showMessage(QStringLiteral("Unable to start mission. Vehicle failed to change to auto.")); + qgcApp()->showMessage(tr("Unable to start mission. Vehicle failed to change to auto.")); return; } } diff --git a/src/FirmwarePlugin/FirmwarePlugin.cc b/src/FirmwarePlugin/FirmwarePlugin.cc index 8ce7a6cc8bae64a30714c761fe4e08cea674ebe7..e574c4daed6fdf447982a70a3f5d44592a4d16b4 100644 --- a/src/FirmwarePlugin/FirmwarePlugin.cc +++ b/src/FirmwarePlugin/FirmwarePlugin.cc @@ -18,11 +18,11 @@ static FirmwarePluginFactoryRegister* _instance = NULL; -const char* guided_mode_not_supported_by_vehicle = "Guided mode not supported by Vehicle."; +const QString guided_mode_not_supported_by_vehicle = QObject::tr("Guided mode not supported by Vehicle."); QVariantList FirmwarePlugin::_cameraList; -const char* FirmwarePlugin::px4FollowMeFlightMode = "Follow Me"; +const QString FirmwarePlugin::px4FollowMeFlightMode(QObject::tr("Follow Me")); FirmwarePluginFactory::FirmwarePluginFactory(void) { diff --git a/src/FirmwarePlugin/FirmwarePlugin.h b/src/FirmwarePlugin/FirmwarePlugin.h index c0498704178a1c8f77a88d720473d4ef5ba2894b..badddea8a176fc1304f67e35677e8e71d9af53b6 100644 --- a/src/FirmwarePlugin/FirmwarePlugin.h +++ b/src/FirmwarePlugin/FirmwarePlugin.h @@ -296,7 +296,7 @@ public: virtual bool isVtol(const Vehicle* vehicle) const; // FIXME: Hack workaround for non pluginize FollowMe support - static const char* px4FollowMeFlightMode; + static const QString px4FollowMeFlightMode; protected: // Arms the vehicle with validation and retries diff --git a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc index 983501963125952b627ffc0dc9f69b32ffa136d2..f75fb517463b58dc39806e867ad5e88a0520ca4b 100644 --- a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc +++ b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc @@ -534,7 +534,7 @@ void PX4FirmwarePlugin::_handleAutopilotVersion(Vehicle* vehicle, mavlink_messag if (notifyUser) { instanceData->versionNotified = true; - qgcApp()->showMessage(QString("QGroundControl supports PX4 Pro firmware Version %1.%2.%3 and above. You are using a version prior to that which will lead to unpredictable results. Please upgrade your firmware.").arg(supportedMajorVersion).arg(supportedMinorVersion).arg(supportedPatchVersion)); + qgcApp()->showMessage(tr("QGroundControl supports PX4 Pro firmware Version %1.%2.%3 and above. You are using a version prior to that which will lead to unpredictable results. Please upgrade your firmware.").arg(supportedMajorVersion).arg(supportedMinorVersion).arg(supportedPatchVersion)); } } } diff --git a/src/MissionManager/MissionController.cc b/src/MissionManager/MissionController.cc index e510233a37bcd317a795d85c8c6fc7a3bae77569..db8dfa82b2bfccc582b14340b8eed6b0f655a80a 100644 --- a/src/MissionManager/MissionController.cc +++ b/src/MissionManager/MissionController.cc @@ -760,12 +760,12 @@ bool MissionController::_loadTextMissionFile(QTextStream& stream, QmlObjectListM } firstItem = false; } else { - errorString = QStringLiteral("The mission file is corrupted."); + errorString = tr("The mission file is corrupted."); return false; } } } else { - errorString = QStringLiteral("The mission file is not compatible with this version of %1.").arg(qgcApp()->applicationName()); + errorString = tr("The mission file is not compatible with this version of %1.").arg(qgcApp()->applicationName()); return false; } diff --git a/src/MissionManager/PlanManager.cc b/src/MissionManager/PlanManager.cc index ed723cf18eec3e23b00339a40f61a117c1db0ef5..53c95ed492d56688be8947bcda309c0088bac130 100644 --- a/src/MissionManager/PlanManager.cc +++ b/src/MissionManager/PlanManager.cc @@ -175,27 +175,27 @@ void PlanManager::_ackTimeout(void) switch (_expectedAck) { case AckNone: qCWarning(PlanManagerLog) << QStringLiteral("_ackTimeout %1 timeout with AckNone").arg(_planTypeString()); - _sendError(InternalError, "Internal error occurred during Mission Item communication: _ackTimeOut:_expectedAck == AckNone"); + _sendError(InternalError, tr("Internal error occurred during Mission Item communication: _ackTimeOut:_expectedAck == AckNone")); break; case AckMissionCount: // MISSION_COUNT message expected if (_retryCount > _maxRetryCount) { - _sendError(VehicleError, QStringLiteral("Mission request list failed, maximum retries exceeded.")); + _sendError(VehicleError, tr("Mission request list failed, maximum retries exceeded.")); _finishTransaction(false); } else { _retryCount++; - qCDebug(PlanManagerLog) << QStringLiteral("Retrying %1 REQUEST_LIST retry Count").arg(_planTypeString()) << _retryCount; + qCDebug(PlanManagerLog) << tr("Retrying %1 REQUEST_LIST retry Count").arg(_planTypeString()) << _retryCount; _requestList(); } break; case AckMissionItem: // MISSION_ITEM expected if (_retryCount > _maxRetryCount) { - _sendError(VehicleError, QStringLiteral("Mission read failed, maximum retries exceeded.")); + _sendError(VehicleError, tr("Mission read failed, maximum retries exceeded.")); _finishTransaction(false); } else { _retryCount++; - qCDebug(PlanManagerLog) << QStringLiteral("Retrying %1 MISSION_REQUEST retry Count").arg(_planTypeString()) << _retryCount; + qCDebug(PlanManagerLog) << tr("Retrying %1 MISSION_REQUEST retry Count").arg(_planTypeString()) << _retryCount; _requestNextMissionItem(); } break; @@ -203,12 +203,12 @@ void PlanManager::_ackTimeout(void) // MISSION_REQUEST is expected, or MISSION_ACK to end sequence if (_itemIndicesToWrite.count() == 0) { // Vehicle did not send final MISSION_ACK at end of sequence - _sendError(VehicleError, QStringLiteral("Mission write failed, vehicle failed to send final ack.")); + _sendError(VehicleError, tr("Mission write failed, vehicle failed to send final ack.")); _finishTransaction(false); } else if (_itemIndicesToWrite[0] == 0) { // Vehicle did not respond to MISSION_COUNT, try again if (_retryCount > _maxRetryCount) { - _sendError(VehicleError, QStringLiteral("Mission write mission count failed, maximum retries exceeded.")); + _sendError(VehicleError, tr("Mission write mission count failed, maximum retries exceeded.")); _finishTransaction(false); } else { _retryCount++; @@ -217,7 +217,7 @@ void PlanManager::_ackTimeout(void) } } else { // Vehicle did not request all items from ground station - _sendError(AckTimeoutError, QString("Vehicle did not request all items from ground station: %1").arg(_ackTypeToString(_expectedAck))); + _sendError(AckTimeoutError, tr("Vehicle did not request all items from ground station: %1").arg(_ackTypeToString(_expectedAck))); _expectedAck = AckNone; _finishTransaction(false); } @@ -225,18 +225,18 @@ void PlanManager::_ackTimeout(void) case AckMissionClearAll: // MISSION_ACK expected if (_retryCount > _maxRetryCount) { - _sendError(VehicleError, QStringLiteral("Mission remove all, maximum retries exceeded.")); + _sendError(VehicleError, tr("Mission remove all, maximum retries exceeded.")); _finishTransaction(false); } else { _retryCount++; - qCDebug(PlanManagerLog) << QStringLiteral("Retrying %1 MISSION_CLEAR_ALL retry Count").arg(_planTypeString()) << _retryCount; + qCDebug(PlanManagerLog) << tr("Retrying %1 MISSION_CLEAR_ALL retry Count").arg(_planTypeString()) << _retryCount; _removeAllWorker(); } break; case AckGuidedItem: // MISSION_REQUEST is expected, or MISSION_ACK to end sequence default: - _sendError(AckTimeoutError, QString("Vehicle did not respond to mission item communication: %1").arg(_ackTypeToString(_expectedAck))); + _sendError(AckTimeoutError, tr("Vehicle did not respond to mission item communication: %1").arg(_ackTypeToString(_expectedAck))); _expectedAck = AckNone; _finishTransaction(false); } @@ -496,7 +496,7 @@ void PlanManager::_handleMissionRequest(const mavlink_message_t& message, bool m qCDebug(PlanManagerLog) << QStringLiteral("_handleMissionRequest %1 sequenceNumber").arg(_planTypeString()) << missionRequest.seq; if (missionRequest.seq > _writeMissionItems.count() - 1) { - _sendError(RequestRangeError, QString("Vehicle requested item outside range, count:request %1:%2. Send to Vehicle failed.").arg(_writeMissionItems.count()).arg(missionRequest.seq)); + _sendError(RequestRangeError, tr("Vehicle requested item outside range, count:request %1:%2. Send to Vehicle failed.").arg(_writeMissionItems.count()).arg(missionRequest.seq)); _finishTransaction(false); return; } @@ -588,16 +588,16 @@ void PlanManager::_handleMissionAck(const mavlink_message_t& message) switch (savedExpectedAck) { case AckNone: // State machine is idle. Vehicle is confused. - _sendError(VehicleError, QString("Vehicle sent unexpected MISSION_ACK message, error: %1").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); + _sendError(VehicleError, tr("Vehicle sent unexpected MISSION_ACK message, error: %1").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); break; case AckMissionCount: // MISSION_COUNT message expected - _sendError(VehicleError, QString("Vehicle returned error: %1.").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); + _sendError(VehicleError, tr("Vehicle returned error: %1.").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); _finishTransaction(false); break; case AckMissionItem: // MISSION_ITEM expected - _sendError(VehicleError, QString("Vehicle returned error: %1.").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); + _sendError(VehicleError, tr("Vehicle returned error: %1.").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); _finishTransaction(false); break; case AckMissionRequest: @@ -607,18 +607,18 @@ void PlanManager::_handleMissionAck(const mavlink_message_t& message) qCDebug(PlanManagerLog) << QStringLiteral("_handleMissionAck write sequence complete").arg(_planTypeString()); _finishTransaction(true); } else { - _sendError(MissingRequestsError, QString("Vehicle did not request all items during write sequence, missed count %1.").arg(_itemIndicesToWrite.count())); + _sendError(MissingRequestsError, tr("Vehicle did not request all items during write sequence, missed count %1.").arg(_itemIndicesToWrite.count())); _finishTransaction(false); } } else { - _sendError(VehicleError, QString("Vehicle returned error: %1.").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); + _sendError(VehicleError, tr("Vehicle returned error: %1.").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); _finishTransaction(false); } break; case AckMissionClearAll: // MISSION_ACK expected if (missionAck.type != MAV_MISSION_ACCEPTED) { - _sendError(VehicleError, QString("Vehicle returned error: %1. Vehicle remove all failed.").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); + _sendError(VehicleError, tr("Vehicle returned error: %1. Vehicle remove all failed.").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); } _finishTransaction(missionAck.type == MAV_MISSION_ACCEPTED); break; @@ -628,7 +628,7 @@ void PlanManager::_handleMissionAck(const mavlink_message_t& message) qCDebug(PlanManagerLog) << QStringLiteral("_handleMissionAck %1 guided mode item accepted").arg(_planTypeString()); _finishTransaction(true); } else { - _sendError(VehicleError, QString("Vehicle returned error: %1. %2Vehicle did not accept guided item.").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); + _sendError(VehicleError, tr("Vehicle returned error: %1. %2Vehicle did not accept guided item.").arg(_missionResultToString((MAV_MISSION_RESULT)missionAck.type))); _finishTransaction(false); } break; @@ -748,53 +748,53 @@ QString PlanManager::_missionResultToString(MAV_MISSION_RESULT result) switch (result) { case MAV_MISSION_ACCEPTED: - resultString = QString("Mission accepted (MAV_MISSION_ACCEPTED)"); + resultString = tr("Mission accepted (MAV_MISSION_ACCEPTED)"); break; case MAV_MISSION_ERROR: - resultString = QString("Unspecified error (MAV_MISSION_ERROR)"); + resultString = tr("Unspecified error (MAV_MISSION_ERROR)"); break; case MAV_MISSION_UNSUPPORTED_FRAME: - resultString = QString("Coordinate frame is not supported (MAV_MISSION_UNSUPPORTED_FRAME)"); + resultString = tr("Coordinate frame is not supported (MAV_MISSION_UNSUPPORTED_FRAME)"); break; case MAV_MISSION_UNSUPPORTED: - resultString = QString("Command is not supported (MAV_MISSION_UNSUPPORTED)"); + resultString = tr("Command is not supported (MAV_MISSION_UNSUPPORTED)"); break; case MAV_MISSION_NO_SPACE: - resultString = QString("Mission item exceeds storage space (MAV_MISSION_NO_SPACE)"); + resultString = tr("Mission item exceeds storage space (MAV_MISSION_NO_SPACE)"); break; case MAV_MISSION_INVALID: - resultString = QString("One of the parameters has an invalid value (MAV_MISSION_INVALID)"); + resultString = tr("One of the parameters has an invalid value (MAV_MISSION_INVALID)"); break; case MAV_MISSION_INVALID_PARAM1: - resultString = QString("Param1 has an invalid value (MAV_MISSION_INVALID_PARAM1)"); + resultString = tr("Param1 has an invalid value (MAV_MISSION_INVALID_PARAM1)"); break; case MAV_MISSION_INVALID_PARAM2: - resultString = QString("Param2 has an invalid value (MAV_MISSION_INVALID_PARAM2)"); + resultString = tr("Param2 has an invalid value (MAV_MISSION_INVALID_PARAM2)"); break; case MAV_MISSION_INVALID_PARAM3: - resultString = QString("Param3 has an invalid value (MAV_MISSION_INVALID_PARAM3)"); + resultString = tr("Param3 has an invalid value (MAV_MISSION_INVALID_PARAM3)"); break; case MAV_MISSION_INVALID_PARAM4: - resultString = QString("Param4 has an invalid value (MAV_MISSION_INVALID_PARAM4)"); + resultString = tr("Param4 has an invalid value (MAV_MISSION_INVALID_PARAM4)"); break; case MAV_MISSION_INVALID_PARAM5_X: - resultString = QString("X/Param5 has an invalid value (MAV_MISSION_INVALID_PARAM5_X)"); + resultString = tr("X/Param5 has an invalid value (MAV_MISSION_INVALID_PARAM5_X)"); break; case MAV_MISSION_INVALID_PARAM6_Y: - resultString = QString("Y/Param6 has an invalid value (MAV_MISSION_INVALID_PARAM6_Y)"); + resultString = tr("Y/Param6 has an invalid value (MAV_MISSION_INVALID_PARAM6_Y)"); break; case MAV_MISSION_INVALID_PARAM7: - resultString = QString("Param7 has an invalid value (MAV_MISSION_INVALID_PARAM7)"); + resultString = tr("Param7 has an invalid value (MAV_MISSION_INVALID_PARAM7)"); break; case MAV_MISSION_INVALID_SEQUENCE: - resultString = QString("Received mission item out of sequence (MAV_MISSION_INVALID_SEQUENCE)"); + resultString = tr("Received mission item out of sequence (MAV_MISSION_INVALID_SEQUENCE)"); break; case MAV_MISSION_DENIED: - resultString = QString("Not accepting any mission commands (MAV_MISSION_DENIED)"); + resultString = tr("Not accepting any mission commands (MAV_MISSION_DENIED)"); break; default: qWarning(PlanManagerLog) << QStringLiteral("Fell off end of switch statement %1").arg(_planTypeString()); - resultString = QString("QGC Internal Error"); + resultString = tr("QGC Internal Error"); } return resultString + lastRequestString; diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 66b0d95e55cfcb288f23cd755e289f364ae32f3a..508f21d222a4f8ae0751977f04f7f87252eaed17 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -417,16 +417,16 @@ bool QGCApplication::_initForNormalAppBoot(void) toolbox()->joystickManager()->init(); if (_settingsUpgraded) { - showMessage("The format for QGroundControl saved settings has been modified. " - "Your saved settings have been reset to defaults."); + showMessage(tr("The format for QGroundControl saved settings has been modified. " + "Your saved settings have been reset to defaults.")); } // Connect links with flag AutoconnectLink toolbox()->linkManager()->startAutoConnectedLinks(); if (getQGCMapEngine()->wasCacheReset()) { - showMessage("The Offline Map Cache database has been upgraded. " - "Your old map cache sets have been reset."); + showMessage(tr("The Offline Map Cache database has been upgraded. " + "Your old map cache sets have been reset.")); } settings.sync(); @@ -615,7 +615,7 @@ void QGCApplication::_missingParamsDisplay(void) } _missingParams.clear(); - showMessage(QString("Parameters are missing from firmware. You may be running a version of firmware QGC does not work correctly with or your firmware has a bug in it. Missing params: %1").arg(params)); + showMessage(tr("Parameters are missing from firmware. You may be running a version of firmware QGC does not work correctly with or your firmware has a bug in it. Missing params: %1").arg(params)); } } diff --git a/src/QGCFileDownload.cc b/src/QGCFileDownload.cc index 9c3cdd0274ed073e7dd4df5b23403d656d25572c..014d5c6fada27f2738ca874e29e8167578d934e9 100644 --- a/src/QGCFileDownload.cc +++ b/src/QGCFileDownload.cc @@ -115,7 +115,7 @@ void QGCFileDownload::_downloadFinished(void) // Store downloaded file in download location QFile file(downloadFilename); if (!file.open(QIODevice::WriteOnly)) { - emit error(QString("Could not save downloaded file to %1. Error: %2").arg(downloadFilename).arg(file.errorString())); + emit error(tr("Could not save downloaded file to %1. Error: %2").arg(downloadFilename).arg(file.errorString())); return; } @@ -136,13 +136,13 @@ void QGCFileDownload::_downloadError(QNetworkReply::NetworkError code) QString errorMsg; if (code == QNetworkReply::OperationCanceledError) { - errorMsg = "Download cancelled"; + errorMsg = tr("Download cancelled"); } else if (code == QNetworkReply::ContentNotFoundError) { - errorMsg = "Error: File Not Found"; + errorMsg = tr("Error: File Not Found"); } else { - errorMsg = QString("Error during download. Error: %1").arg(code); + errorMsg = tr("Error during download. Error: %1").arg(code); } emit error(errorMsg); diff --git a/src/QGCQuickWidget.cc b/src/QGCQuickWidget.cc index 2c77673c5055fff67075c33f8f39c13c8a4c3843..ab6609360124b2a87bccbbeb5fd5bdad9ad3423f 100644 --- a/src/QGCQuickWidget.cc +++ b/src/QGCQuickWidget.cc @@ -50,7 +50,7 @@ bool QGCQuickWidget::setSource(const QUrl& qmlUrl) errorList += error.toString(); errorList += "\n"; } - qgcApp()->showMessage(QString("Source not ready: Status(%1)\nErrors:\n%2").arg(status()).arg(errorList)); + qgcApp()->showMessage(tr("Source not ready: Status(%1)\nErrors:\n%2").arg(status()).arg(errorList)); return false; } diff --git a/src/QmlControls/ParameterEditorController.cc b/src/QmlControls/ParameterEditorController.cc index 00ca6d27a29e46dfe3a969a472033315ba1f6ccf..b665750af9548ee4897a941e5eac929728246438 100644 --- a/src/QmlControls/ParameterEditorController.cc +++ b/src/QmlControls/ParameterEditorController.cc @@ -100,7 +100,7 @@ void ParameterEditorController::saveToFile(const QString& filename) QFile file(filename); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qgcApp()->showMessage(QString("Unable to create file: %1").arg(filename)); + qgcApp()->showMessage(tr("Unable to create file: %1").arg(filename)); return; } @@ -118,7 +118,7 @@ void ParameterEditorController::loadFromFile(const QString& filename) QFile file(filename); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qgcApp()->showMessage(QString("Unable to open file: %1").arg(filename)); + qgcApp()->showMessage(tr("Unable to open file: %1").arg(filename)); return; } diff --git a/src/Vehicle/MultiVehicleManager.cc b/src/Vehicle/MultiVehicleManager.cc index 637b2e9978da683d586a21e0e2fc444754655101..742052ccd2efd5c883ea7550bd77fa3e408a10d9 100644 --- a/src/Vehicle/MultiVehicleManager.cc +++ b/src/Vehicle/MultiVehicleManager.cc @@ -116,7 +116,7 @@ void MultiVehicleManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicle << vehicleType; if (vehicleId == _mavlinkProtocol->getSystemId()) { - _app->showMessage(QString("Warning: A vehicle is using the same system id as %1: %2").arg(qgcApp()->applicationName()).arg(vehicleId)); + _app->showMessage(tr("Warning: A vehicle is using the same system id as %1: %2").arg(qgcApp()->applicationName()).arg(vehicleId)); } // QSettings settings; diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index c7ba531db30ad39f11c04394c8175507fbaf39b3..2d03a92e9e72a764269746d79a4b0cc5ffdd6118 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -40,7 +40,7 @@ QGC_LOGGING_CATEGORY(VehicleLog, "VehicleLog") #define DEFAULT_LAT 38.965767f #define DEFAULT_LON -120.083923f -extern const char* guided_mode_not_supported_by_vehicle; +const QString guided_mode_not_supported_by_vehicle = QObject::tr("Guided mode not supported by Vehicle."); const char* Vehicle::_settingsGroup = "Vehicle%1"; // %1 replaced with mavlink system id const char* Vehicle::_joystickModeSettingsKey = "JoystickMode"; @@ -1026,7 +1026,7 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message) sysStatus.battery_remaining < _settingsManager->appSettings()->batteryPercentRemainingAnnounce()->rawValue().toInt() && sysStatus.battery_remaining < _lastAnnouncedLowBatteryPercent) { _lastAnnouncedLowBatteryPercent = sysStatus.battery_remaining; - _say(QString("%1 low battery: %2 percent remaining").arg(_vehicleIdSpeech()).arg(sysStatus.battery_remaining)); + _say(tr("%1 low battery: %2 percent remaining").arg(_vehicleIdSpeech()).arg(sysStatus.battery_remaining)); } _onboardControlSensorsPresent = sysStatus.onboard_control_sensors_present; @@ -1826,19 +1826,19 @@ void Vehicle::sendMessageMultiple(mavlink_message_t message) void Vehicle::_missionManagerError(int errorCode, const QString& errorMsg) { Q_UNUSED(errorCode); - qgcApp()->showMessage(QString("Mission transfer failed. Retry transfer. Error: %1").arg(errorMsg)); + qgcApp()->showMessage(tr("Mission transfer failed. Retry transfer. Error: %1").arg(errorMsg)); } void Vehicle::_geoFenceManagerError(int errorCode, const QString& errorMsg) { Q_UNUSED(errorCode); - qgcApp()->showMessage(QString("GeoFence transfer failed. Retry transfer. Error: %1").arg(errorMsg)); + qgcApp()->showMessage(tr("GeoFence transfer failed. Retry transfer. Error: %1").arg(errorMsg)); } void Vehicle::_rallyPointManagerError(int errorCode, const QString& errorMsg) { Q_UNUSED(errorCode); - qgcApp()->showMessage(QString("Rally Point transfer failed. Retry transfer. Error: %1").arg(errorMsg)); + qgcApp()->showMessage(tr("Rally Point transfer failed. Retry transfer. Error: %1").arg(errorMsg)); } void Vehicle::_addNewMapTrajectoryPoint(void) diff --git a/src/VehicleSetup/Bootloader.cc b/src/VehicleSetup/Bootloader.cc index a0aa7727327d33b01a0268bb890351ecd1fdb680..d7c86a61405687484863ef982c980af01537aaaa 100644 --- a/src/VehicleSetup/Bootloader.cc +++ b/src/VehicleSetup/Bootloader.cc @@ -88,7 +88,7 @@ bool Bootloader::_getCommandResponse(QextSerialPort* port, int responseTimeout) uint8_t response[2]; if (!_read(port, response, 2, responseTimeout)) { - _errorString.prepend("Get Command Response: "); + _errorString.prepend(tr("Get Command Response: ")); return false; } @@ -134,7 +134,7 @@ bool Bootloader::_getPX4BoardInfo(QextSerialPort* port, uint8_t param, uint32_t& return true; Error: - _errorString.prepend("Get Board Info: "); + _errorString.prepend(tr("Get Board Info: ")); return false; } @@ -156,7 +156,7 @@ bool Bootloader::_sendCommand(QextSerialPort* port, const uint8_t cmd, int respo return true; Error: - _errorString.prepend("Send Command: "); + _errorString.prepend(tr("Send Command: ")); return false; } @@ -259,7 +259,7 @@ bool Bootloader::_ihxProgram(QextSerialPort* port, const FirmwareImage* image) QByteArray bytes; if (!image->ihxGetBlock(index, flashAddress, bytes)) { - _errorString = QString("Unable to retrieve block from ihx: index %1").arg(index); + _errorString = tr("Unable to retrieve block from ihx: index %1").arg(index); return false; } @@ -279,7 +279,7 @@ bool Bootloader::_ihxProgram(QextSerialPort* port, const FirmwareImage* image) } if (failed) { - _errorString = QString("Unable to set flash start address: 0x%2").arg(flashAddress, 8, 16, QLatin1Char('0')); + _errorString = tr("Unable to set flash start address: 0x%2").arg(flashAddress, 8, 16, QLatin1Char('0')); return false; } @@ -308,7 +308,7 @@ bool Bootloader::_ihxProgram(QextSerialPort* port, const FirmwareImage* image) } } if (failed) { - _errorString = QString("Flash failed: %1 at address 0x%2").arg(_errorString).arg(flashAddress, 8, 16, QLatin1Char('0')); + _errorString = tr("Flash failed: %1 at address 0x%2").arg(_errorString).arg(flashAddress, 8, 16, QLatin1Char('0')); return false; } @@ -431,7 +431,7 @@ bool Bootloader::_ihxVerifyBytes(QextSerialPort* port, const FirmwareImage* imag QByteArray imageBytes; if (!image->ihxGetBlock(index, readAddress, imageBytes)) { - _errorString = QString("Unable to retrieve block from ihx: index %1").arg(index); + _errorString = tr("Unable to retrieve block from ihx: index %1").arg(index); return false; } @@ -451,7 +451,7 @@ bool Bootloader::_ihxVerifyBytes(QextSerialPort* port, const FirmwareImage* imag } if (failed) { - _errorString = QString("Unable to set read start address: 0x%2").arg(readAddress, 8, 16, QLatin1Char('0')); + _errorString = tr("Unable to set read start address: 0x%2").arg(readAddress, 8, 16, QLatin1Char('0')); return false; } @@ -490,7 +490,7 @@ bool Bootloader::_ihxVerifyBytes(QextSerialPort* port, const FirmwareImage* imag for (int i=0; i* prgFirmware = _firmwareHashForBoardId(_bootloaderBoardID); if (!prgFirmware && firmwareId.firmwareType != CustomFirmware) { - _errorCancel("Attempting to flash an unknown board type, you must select 'Custom firmware file'"); + _errorCancel(tr("Attempting to flash an unknown board type, you must select 'Custom firmware file'")); return; } if (firmwareId.firmwareType == CustomFirmware) { _firmwareFilename = QGCQFileDialog::getOpenFileName(NULL, // Parent to main window - "Select Firmware File", // Dialog Caption + tr("Select Firmware File"), // Dialog Caption QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), // Initial directory - "Firmware Files (*.px4 *.bin *.ihx)"); // File filter + tr("Firmware Files (*.px4 *.bin *.ihx)")); // File filter } else { if (prgFirmware->contains(firmwareId)) { _firmwareFilename = prgFirmware->value(firmwareId); } else { - _errorCancel("Unable to find specified firmware download location"); + _errorCancel(tr("Unable to find specified firmware download location")); return; } } if (_firmwareFilename.isEmpty()) { - _errorCancel("No firmware file selected"); + _errorCancel(tr("No firmware file selected")); } else { _downloadFirmware(); } @@ -548,8 +548,8 @@ void FirmwareUpgradeController::_downloadFirmware(void) { Q_ASSERT(!_firmwareFilename.isEmpty()); - _appendStatusLog("Downloading firmware..."); - _appendStatusLog(QString(" From: %1").arg(_firmwareFilename)); + _appendStatusLog(tr("Downloading firmware...")); + _appendStatusLog(tr(" From: %1").arg(_firmwareFilename)); QGCFileDownload* downloader = new QGCFileDownload(this); connect(downloader, &QGCFileDownload::downloadFinished, this, &FirmwareUpgradeController::_firmwareDownloadFinished); @@ -572,7 +572,7 @@ void FirmwareUpgradeController::_firmwareDownloadFinished(QString remoteFile, QS { Q_UNUSED(remoteFile); - _appendStatusLog("Download complete"); + _appendStatusLog(tr("Download complete")); FirmwareImage* image = new FirmwareImage(this); @@ -580,18 +580,18 @@ void FirmwareUpgradeController::_firmwareDownloadFinished(QString remoteFile, QS connect(image, &FirmwareImage::errorMessage, this, &FirmwareUpgradeController::_error); if (!image->load(localFile, _bootloaderBoardID)) { - _errorCancel("Image load failed"); + _errorCancel(tr("Image load failed")); return; } // We can't proceed unless we have the bootloader if (!_bootloaderFound) { - _errorCancel("Bootloader not found"); + _errorCancel(tr("Bootloader not found")); return; } if (_bootloaderBoardFlashSize != 0 && image->imageSize() > _bootloaderBoardFlashSize) { - _errorCancel(QString("Image size of %1 is too large for board flash size %2").arg(image->imageSize()).arg(_bootloaderBoardFlashSize)); + _errorCancel(tr("Image size of %1 is too large for board flash size %2").arg(image->imageSize()).arg(_bootloaderBoardFlashSize)); return; } @@ -626,7 +626,7 @@ void FirmwareUpgradeController::_flashComplete(void) delete _image; _image = NULL; - _appendStatusLog("Upgrade complete", true); + _appendStatusLog(tr("Upgrade complete"), true); _appendStatusLog("------------------------------------------", false); emit flashComplete(); qgcApp()->toolbox()->linkManager()->setConnectionsAllowed(); @@ -684,7 +684,7 @@ void FirmwareUpgradeController::_appendStatusLog(const QString& text, bool criti void FirmwareUpgradeController::_errorCancel(const QString& msg) { _appendStatusLog(msg, false); - _appendStatusLog("Upgrade cancelled", true); + _appendStatusLog(tr("Upgrade cancelled"), true); _appendStatusLog("------------------------------------------", false); emit error(); cancel(); diff --git a/src/VehicleSetup/JoystickConfigController.cc b/src/VehicleSetup/JoystickConfigController.cc index a7b54447e88ee632036eebb6e30245f1e1b885c7..6168ce338f5052136ad9fc2fe9014fc7daa0846b 100644 --- a/src/VehicleSetup/JoystickConfigController.cc +++ b/src/VehicleSetup/JoystickConfigController.cc @@ -169,7 +169,7 @@ void JoystickConfigController::nextButtonClicked(void) if (_currentStep == -1) { // Need to have enough channels if (_axisCount < _axisMinimum) { - qgcApp()->showMessage(QString("Detected %1 joystick axes. To operate PX4, you need at least %2 axes.").arg(_axisCount).arg(_axisMinimum)); + qgcApp()->showMessage(tr("Detected %1 joystick axes. To operate PX4, you need at least %2 axes.").arg(_axisCount).arg(_axisMinimum)); return; } _startCalibration(); @@ -595,7 +595,7 @@ void JoystickConfigController::_stopCalibration(void) _statusText->setProperty("text", ""); - _nextButton->setProperty("text", "Calibrate"); + _nextButton->setProperty("text", tr("Calibrate")); _nextButton->setEnabled(true); _cancelButton->setEnabled(false); _skipButton->setEnabled(false); @@ -619,8 +619,8 @@ void JoystickConfigController::_calSave(void) _calState = calStateSave; _statusText->setProperty("text", - "The current calibration settings are now displayed for each axis on screen.\n\n" - "Click the Next button to upload calibration to board. Click Cancel if you don't want to save these values."); + tr("The current calibration settings are now displayed for each axis on screen.\n\n" + "Click the Next button to upload calibration to board. Click Cancel if you don't want to save these values.")); _nextButton->setEnabled(true); _skipButton->setEnabled(false); diff --git a/src/VehicleSetup/PX4FirmwareUpgradeThread.cc b/src/VehicleSetup/PX4FirmwareUpgradeThread.cc index c6d77f24510e64e13e5322c239881a05e1d1da63..c28e7ae88092b0bd943d1ebed841df70f1d67bba 100644 --- a/src/VehicleSetup/PX4FirmwareUpgradeThread.cc +++ b/src/VehicleSetup/PX4FirmwareUpgradeThread.cc @@ -154,14 +154,14 @@ void PX4FirmwareUpgradeThreadWorker::_3drRadioForceBootloader(const QGCSerialPor port.setBaudRate(QSerialPort::Baud57600); - emit status("Putting radio into command mode"); + emit status(tr("Putting radio into command mode")); // Wait a little while for the USB port to initialize. 3DR Radio boot is really slow. QGC::SLEEP::msleep(2000); port.open(QIODevice::ReadWrite); if (!port.isOpen()) { - emit error(QString("Unable to open port: %1 error: %2").arg(portInfo.systemLocation()).arg(port.errorString())); + emit error(tr("Unable to open port: %1 error: %2").arg(portInfo.systemLocation()).arg(port.errorString())); return; } @@ -169,25 +169,25 @@ void PX4FirmwareUpgradeThreadWorker::_3drRadioForceBootloader(const QGCSerialPor QGC::SLEEP::msleep(2000); port.write("+++", 3); if (!port.waitForReadyRead(1500)) { - emit error("Unable to put radio into command mode"); + emit error(tr("Unable to put radio into command mode")); return; } QByteArray bytes = port.readAll(); if (!bytes.contains("OK")) { qCDebug(FirmwareUpgradeLog) << bytes; - emit error("Unable to put radio into command mode"); + emit error(tr("Unable to put radio into command mode")); return; } - emit status("Rebooting radio to bootloader"); + emit status(tr("Rebooting radio to bootloader")); port.write("AT&UPDATE\r\n"); if (!port.waitForBytesWritten(1500)) { - emit error("Unable to reboot radio (bytes written)"); + emit error(tr("Unable to reboot radio (bytes written)")); return; } if (!port.waitForReadyRead(1500)) { - emit error("Unable to reboot radio (ready read)"); + emit error(tr("Unable to reboot radio (ready read)")); return; } port.close(); @@ -278,7 +278,7 @@ void PX4FirmwareUpgradeThreadWorker::_flash(void) qCDebug(FirmwareUpgradeLog) << "PX4FirmwareUpgradeThreadWorker::_flash"; if (_erase()) { - emit status("Programming new version..."); + emit status(tr("Programming new version...")); if (_bootloader->program(_bootloaderPort, _controller->image())) { qCDebug(FirmwareUpgradeLog) << "Program complete"; @@ -291,11 +291,11 @@ void PX4FirmwareUpgradeThreadWorker::_flash(void) return; } - emit status("Verifying program..."); + emit status(tr("Verifying program...")); if (_bootloader->verify(_bootloaderPort, _controller->image())) { qCDebug(FirmwareUpgradeLog) << "Verify complete"; - emit status("Verify complete"); + emit status(tr("Verify complete")); } else { qCDebug(FirmwareUpgradeLog) << "Verify failed:" << _bootloader->errorString(); emit error(_bootloader->errorString()); @@ -313,11 +313,11 @@ bool PX4FirmwareUpgradeThreadWorker::_erase(void) qCDebug(FirmwareUpgradeLog) << "PX4FirmwareUpgradeThreadWorker::_erase"; emit eraseStarted(); - emit status("Erasing previous program..."); + emit status(tr("Erasing previous program...")); if (_bootloader->erase(_bootloaderPort)) { qCDebug(FirmwareUpgradeLog) << "Erase complete"; - emit status("Erase complete"); + emit status(tr("Erase complete")); emit eraseComplete(); return true; } else { diff --git a/src/ViewWidgets/CustomCommandWidgetController.cc b/src/ViewWidgets/CustomCommandWidgetController.cc index 1465bceb63dff122683ec82c8d4213eacb499268..071a477b052635845e8e181394ba56d37bdbbdd6 100644 --- a/src/ViewWidgets/CustomCommandWidgetController.cc +++ b/src/ViewWidgets/CustomCommandWidgetController.cc @@ -53,7 +53,7 @@ void CustomCommandWidgetController::_activeVehicleChanged(Vehicle* activeVehicle void CustomCommandWidgetController::selectQmlFile(void) { QSettings settings; - QString qmlFile = QGCQFileDialog::getOpenFileName(NULL, "Select custom Qml file", QString(), "Qml files (*.qml)"); + QString qmlFile = QGCQFileDialog::getOpenFileName(NULL, tr("Select custom Qml file"), QString(), tr("Qml files (*.qml)")); if (qmlFile.isEmpty()) { _customQmlFile.clear(); settings.remove(_settingsKey); diff --git a/src/comm/BluetoothLink.cc b/src/comm/BluetoothLink.cc index ab78ce599cc6d44afe6795e0f5cab3e639752458..f1b9cc46e83232564f1cadcd8185f37cd88aad13 100644 --- a/src/comm/BluetoothLink.cc +++ b/src/comm/BluetoothLink.cc @@ -213,7 +213,7 @@ void BluetoothLink::deviceError(QBluetoothSocket::SocketError error) { _connectState = false; qWarning() << "Bluetooth error" << error; - emit communicationError("Bluetooth Link Error", _targetSocket->errorString()); + emit communicationError(tr("Bluetooth Link Error"), _targetSocket->errorString()); } bool BluetoothLink::isConnected() const diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index a2f2adb5abf0308d337c8f34032fee1684bd42b9..e6b4506f2051aca89d6156c6f5fc40c7a85ebcf7 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -284,7 +284,7 @@ SharedLinkInterfacePointer LinkManager::sharedLinkInterfacePointerForLink(LinkIn bool LinkManager::_connectionsSuspendedMsg(void) { if (_connectionsSuspended) { - qgcApp()->showMessage(QString("Connect not allowed: %1").arg(_connectionsSuspendedReason)); + qgcApp()->showMessage(tr("Connect not allowed: %1").arg(_connectionsSuspendedReason)); return true; } else { return false; @@ -625,7 +625,7 @@ void LinkManager::_updateAutoConnectLinks(void) void LinkManager::shutdown(void) { - setConnectionsSuspended("Shutdown"); + setConnectionsSuspended(tr("Shutdown")); disconnectAll(); } diff --git a/src/comm/LogReplayLink.cc b/src/comm/LogReplayLink.cc index 0e770b3d0d97a1c5ca2cea567842df17d7b566f7..32756a8c055e1d98eed977aa51d9e5e8236a194f 100644 --- a/src/comm/LogReplayLink.cc +++ b/src/comm/LogReplayLink.cc @@ -17,8 +17,6 @@ const char* LogReplayLinkConfiguration::_logFilenameKey = "logFilename"; -const char* LogReplayLink::_errorTitle = "Log Replay Error"; - LogReplayLinkConfiguration::LogReplayLinkConfiguration(const QString& name) : LinkConfiguration(name) { @@ -76,6 +74,8 @@ LogReplayLink::LogReplayLink(SharedLinkConfigurationPointer& config) if (!_logReplayConfig) { qWarning() << "Internal error"; } + + _errorTitle = tr("Log Replay Error"); _readTickTimer.moveToThread(this); @@ -96,7 +96,7 @@ bool LogReplayLink::_connect(void) { // Disallow replay when any links are connected if (qgcApp()->toolbox()->multiVehicleManager()->activeVehicle()) { - emit communicationError(_errorTitle, "You must close all connections prior to replaying a log."); + emit communicationError(_errorTitle, tr("You must close all connections prior to replaying a log.")); return false; } @@ -243,13 +243,13 @@ bool LogReplayLink::_loadLogFile(void) int logDurationSecondsTotal; if (_logFile.isOpen()) { - errorMsg = "Attempt to load new log while log being played"; + errorMsg = tr("Attempt to load new log while log being played"); goto Error; } _logFile.setFileName(logFilename); if (!_logFile.open(QFile::ReadOnly)) { - errorMsg = QString("Unable to open log file: '%1', error: %2").arg(logFilename).arg(_logFile.errorString()); + errorMsg = tr("Unable to open log file: '%1', error: %2").arg(logFilename).arg(_logFile.errorString()); goto Error; } logFileInfo.setFile(logFilename); @@ -279,7 +279,7 @@ bool LogReplayLink::_loadLogFile(void) } if (endTimeUSecs == startTimeUSecs) { - errorMsg = QString("The log file '%1' is corrupt. No valid timestamps were found at the end of the file.").arg(logFilename); + errorMsg = tr("The log file '%1' is corrupt. No valid timestamps were found at the end of the file.").arg(logFilename); goto Error; } @@ -466,7 +466,7 @@ void LogReplayLink::movePlayhead(int percentComplete) // Now seek to the appropriate position, failing gracefully if we can't. if (!_logFile.seek(newFilePos)) { - _replayError("Unable to seek to new position"); + _replayError(tr("Unable to seek to new position")); return; } @@ -486,7 +486,7 @@ void LogReplayLink::movePlayhead(int percentComplete) // And now jump the necessary number of bytes in the proper direction qint64 offset = (newRelativeTimeUSecs - desiredTimeUSecs) * baudRate; if (!_logFile.seek(_logFile.pos() + offset)) { - _replayError("Unable to seek to new position"); + _replayError(tr("Unable to seek to new position")); return; } @@ -505,7 +505,7 @@ void LogReplayLink::movePlayhead(int percentComplete) // Now seek to the appropriate position, failing gracefully if we can't. if (!_logFile.seek(newFilePos)) { - _replayError("Unable to seek to new position"); + _replayError(tr("Unable to seek to new position")); return; } diff --git a/src/comm/LogReplayLink.h b/src/comm/LogReplayLink.h index a1a41aae5bd0d55ec32a59ab50e5c801c92ebb3f..d5d863d5a750f31c7af3e7757d3a104a677b8adf 100644 --- a/src/comm/LogReplayLink.h +++ b/src/comm/LogReplayLink.h @@ -133,7 +133,7 @@ private: int _mavlinkChannel; QTimer _readTickTimer; ///< Timer which signals a read of next log record - static const char* _errorTitle; ///< Title for communicatorError signals + QString _errorTitle; ///< Title for communicatorError signals quint64 _logCurrentTimeUSecs; ///< The timestamp of the next message in the log file. quint64 _logStartTimeUSecs; ///< The first timestamp in the current log file. diff --git a/src/comm/SerialLink.cc b/src/comm/SerialLink.cc index 33187417ae7efc8611bede7faf888686fde4259b..c48690cb755ad1ec29245cf99ab62793c82f6bdf 100644 --- a/src/comm/SerialLink.cc +++ b/src/comm/SerialLink.cc @@ -142,7 +142,7 @@ bool SerialLink::_connect(void) } } - _emitLinkError(QString("Error connecting: Could not create port. %1").arg(errorString)); + _emitLinkError(tr("Error connecting: Could not create port. %1").arg(errorString)); return false; } return true; @@ -212,7 +212,7 @@ bool SerialLink::_hardwareConnect(QSerialPort::SerialPortError& error, QString& qDebug() << "open failed" << _port->errorString() << _port->error() << getName() << qgcApp()->toolbox()->linkManager()->isAutoconnectLink(this); error = _port->error(); errorString = _port->errorString(); - emit communicationUpdate(getName(),"Error opening port: " + _port->errorString()); + emit communicationUpdate(getName(), tr("Error opening port: %1").arg(_port->errorString())); _port->close(); delete _port; _port = NULL; diff --git a/src/comm/TCPLink.cc b/src/comm/TCPLink.cc index 384c90a778857b6b6a1226e2f4b25f6615d2192b..5760fb755f6d0050e9a1a8a405d60660d83dd26e 100644 --- a/src/comm/TCPLink.cc +++ b/src/comm/TCPLink.cc @@ -160,7 +160,7 @@ bool TCPLink::_hardwareConnect() // Whether a failed connection emits an error signal or not is platform specific. // So in cases where it is not emitted, we emit one ourselves. if (errorSpy.count() == 0) { - emit communicationError(tr("Link Error"), QString("Error on link %1. Connection failed").arg(getName())); + emit communicationError(tr("Link Error"), tr("Error on link %1. Connection failed").arg(getName())); } delete _socket; _socket = NULL; @@ -174,7 +174,7 @@ bool TCPLink::_hardwareConnect() void TCPLink::_socketError(QAbstractSocket::SocketError socketError) { Q_UNUSED(socketError); - emit communicationError(tr("Link Error"), QString("Error on link %1. Error on socket: %2.").arg(getName()).arg(_socket->errorString())); + emit communicationError(tr("Link Error"), tr("Error on link %1. Error on socket: %2.").arg(getName()).arg(_socket->errorString())); } /** diff --git a/src/comm/UDPLink.cc b/src/comm/UDPLink.cc index fb650b25ec6a3114c3d6dec5f17a9b30e4da3a4e..ab91418ec115bb0d36436247a18d6c42639c1d17 100644 --- a/src/comm/UDPLink.cc +++ b/src/comm/UDPLink.cc @@ -307,7 +307,7 @@ void UDPLink::_registerZeroconf(uint16_t port, const std::string ®Type) NULL); if (result != kDNSServiceErr_NoError) { - emit communicationError("UDP Link Error", "Error registering Zeroconf"); + emit communicationError(tr("UDP Link Error"), tr("Error registering Zeroconf")); _dnssServiceRef = NULL; } #else diff --git a/src/ui/QGCMAVLinkInspector.cc b/src/ui/QGCMAVLinkInspector.cc index 08f016f4df800bb2bb85dfe8b8af157ec9f2a59b..b1a05eb3055214d9143385a8d179ef71ee3704c9 100644 --- a/src/ui/QGCMAVLinkInspector.cc +++ b/src/ui/QGCMAVLinkInspector.cc @@ -53,7 +53,7 @@ QGCMAVLinkInspector::QGCMAVLinkInspector(const QString& title, QAction* action, void QGCMAVLinkInspector::_vehicleAdded(Vehicle* vehicle) { - ui->systemComboBox->addItem(QString("Vehicle %1").arg(vehicle->id()), vehicle->id()); + ui->systemComboBox->addItem(tr("Vehicle %1").arg(vehicle->id()), vehicle->id()); // Add a tree for a new UAS addUAStoTree(vehicle->id()); diff --git a/src/ui/QGCUASFileView.cc b/src/ui/QGCUASFileView.cc index 13859c03425e31411404dc5c69730062fca7cbc8..2a57ec5d39bb8220011e2c37923d6840ddd588f8 100644 --- a/src/ui/QGCUASFileView.cc +++ b/src/ui/QGCUASFileView.cc @@ -55,7 +55,7 @@ void QGCUASFileView::_downloadFile(void) _ui.statusText->clear(); QString downloadToHere = QGCQFileDialog::getExistingDirectory(this, - "Download Directory", + tr("Download Directory"), QDir::homePath(), QGCQFileDialog::ShowDirsOnly | QGCQFileDialog::DontResolveSymlinks); @@ -81,7 +81,7 @@ void QGCUASFileView::_downloadFile(void) _setAllButtonsEnabled(false); _currentCommand = commandDownload; - _ui.statusText->setText(QString("Downloading: %1").arg(downloadFilename)); + _ui.statusText->setText(tr("Downloading: %1").arg(downloadFilename)); _manager->streamPath(path, QDir(downloadToHere)); } @@ -111,9 +111,9 @@ void QGCUASFileView::_uploadFile(void) item = item->parent(); } while (item); - QString uploadFromHere = QGCQFileDialog::getOpenFileName(this, "Upload File", QDir::homePath()); + QString uploadFromHere = QGCQFileDialog::getOpenFileName(this, tr("Upload File"), QDir::homePath()); - _ui.statusText->setText(QString("Uploading: %1").arg(uploadFromHere)); + _ui.statusText->setText(tr("Uploading: %1").arg(uploadFromHere)); qDebug() << "Upload: " << uploadFromHere << "to path" << path; @@ -136,7 +136,7 @@ void QGCUASFileView::_commandError(const QString& msg) { _setAllButtonsEnabled(true); _currentCommand = commandNone; - _ui.statusText->setText(QString("Error: %1").arg(msg)); + _ui.statusText->setText(tr("Error: %1").arg(msg)); } /// @brief Refreshes the directory list tree. diff --git a/src/ui/linechart/LinechartWidget.cc b/src/ui/linechart/LinechartWidget.cc index df439dcb5e68bea79b6b3d6ca00d4fa288d7a8ea..d2c3945426833f3570ed964ab41de5b53bc4b12a 100644 --- a/src/ui/linechart/LinechartWidget.cc +++ b/src/ui/linechart/LinechartWidget.cc @@ -246,21 +246,21 @@ void LinechartWidget::createLayout() hlayout->addStretch(); - QLabel *timeScaleLabel = new QLabel("Time axis:"); + QLabel *timeScaleLabel = new QLabel(tr("Time axis:")); hlayout->addWidget(timeScaleLabel); timeScaleCmb = new QComboBox(this); - timeScaleCmb->addItem("10 seconds", 10); - timeScaleCmb->addItem("20 seconds", 20); - timeScaleCmb->addItem("30 seconds", 30); - timeScaleCmb->addItem("40 seconds", 40); - timeScaleCmb->addItem("50 seconds", 50); - timeScaleCmb->addItem("1 minute", 60); - timeScaleCmb->addItem("2 minutes", 60*2); - timeScaleCmb->addItem("3 minutes", 60*3); - timeScaleCmb->addItem("4 minutes", 60*4); - timeScaleCmb->addItem("5 minutes", 60*5); - timeScaleCmb->addItem("10 minutes", 60*10); + timeScaleCmb->addItem(tr("10 seconds"), 10); + timeScaleCmb->addItem(tr("20 seconds"), 20); + timeScaleCmb->addItem(tr("30 seconds"), 30); + timeScaleCmb->addItem(tr("40 seconds"), 40); + timeScaleCmb->addItem(tr("50 seconds"), 50); + timeScaleCmb->addItem(tr("1 minute"), 60); + timeScaleCmb->addItem(tr("2 minutes"), 60*2); + timeScaleCmb->addItem(tr("3 minutes"), 60*3); + timeScaleCmb->addItem(tr("4 minutes"), 60*4); + timeScaleCmb->addItem(tr("5 minutes"), 60*5); + timeScaleCmb->addItem(tr("10 minutes"), 60*10); //timeScaleCmb->setSizeAdjustPolicy(QComboBox::AdjustToContents); timeScaleCmb->setMinimumContentsLength(12);