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;
}
qint64 bytesWritten = decompressFile.write(decompressedBytes);
if (bytesWritten != decompressedBytes.count()) {
emit statusMessage(QString("Write failed for decompressed image file, error: %1").arg(decompressFile.errorString()));
emit statusMessage(tr("Write failed for decompressed image file, error: %1").arg(decompressFile.errorString()));
return false;
}
decompressFile.close();
......@@ -377,7 +377,7 @@ bool FirmwareImage::_decompressJsonValue(const QJsonObject& jsonObject, ///< J
}
int decompressedSize = jsonObject.value(QString(sizeKey)).toInt();
if (decompressedSize == 0) {
emit statusMessage(QString("Firmware file has invalid decompressed size for %1").arg(sizeKey));
emit statusMessage(tr("Firmware file has invalid decompressed size for %1").arg(sizeKey));
return false;
}
......@@ -389,12 +389,12 @@ bool FirmwareImage::_decompressJsonValue(const QJsonObject& jsonObject, ///< J
QStringList parts = QString(jsonDocBytes).split(QString("\"%1\": \"").arg(bytesKey));
if (parts.count() == 1) {
emit statusMessage(QString("Could not find compressed bytes for %1 in Firmware file").arg(bytesKey));
emit statusMessage(tr("Could not find compressed bytes for %1 in Firmware file").arg(bytesKey));
return false;
}
parts = parts.last().split("\"");
if (parts.count() == 1) {
emit statusMessage(QString("Incorrectly formed compressed bytes section for %1 in Firmware file").arg(bytesKey));
emit statusMessage(tr("Incorrectly formed compressed bytes section for %1 in Firmware file").arg(bytesKey));
return false;
}
......@@ -410,15 +410,15 @@ bool FirmwareImage::_decompressJsonValue(const QJsonObject& jsonObject, ///< J
decompressedBytes = qUncompress(raw);
if (decompressedBytes.count() == 0) {
emit statusMessage(QString("Firmware file has 0 length %1").arg(bytesKey));
emit statusMessage(tr("Firmware file has 0 length %1").arg(bytesKey));
return false;
}
if (decompressedBytes.count() != decompressedSize) {
emit statusMessage(QString("Size for decompressed %1 does not match stored size: Expected(%1) Actual(%2)").arg(decompressedSize).arg(decompressedBytes.count()));
emit statusMessage(tr("Size for decompressed %1 does not match stored size: Expected(%1) Actual(%2)").arg(decompressedSize).arg(decompressedBytes.count()));
return false;
}
emit statusMessage(QString("Successfully decompressed %1").arg(bytesKey));
emit statusMessage(tr("Successfully decompressed %1").arg(bytesKey));
return true;
}
......@@ -446,7 +446,7 @@ bool FirmwareImage::_binLoad(const QString& imageFilename)
{
QFile binFile(imageFilename);
if (!binFile.open(QIODevice::ReadOnly)) {
emit statusMessage(QString("Unabled to open firmware file %1, %2").arg(imageFilename).arg(binFile.errorString()));
emit statusMessage(tr("Unabled to open firmware file %1, %2").arg(imageFilename).arg(binFile.errorString()));
return false;
}
......
......@@ -167,10 +167,10 @@ void FirmwareUpgradeController::_foundBootloader(int bootloaderVersion, int boar
_bootloaderBoardID = boardID;
_bootloaderBoardFlashSize = flashSize;
_appendStatusLog("Connected to bootloader:");
_appendStatusLog(QString(" Version: %1").arg(_bootloaderVersion));
_appendStatusLog(QString(" Board ID: %1").arg(_bootloaderBoardID));
_appendStatusLog(QString(" Flash size: %1").arg(_bootloaderBoardFlashSize));
_appendStatusLog(tr("Connected to bootloader:"));
_appendStatusLog(tr(" Version: %1").arg(_bootloaderVersion));
_appendStatusLog(tr(" Board ID: %1").arg(_bootloaderBoardID));
_appendStatusLog(tr(" Flash size: %1").arg(_bootloaderBoardFlashSize));
if (_startFlashWhenBootloaderFound) {
flash(_startFlashWhenBootloaderFoundFirmwareIdentity);
......@@ -518,26 +518,26 @@ void FirmwareUpgradeController::_getFirmwareFile(FirmwareIdentifier firmwareId)
QHash<FirmwareIdentifier, QString>* 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();
......
......@@ -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);
......
......@@ -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 {
......
......@@ -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);
......
......@@ -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
......
......@@ -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();
}
......
......@@ -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;
}
......
......@@ -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.
......
......@@ -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;
......
......@@ -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()));
}
/**
......
......@@ -307,7 +307,7 @@ void UDPLink::_registerZeroconf(uint16_t port, const std::string &regType)
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
......
......@@ -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());
......
......@@ -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.
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment