Commit 3e05f174 authored by DonLakeFlyer's avatar DonLakeFlyer

String fixups for localization

parent 2f7b754a
......@@ -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();
......
......@@ -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;
}
......
......@@ -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; j<switchParams.count(); j++) {
if (map != 0 && map == switchMappings[j]) {
_validConfiguration = false;
_configurationErrors += QString("%1 is set to same channel as %2.\n").arg(switchParams[j]).arg(attitudeParams[i]);
_configurationErrors += tr("%1 is set to same channel as %2.\n").arg(switchParams[j]).arg(attitudeParams[i]);
}
}
}
......@@ -185,7 +185,7 @@ void PX4AdvancedFlightModesController::_validateConfiguration(void)
float threshold = getParameterFact(-1, thresholdParam)->rawValue().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);
}
}
}
......
......@@ -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."));
}
}
......
......@@ -14,7 +14,7 @@
PX4TuningComponent::PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: VehicleComponent(vehicle, autopilot, parent)
, _name("Tuning")
, _name(tr("Tuning"))
{
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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);
}
......@@ -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();
......
......@@ -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));
}
}
......
......@@ -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;
}
}
......@@ -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)
{
......
......@@ -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
......
......@@ -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));
}
}
}
......
......@@ -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;
}
......
This diff is collapsed.
......@@ -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));
}
}
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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)
......
......@@ -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<bytesToRead; i++) {
if ((uint8_t)imageBytes[bytesIndex + i] != readBuf[i]) {
_errorString = QString("Compare failed: expected(0x%1) actual(0x%2) at address: 0x%3").arg(imageBytes[bytesIndex + i], 2, 16, QLatin1Char('0')).arg(readBuf[i], 2, 16, QLatin1Char('0')).arg(readAddress + i, 8, 16, QLatin1Char('0'));
_errorString = tr("Compare failed: expected(0x%1) actual(0x%2) at address: 0x%3").arg(imageBytes[bytesIndex + i], 2, 16, QLatin1Char('0')).arg(readBuf[i], 2, 16, QLatin1Char('0')).arg(readAddress + i, 8, 16, QLatin1Char('0'));
return false;
}
}
......@@ -597,7 +597,7 @@ bool Bootloader::getPX4BoardInfo(QextSerialPort* port, uint32_t& bootloaderVersi
return true;
Error:
_errorString.prepend("Get Board Info: ");
_errorString.prepend(tr("Get Board Info: "));
return false;
}
......@@ -625,7 +625,7 @@ bool Bootloader::get3DRRadioBoardId(QextSerialPort* port, uint32_t& boardID)
return true;
Error:
_errorString.prepend("Get Board Id: ");
_errorString.prepend(tr("Get Board Id: "));
return false;
}
......
......@@ -142,12 +142,12 @@ bool FirmwareImage::_ihxLoad(const QString& ihxFilename)
!_readByteFromStream(stream, recordType) ||
!_readBytesFromStream(stream, blockByteCount, bytes) ||
!_readByteFromStream(stream, crc)) {
emit statusMessage("Incorrectly formatted line in .ihx file, line too short");
emit statusMessage(tr("Incorrectly formatted line in .ihx file, line too short"));
return false;
}
if (!(recordType == 0 || recordType == 1)) {
emit statusMessage(QString("Unsupported record type in file: %1").arg(recordType));
emit statusMessage(tr("Unsupported record type in file: %1").arg(recordType));
return false;
}
......@@ -220,7 +220,7 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
QFile px4File(imageFilename);
if (!px4File.open(QIODevice::ReadOnly | QIODevice::Text)) {
emit statusMessage(QString("Unable to open firmware file %1, error: %2").arg(imageFilename).arg(px4File.errorString()));
emit statusMessage(tr("Unable to open firmware file %1, error: %2").arg(imageFilename).arg(px4File.errorString()));
return false;
}
......@@ -229,7 +229,7 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
QJsonDocument doc = QJsonDocument::fromJson(bytes);
if (doc.isNull()) {
emit statusMessage("Supplied file is not a valid JSON document");
emit statusMessage(tr("Supplied file is not a valid JSON document"));
return false;
}
......@@ -240,7 +240,7 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
QStringList requiredKeys;
requiredKeys << _jsonBoardIdKey << _jsonImageKey << _jsonImageSizeKey;
if (!JsonHelper::validateRequiredKeys(px4Json, requiredKeys, errorString)) {
emit statusMessage(QString("Firmware file mission required key: %1").arg(errorString));
emit statusMessage(tr("Firmware file mission required key: %1").arg(errorString));
return false;
}
......@@ -250,13 +250,13 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
keys << _jsonBoardIdKey << _jsonParamXmlSizeKey << _jsonParamXmlKey << _jsonAirframeXmlSizeKey << _jsonAirframeXmlKey << _jsonImageSizeKey << _jsonImageKey << _jsonMavAutopilotKey;
types << QJsonValue::Double << QJsonValue::Double << QJsonValue::String << QJsonValue::Double << QJsonValue::String << QJsonValue::Double << QJsonValue::String << QJsonValue::Double;
if (!JsonHelper::validateKeyTypes(px4Json, keys, types, errorString)) {
emit statusMessage(QString("Firmware file has invalid key: %1").arg(errorString));
emit statusMessage(tr("Firmware file has invalid key: %1").arg(errorString));
return false;
}
uint32_t firmwareBoardId = (uint32_t)px4Json.value(_jsonBoardIdKey).toInt();
if (!isCompatible(_boardId, firmwareBoardId)) {
emit statusMessage(QString("Downloaded firmware board id does not match hardware board id: %1 != %2").arg(firmwareBoardId).arg(_boardId));
emit statusMessage(tr("Downloaded firmware board id does not match hardware board id: %1 != %2").arg(firmwareBoardId).arg(_boardId));
return false;
}
......@@ -282,14 +282,14 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
if (parameterFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
qint64 bytesWritten = parameterFile.write(decompressedBytes);
if (bytesWritten != decompressedBytes.count()) {
emit statusMessage(QString("Write failed for parameter meta data file, error: %1").arg(parameterFile.errorString()));
emit statusMessage(tr("Write failed for parameter meta data file, error: %1").arg(parameterFile.errorString()));
parameterFile.close();
QFile::remove(parameterFilename);
} else {
parameterFile.close();
}
} else {
emit statusMessage(QString("Unable to open parameter meta data file %1 for writing, error: %2").arg(parameterFilename).arg(parameterFile.errorString()));
emit statusMessage(tr("Unable to open parameter meta data file %1 for writing, error: %2").arg(parameterFilename).arg(parameterFile.errorString()));
}
// Cache this file with the system
......@@ -314,14 +314,14 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
qint64 bytesWritten = airframeFile.write(decompressedBytes);
if (bytesWritten != decompressedBytes.count()) {
// FIXME: What about these warnings?
emit statusMessage(QString("Write failed for airframe meta data file, error: %1").arg(airframeFile.errorString()));
emit statusMessage(tr("Write failed for airframe meta data file, error: %1").arg(airframeFile.errorString()));
airframeFile.close();
QFile::remove(airframeFilename);
} else {
airframeFile.close();
}
} else {
emit statusMessage(QString("Unable to open airframe meta data file %1 for writing, error: %2").arg(airframeFilename).arg(airframeFile.errorString()));
emit statusMessage(tr("Unable to open airframe meta data file %1 for writing, error: %2").arg(airframeFilename).arg(airframeFile.errorString()));
}
}
......@@ -347,13 +347,13 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
QFile decompressFile(decompressFilename);
if (!decompressFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
emit statusMessage(QString("Unable to open decompressed file %1 for writing, error: %2").arg(decompressFilename).arg(decompressFile.errorString()));
emit statusMessage(tr("Unable to open decompressed file %1 for writing, error: %2").arg(decompressFilename).arg(decompressFile.errorString()));
return false;
}