From 773c9bd913d3e15ee756fb88841e0238a37f0ec7 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 19 Oct 2017 20:39:50 -0700 Subject: [PATCH] String fixups for loc --- src/AnalyzeView/LogDownloadController.cc | 6 +- src/AnalyzeView/ULogParser.cc | 36 +++---- .../APM/APMAirframeComponent.cc | 2 +- .../APM/APMAirframeComponentController.cc | 2 +- src/AutoPilotPlugins/APM/APMCompassCal.cc | 24 ++--- .../APM/APMFlightModesComponentController.cc | 4 +- src/AutoPilotPlugins/APM/APMPowerComponent.cc | 2 +- src/AutoPilotPlugins/APM/APMRadioComponent.cc | 12 +-- .../APM/APMSensorsComponent.cc | 12 +-- .../APM/APMSensorsComponentController.cc | 8 +- .../APM/APMTuningComponent.cc | 2 +- src/AutoPilotPlugins/AutoPilotPlugin.cc | 2 +- .../Common/ESP8266ComponentController.cc | 96 +++++++++---------- .../Common/RadioComponentController.cc | 12 +-- .../Common/SyslinkComponentController.cc | 38 ++++---- src/AutoPilotPlugins/PX4/AirframeComponent.cc | 4 +- 16 files changed, 131 insertions(+), 131 deletions(-) diff --git a/src/AnalyzeView/LogDownloadController.cc b/src/AnalyzeView/LogDownloadController.cc index ed912a421..d48b6652b 100644 --- a/src/AnalyzeView/LogDownloadController.cc +++ b/src/AnalyzeView/LogDownloadController.cc @@ -589,14 +589,14 @@ LogDownloadController::_prepareLogDownload() bool result = false; QString ftime; if(entry->time().date().year() < 2010) { - ftime = "UnknownDate"; + ftime = tr("UnknownDate"); } else { - ftime = entry->time().toString("yyyy-M-d-hh-mm-ss"); + ftime = entry->time().toString(QStringLiteral("yyyy-M-d-hh-mm-ss")); } _downloadData = new LogDownloadData(entry); _downloadData->filename = QString("log_") + QString::number(entry->id()) + "_" + ftime; if (_vehicle->firmwareType() == MAV_AUTOPILOT_PX4) { - QString loggerParam("SYS_LOGGER"); + QString loggerParam = QStringLiteral("SYS_LOGGER"); if (_vehicle->parameterManager()->parameterExists(FactSystem::defaultComponentId, loggerParam) && _vehicle->parameterManager()->getParameter(FactSystem::defaultComponentId, loggerParam)->rawValue().toInt() == 0) { _downloadData->filename += ".px4log"; diff --git a/src/AnalyzeView/ULogParser.cc b/src/AnalyzeView/ULogParser.cc index 17c08fa85..8a7e172bc 100644 --- a/src/AnalyzeView/ULogParser.cc +++ b/src/AnalyzeView/ULogParser.cc @@ -14,25 +14,25 @@ ULogParser::~ULogParser() int ULogParser::sizeOfType(QString& typeName) { - if (typeName == "int8_t" || typeName == "uint8_t") { + if (typeName == QLatin1Literal("int8_t") || typeName == QLatin1Literal("uint8_t")) { return 1; - } else if (typeName == "int16_t" || typeName == "uint16_t") { + } else if (typeName == QLatin1Literal("int16_t") || typeName == QLatin1Literal("uint16_t")) { return 2; - } else if (typeName == "int32_t" || typeName == "uint32_t") { + } else if (typeName == QLatin1Literal("int32_t") || typeName == QLatin1Literal("uint32_t")) { return 4; - } else if (typeName == "int64_t" || typeName == "uint64_t") { + } else if (typeName == QLatin1Literal("int64_t") || typeName == QLatin1Literal("uint64_t")) { return 8; - } else if (typeName == "float") { + } else if (typeName == QLatin1Literal("float")) { return 4; - } else if (typeName == "double") { + } else if (typeName == QLatin1Literal("double")) { return 8; - } else if (typeName == "char" || typeName == "bool") { + } else if (typeName == QLatin1Literal("char") || typeName == QLatin1Literal("bool")) { return 1; } @@ -74,7 +74,7 @@ bool ULogParser::parseFieldFormat(QString& fields) QString typeNameFull = fields.mid(prevFieldEnd, spacePos - prevFieldEnd); QString fieldName = fields.mid(spacePos + 1, fieldEnd - spacePos - 1); - if (!fieldName.contains("_padding")) { + if (!fieldName.contains(QLatin1Literal("_padding"))) { _cameraCaptureOffsets.insert(fieldName, offset); offset += sizeOfFullType(typeNameFull); } @@ -115,7 +115,7 @@ bool ULogParser::getTagsFromLog(QByteArray& log, QList(_vehicle->firmwarePlugin()) != NULL) { ParameterManager* paramMgr = _vehicle->parameterManager(); diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponentController.cc b/src/AutoPilotPlugins/APM/APMAirframeComponentController.cc index c37baef66..d26c39896 100644 --- a/src/AutoPilotPlugins/APM/APMAirframeComponentController.cc +++ b/src/AutoPilotPlugins/APM/APMAirframeComponentController.cc @@ -237,7 +237,7 @@ void APMAirframeComponentController::_githubJsonDownloadFinished(QString remoteF QGCFileDownload* downloader = new QGCFileDownload(this); connect(downloader, &QGCFileDownload::downloadFinished, this, &APMAirframeComponentController::_paramFileDownloadFinished); connect(downloader, &QGCFileDownload::error, this, &APMAirframeComponentController::_paramFileDownloadError); - downloader->download(json["download_url"].toString()); + downloader->download(json[QLatin1Literal("download_url")].toString()); } void APMAirframeComponentController::_githubJsonDownloadError(QString errorMsg) diff --git a/src/AutoPilotPlugins/APM/APMCompassCal.cc b/src/AutoPilotPlugins/APM/APMCompassCal.cc index 88dd8a67b..2c8d0e8ea 100644 --- a/src/AutoPilotPlugins/APM/APMCompassCal.cc +++ b/src/AutoPilotPlugins/APM/APMCompassCal.cc @@ -117,7 +117,7 @@ CalWorkerThread::calibrate_return CalWorkerThread::calibrate(void) &sphere_radius[cur_mag]); if (qIsNaN(sphere_x[cur_mag]) || qIsNaN(sphere_y[cur_mag]) || qIsNaN(sphere_z[cur_mag])) { - _emitVehicleTextMessage(QString("[cal] ERROR: NaN in sphere fit for mag %1").arg(cur_mag)); + _emitVehicleTextMessage(QStringLiteral("[cal] ERROR: NaN in sphere fit for mag %1").arg(cur_mag)); result = calibrate_return_error; } } @@ -134,7 +134,7 @@ CalWorkerThread::calibrate_return CalWorkerThread::calibrate(void) if (result == calibrate_return_ok) { for (unsigned cur_mag=0; cur_magcalibration_interval_perside_seconds)); + _emitVehicleTextMessage(QStringLiteral("[cal] Continue rotation for %1 seconds").arg(worker_data->calibration_interval_perside_seconds)); uint64_t calibration_deadline = QGC::groundTimeUsecs() + worker_data->calibration_interval_perside_useconds; @@ -212,7 +212,7 @@ CalWorkerThread::calibrate_return CalWorkerThread::mag_calibration_worker(detect calibration_counter_side++; // Progress indicator for side - _emitVehicleTextMessage(QString("[cal] %1 side calibration: progress <%2>").arg(detect_orientation_str(orientation)).arg(progress_percentage(worker_data) + + _emitVehicleTextMessage(QStringLiteral("[cal] %1 side calibration: progress <%2>").arg(detect_orientation_str(orientation)).arg(progress_percentage(worker_data) + (unsigned)((100 / calibration_sides) * ((float)calibration_counter_side / (float)worker_data->calibration_points_perside)))); } @@ -220,10 +220,10 @@ CalWorkerThread::calibrate_return CalWorkerThread::mag_calibration_worker(detect } if (result == calibrate_return_ok) { - _emitVehicleTextMessage(QString("[cal] %1 side done, rotate to a different side").arg(detect_orientation_str(orientation))); + _emitVehicleTextMessage(QStringLiteral("[cal] %1 side done, rotate to a different side").arg(detect_orientation_str(orientation))); worker_data->done_count++; - _emitVehicleTextMessage(QString("[cal] progress <%1>").arg(progress_percentage(worker_data))); + _emitVehicleTextMessage(QStringLiteral("[cal] progress <%1>").arg(progress_percentage(worker_data))); } return result; @@ -268,7 +268,7 @@ CalWorkerThread::calibrate_return CalWorkerThread::calibrate_from_orientation( strcat(pendingStr, detect_orientation_str((enum detect_orientation_return)cur_orientation)); } } - _emitVehicleTextMessage(QString("[cal] pending:%1").arg(pendingStr)); + _emitVehicleTextMessage(QStringLiteral("[cal] pending:%1").arg(pendingStr)); _emitVehicleTextMessage(QStringLiteral("[cal] hold vehicle still on a pending side")); enum detect_orientation_return orient = detect_orientation(); @@ -282,12 +282,12 @@ CalWorkerThread::calibrate_return CalWorkerThread::calibrate_from_orientation( /* inform user about already handled side */ if (side_data_collected[orient]) { orientation_failures++; - _emitVehicleTextMessage(QString("%1 side already completed").arg(detect_orientation_str(orient))); + _emitVehicleTextMessage(QStringLiteral("%1 side already completed").arg(detect_orientation_str(orient))); _emitVehicleTextMessage(QStringLiteral("rotate to a pending side")); continue; } - _emitVehicleTextMessage(QString("[cal] %1 orientation detected").arg(detect_orientation_str(orient))); + _emitVehicleTextMessage(QStringLiteral("[cal] %1 orientation detected").arg(detect_orientation_str(orient))); orientation_failures = 0; // Call worker routine @@ -296,7 +296,7 @@ CalWorkerThread::calibrate_return CalWorkerThread::calibrate_from_orientation( break; } - _emitVehicleTextMessage(QString("[cal] %1 side done, rotate to a different side").arg(detect_orientation_str(orient))); + _emitVehicleTextMessage(QStringLiteral("[cal] %1 side done, rotate to a different side").arg(detect_orientation_str(orient))); // Note that this side is complete side_data_collected[orient] = true; @@ -607,7 +607,7 @@ void APMCompassCal::startCalibration(void) connect (_vehicle, &Vehicle::mavlinkScaledImu3, this, &APMCompassCal::_handleMavlinkScaledImu3); // Simulate a start message - _emitVehicleTextMessage("[cal] calibration started: mag"); + _emitVehicleTextMessage(QStringLiteral("[cal] calibration started: mag")); _calWorkerThread = new CalWorkerThread(_vehicle); connect(_calWorkerThread, &CalWorkerThread::vehicleTextMessage, this, &APMCompassCal::vehicleTextMessage); @@ -650,7 +650,7 @@ void APMCompassCal::cancelCalibration(void) } // Simulate a cancelled message - _emitVehicleTextMessage("[cal] calibration cancelled"); + _emitVehicleTextMessage(QStringLiteral("[cal] calibration cancelled")); } void APMCompassCal::_handleMavlinkRawImu(mavlink_message_t message) diff --git a/src/AutoPilotPlugins/APM/APMFlightModesComponentController.cc b/src/AutoPilotPlugins/APM/APMFlightModesComponentController.cc index 58410af77..0411846bf 100644 --- a/src/AutoPilotPlugins/APM/APMFlightModesComponentController.cc +++ b/src/AutoPilotPlugins/APM/APMFlightModesComponentController.cc @@ -18,8 +18,8 @@ APMFlightModesComponentController::APMFlightModesComponentController(void) : _activeFlightMode(0) , _channelCount(Vehicle::cMaxRcChannels) { - _modeParamPrefix = _vehicle->rover() ? "MODE" : "FLTMODE"; - _modeChannelParam = _vehicle->rover() ? "MODE_CH" : "FLTMODE_CH"; + _modeParamPrefix = _vehicle->rover() ? QStringLiteral("MODE") : QStringLiteral("FLTMODE"); + _modeChannelParam = _vehicle->rover() ? QStringLiteral("MODE_CH") : QStringLiteral("FLTMODE_CH"); QStringList usedParams; for (int i=1; i<7; i++) { diff --git a/src/AutoPilotPlugins/APM/APMPowerComponent.cc b/src/AutoPilotPlugins/APM/APMPowerComponent.cc index dce3f43a9..d7e6f371a 100644 --- a/src/AutoPilotPlugins/APM/APMPowerComponent.cc +++ b/src/AutoPilotPlugins/APM/APMPowerComponent.cc @@ -15,7 +15,7 @@ APMPowerComponent::APMPowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : VehicleComponent(vehicle, autopilot, parent), - _name("Power") + _name(tr("Power")) { } diff --git a/src/AutoPilotPlugins/APM/APMRadioComponent.cc b/src/AutoPilotPlugins/APM/APMRadioComponent.cc index a53174b51..e047b0634 100644 --- a/src/AutoPilotPlugins/APM/APMRadioComponent.cc +++ b/src/AutoPilotPlugins/APM/APMRadioComponent.cc @@ -66,13 +66,13 @@ bool APMRadioComponent::setupComplete(void) const // Next check RC#_MIN/MAX/TRIM all at defaults foreach (const QString& mapParam, _mapParams) { int channel = _vehicle->parameterManager()->getParameter(-1, mapParam)->rawValue().toInt(); - if (_vehicle->parameterManager()->getParameter(-1, QString("RC%1_MIN").arg(channel))->rawValue().toInt() != 1100) { + if (_vehicle->parameterManager()->getParameter(-1, QStringLiteral("RC%1_MIN").arg(channel))->rawValue().toInt() != 1100) { return true; } - if (_vehicle->parameterManager()->getParameter(-1, QString("RC%1_MAX").arg(channel))->rawValue().toInt() != 1900) { + if (_vehicle->parameterManager()->getParameter(-1, QStringLiteral("RC%1_MAX").arg(channel))->rawValue().toInt() != 1900) { return true; } - if (_vehicle->parameterManager()->getParameter(-1, QString("RC%1_TRIM").arg(channel))->rawValue().toInt() != 1500) { + if (_vehicle->parameterManager()->getParameter(-1, QStringLiteral("RC%1_TRIM").arg(channel))->rawValue().toInt() != 1500) { return true; } } @@ -108,15 +108,15 @@ void APMRadioComponent::_connectSetupTriggers(void) foreach (const QString& mapParam, _mapParams) { int channel = _vehicle->parameterManager()->getParameter(FactSystem::defaultComponentId, mapParam)->rawValue().toInt(); - Fact* fact = _vehicle->parameterManager()->getParameter(-1, QString("RC%1_MIN").arg(channel)); + Fact* fact = _vehicle->parameterManager()->getParameter(-1, QStringLiteral("RC%1_MIN").arg(channel)); _triggerFacts << fact; connect(fact, &Fact::valueChanged, this, &APMRadioComponent::_triggerChanged); - fact = _vehicle->parameterManager()->getParameter(-1, QString("RC%1_MAX").arg(channel)); + fact = _vehicle->parameterManager()->getParameter(-1, QStringLiteral("RC%1_MAX").arg(channel)); _triggerFacts << fact; connect(fact, &Fact::valueChanged, this, &APMRadioComponent::_triggerChanged); - fact = _vehicle->parameterManager()->getParameter(-1, QString("RC%1_TRIM").arg(channel)); + fact = _vehicle->parameterManager()->getParameter(-1, QStringLiteral("RC%1_TRIM").arg(channel)); _triggerFacts << fact; connect(fact, &Fact::valueChanged, this, &APMRadioComponent::_triggerChanged); } diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponent.cc b/src/AutoPilotPlugins/APM/APMSensorsComponent.cc index 7476f25c1..533582200 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponent.cc +++ b/src/AutoPilotPlugins/APM/APMSensorsComponent.cc @@ -53,14 +53,14 @@ QStringList APMSensorsComponent::setupCompleteChangedTriggerList(void) const QStringList triggers; // Compass triggers - triggers << "COMPASS_DEV_ID" << "COMPASS_DEV_ID2" << "COMPASS_DEV_ID3" - << "COMPASS_USE" << "COMPASS_USE2" << "COMPASS_USE3" - << "COMPASS_OFS_X" << "COMPASS_OFS_X" << "COMPASS_OFS_X" - << "COMPASS_OFS2_X" << "COMPASS_OFS2_X" << "COMPASS_OFS2_X" - << "COMPASS_OFS3_X" << "COMPASS_OFS3_X" << "COMPASS_OFS3_X"; + triggers << QStringLiteral("COMPASS_DEV_ID") << QStringLiteral("COMPASS_DEV_ID2") << QStringLiteral("COMPASS_DEV_ID3") + << QStringLiteral("COMPASS_USE") << QStringLiteral("COMPASS_USE2") << QStringLiteral("COMPASS_USE3") + << QStringLiteral("COMPASS_OFS_X") << QStringLiteral("COMPASS_OFS_X") << QStringLiteral("COMPASS_OFS_X") + << QStringLiteral("COMPASS_OFS2_X") << QStringLiteral("COMPASS_OFS2_X") << QStringLiteral("COMPASS_OFS2_X") + << QStringLiteral("COMPASS_OFS3_X") << QStringLiteral("COMPASS_OFS3_X") << QStringLiteral("COMPASS_OFS3_X"); // Accelerometer triggers - triggers << "INS_ACCOFFS_X" << "INS_ACCOFFS_Y" << "INS_ACCOFFS_Z"; + triggers << QStringLiteral("INS_ACCOFFS_X") << QStringLiteral("INS_ACCOFFS_Y") << QStringLiteral("INS_ACCOFFS_Z"); return triggers; } diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc b/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc index 09a50bd4d..b767f744e 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc +++ b/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc @@ -179,7 +179,7 @@ void APMSensorsComponentController::_stopCalibration(APMSensorsComponentControll switch (code) { case StopCalibrationSuccess: - _orientationCalAreaHelpText->setProperty("text", "Calibration complete"); + _orientationCalAreaHelpText->setProperty("text", tr("Calibration complete")); emit resetStatusTextArea(); emit calibrationComplete(_calTypeInProgress); break; @@ -226,7 +226,7 @@ void APMSensorsComponentController::_mavCommandResult(int vehicleId, int compone _startLogCalibration(); uint8_t compassBits = 0; - if (getParameterFact(FactSystem::defaultComponentId, "COMPASS_DEV_ID")->rawValue().toInt() > 0) { + if (getParameterFact(FactSystem::defaultComponentId, QStringLiteral("COMPASS_DEV_ID"))->rawValue().toInt() > 0) { compassBits |= 1 << 0; qCDebug(APMSensorsComponentControllerLog) << "Performing onboard compass cal for compass 1"; } else { @@ -234,7 +234,7 @@ void APMSensorsComponentController::_mavCommandResult(int vehicleId, int compone _rgCompassCalSucceeded[0] = true; _rgCompassCalFitness[0] = 0; } - if (getParameterFact(FactSystem::defaultComponentId, "COMPASS_DEV_ID2")->rawValue().toInt() > 0) { + if (getParameterFact(FactSystem::defaultComponentId, QStringLiteral("COMPASS_DEV_ID2"))->rawValue().toInt() > 0) { compassBits |= 1 << 1; qCDebug(APMSensorsComponentControllerLog) << "Performing onboard compass cal for compass 2"; } else { @@ -242,7 +242,7 @@ void APMSensorsComponentController::_mavCommandResult(int vehicleId, int compone _rgCompassCalSucceeded[1] = true; _rgCompassCalFitness[1] = 0; } - if (getParameterFact(FactSystem::defaultComponentId, "COMPASS_DEV_ID3")->rawValue().toInt() > 0) { + if (getParameterFact(FactSystem::defaultComponentId, QStringLiteral("COMPASS_DEV_ID3"))->rawValue().toInt() > 0) { compassBits |= 1 << 2; qCDebug(APMSensorsComponentControllerLog) << "Performing onboard compass cal for compass 3"; } else { diff --git a/src/AutoPilotPlugins/APM/APMTuningComponent.cc b/src/AutoPilotPlugins/APM/APMTuningComponent.cc index 76bbed70f..231d2da25 100644 --- a/src/AutoPilotPlugins/APM/APMTuningComponent.cc +++ b/src/AutoPilotPlugins/APM/APMTuningComponent.cc @@ -15,7 +15,7 @@ APMTuningComponent::APMTuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : VehicleComponent(vehicle, autopilot, parent) - , _name("Tuning") + , _name(tr("Tuning")) { } diff --git a/src/AutoPilotPlugins/AutoPilotPlugin.cc b/src/AutoPilotPlugins/AutoPilotPlugin.cc index 666734cd9..731e43dd9 100644 --- a/src/AutoPilotPlugins/AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/AutoPilotPlugin.cc @@ -62,7 +62,7 @@ void AutoPilotPlugin::parametersReadyPreChecks(void) { _recalcSetupComplete(); if (!_setupComplete) { - qgcApp()->showMessage("One or more vehicle components require setup prior to flight."); + qgcApp()->showMessage(tr("One or more vehicle components require setup prior to flight.")); // Take the user to Vehicle Summary qgcApp()->showSetupView(); diff --git a/src/AutoPilotPlugins/Common/ESP8266ComponentController.cc b/src/AutoPilotPlugins/Common/ESP8266ComponentController.cc index 1e7c937d1..0fb78fdb8 100644 --- a/src/AutoPilotPlugins/Common/ESP8266ComponentController.cc +++ b/src/AutoPilotPlugins/Common/ESP8266ComponentController.cc @@ -32,19 +32,19 @@ ESP8266ComponentController::ESP8266ComponentController() for(int i = 1; i < 12; i++) { _channels.append(QString::number(i)); } - _baudRates.append("57600"); - _baudRates.append("115200"); - _baudRates.append("230400"); - _baudRates.append("460800"); - _baudRates.append("921600"); + _baudRates.append(QStringLiteral("57600")); + _baudRates.append(QStringLiteral("115200")); + _baudRates.append(QStringLiteral("230400")); + _baudRates.append(QStringLiteral("460800")); + _baudRates.append(QStringLiteral("921600")); connect(_vehicle, &Vehicle::mavCommandResult, this, &ESP8266ComponentController::_mavCommandResult); - Fact* ssid = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSID4"); + Fact* ssid = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSID4")); connect(ssid, &Fact::valueChanged, this, &ESP8266ComponentController::_ssidChanged); - Fact* paswd = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PASSWORD4"); + Fact* paswd = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PASSWORD4")); connect(paswd, &Fact::valueChanged, this, &ESP8266ComponentController::_passwordChanged); - Fact* baud = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "UART_BAUDRATE"); + Fact* baud = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("UART_BAUDRATE")); connect(baud, &Fact::valueChanged, this, &ESP8266ComponentController::_baudChanged); - Fact* ver = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "SW_VER"); + Fact* ver = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("SW_VER")); connect(ver, &Fact::valueChanged, this, &ESP8266ComponentController::_versionChanged); } @@ -58,7 +58,7 @@ ESP8266ComponentController::~ESP8266ComponentController() QString ESP8266ComponentController::version() { - uint32_t uv = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "SW_VER")->rawValue().toUInt(); + uint32_t uv = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("SW_VER"))->rawValue().toUInt(); QString versionString = QString("%1.%2.%3").arg(uv >> 24).arg((uv >> 16) & 0xFF).arg(uv & 0xFFFF); return versionString; } @@ -68,8 +68,8 @@ QString ESP8266ComponentController::wifiIPAddress() { if(_ipAddress.isEmpty()) { - if(parameterExists(MAV_COMP_ID_UDP_BRIDGE, "WIFI_IPADDRESS")) { - QHostAddress address(qFromBigEndian(getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_IPADDRESS")->rawValue().toUInt())); + if(parameterExists(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_IPADDRESS"))) { + QHostAddress address(qFromBigEndian(getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_IPADDRESS"))->rawValue().toUInt())); _ipAddress = address.toString(); } else { _ipAddress = "192.168.4.1"; @@ -82,10 +82,10 @@ ESP8266ComponentController::wifiIPAddress() QString ESP8266ComponentController::wifiSSID() { - uint32_t s1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSID1")->rawValue().toUInt(); - uint32_t s2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSID2")->rawValue().toUInt(); - uint32_t s3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSID3")->rawValue().toUInt(); - uint32_t s4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSID4")->rawValue().toUInt(); + uint32_t s1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSID1"))->rawValue().toUInt(); + uint32_t s2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSID2"))->rawValue().toUInt(); + uint32_t s3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSID3"))->rawValue().toUInt(); + uint32_t s4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSID4"))->rawValue().toUInt(); char tmp[20]; memcpy(&tmp[0], &s1, sizeof(uint32_t)); memcpy(&tmp[4], &s2, sizeof(uint32_t)); @@ -102,10 +102,10 @@ ESP8266ComponentController::setWifiSSID(QString ssid) memset(tmp, 0, sizeof(tmp)); std::string sid = ssid.toStdString(); strncpy(tmp, sid.c_str(), sizeof(tmp)); - Fact* f1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSID1"); - Fact* f2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSID2"); - Fact* f3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSID3"); - Fact* f4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSID4"); + Fact* f1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSID1")); + Fact* f2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSID2")); + Fact* f3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSID3")); + Fact* f4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSID4")); uint32_t u; memcpy(&u, &tmp[0], sizeof(uint32_t)); f1->setRawValue(QVariant(u)); @@ -121,10 +121,10 @@ ESP8266ComponentController::setWifiSSID(QString ssid) QString ESP8266ComponentController::wifiPassword() { - uint32_t s1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PASSWORD1")->rawValue().toUInt(); - uint32_t s2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PASSWORD2")->rawValue().toUInt(); - uint32_t s3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PASSWORD3")->rawValue().toUInt(); - uint32_t s4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PASSWORD4")->rawValue().toUInt(); + uint32_t s1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PASSWORD1"))->rawValue().toUInt(); + uint32_t s2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PASSWORD2"))->rawValue().toUInt(); + uint32_t s3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PASSWORD3"))->rawValue().toUInt(); + uint32_t s4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PASSWORD4"))->rawValue().toUInt(); char tmp[20]; memcpy(&tmp[0], &s1, sizeof(uint32_t)); memcpy(&tmp[4], &s2, sizeof(uint32_t)); @@ -141,10 +141,10 @@ ESP8266ComponentController::setWifiPassword(QString password) memset(tmp, 0, sizeof(tmp)); std::string pwd = password.toStdString(); strncpy(tmp, pwd.c_str(), sizeof(tmp)); - Fact* f1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PASSWORD1"); - Fact* f2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PASSWORD2"); - Fact* f3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PASSWORD3"); - Fact* f4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PASSWORD4"); + Fact* f1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PASSWORD1")); + Fact* f2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PASSWORD2")); + Fact* f3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PASSWORD3")); + Fact* f4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PASSWORD4")); uint32_t u; memcpy(&u, &tmp[0], sizeof(uint32_t)); f1->setRawValue(QVariant(u)); @@ -163,10 +163,10 @@ ESP8266ComponentController::wifiSSIDSta() if(!parameterExists(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSIDSTA1")) { return QString(); } - uint32_t s1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSIDSTA1")->rawValue().toUInt(); - uint32_t s2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSIDSTA2")->rawValue().toUInt(); - uint32_t s3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSIDSTA3")->rawValue().toUInt(); - uint32_t s4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSIDSTA4")->rawValue().toUInt(); + uint32_t s1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSIDSTA1"))->rawValue().toUInt(); + uint32_t s2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSIDSTA2"))->rawValue().toUInt(); + uint32_t s3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSIDSTA3"))->rawValue().toUInt(); + uint32_t s4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSIDSTA4"))->rawValue().toUInt(); char tmp[20]; memcpy(&tmp[0], &s1, sizeof(uint32_t)); memcpy(&tmp[4], &s2, sizeof(uint32_t)); @@ -184,10 +184,10 @@ ESP8266ComponentController::setWifiSSIDSta(QString ssid) memset(tmp, 0, sizeof(tmp)); std::string sid = ssid.toStdString(); strncpy(tmp, sid.c_str(), sizeof(tmp)); - Fact* f1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSIDSTA1"); - Fact* f2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSIDSTA2"); - Fact* f3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSIDSTA3"); - Fact* f4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSIDSTA4"); + Fact* f1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSIDSTA1")); + Fact* f2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSIDSTA2")); + Fact* f3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSIDSTA3")); + Fact* f4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_SSIDSTA4")); uint32_t u; memcpy(&u, &tmp[0], sizeof(uint32_t)); f1->setRawValue(QVariant(u)); @@ -204,13 +204,13 @@ ESP8266ComponentController::setWifiSSIDSta(QString ssid) QString ESP8266ComponentController::wifiPasswordSta() { - if(!parameterExists(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PWDSTA1")) { + if(!parameterExists(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PWDSTA1"))) { return QString(); } - uint32_t s1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PWDSTA1")->rawValue().toUInt(); - uint32_t s2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PWDSTA2")->rawValue().toUInt(); - uint32_t s3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PWDSTA3")->rawValue().toUInt(); - uint32_t s4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PWDSTA4")->rawValue().toUInt(); + uint32_t s1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PWDSTA1"))->rawValue().toUInt(); + uint32_t s2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PWDSTA2"))->rawValue().toUInt(); + uint32_t s3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PWDSTA3"))->rawValue().toUInt(); + uint32_t s4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PWDSTA4"))->rawValue().toUInt(); char tmp[20]; memcpy(&tmp[0], &s1, sizeof(uint32_t)); memcpy(&tmp[4], &s2, sizeof(uint32_t)); @@ -223,15 +223,15 @@ ESP8266ComponentController::wifiPasswordSta() void ESP8266ComponentController::setWifiPasswordSta(QString password) { - if(parameterExists(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PWDSTA1")) { + if(parameterExists(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PWDSTA1"))) { char tmp[20]; memset(tmp, 0, sizeof(tmp)); std::string pwd = password.toStdString(); strncpy(tmp, pwd.c_str(), sizeof(tmp)); - Fact* f1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PWDSTA1"); - Fact* f2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PWDSTA2"); - Fact* f3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PWDSTA3"); - Fact* f4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_PWDSTA4"); + Fact* f1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PWDSTA1")); + Fact* f2 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PWDSTA2")); + Fact* f3 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PWDSTA3")); + Fact* f4 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("WIFI_PWDSTA4")); uint32_t u; memcpy(&u, &tmp[0], sizeof(uint32_t)); f1->setRawValue(QVariant(u)); @@ -248,7 +248,7 @@ ESP8266ComponentController::setWifiPasswordSta(QString password) int ESP8266ComponentController::baudIndex() { - int b = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "UART_BAUDRATE")->rawValue().toInt(); + int b = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("UART_BAUDRATE"))->rawValue().toInt(); switch (b) { case 57600: return 0; @@ -286,7 +286,7 @@ ESP8266ComponentController::setBaudIndex(int idx) default: baud = 921600; } - Fact* b = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "UART_BAUDRATE"); + Fact* b = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, QStringLiteral("UART_BAUDRATE")); b->setRawValue(baud); } } diff --git a/src/AutoPilotPlugins/Common/RadioComponentController.cc b/src/AutoPilotPlugins/Common/RadioComponentController.cc index 50d7cc750..f14f07694 100644 --- a/src/AutoPilotPlugins/Common/RadioComponentController.cc +++ b/src/AutoPilotPlugins/Common/RadioComponentController.cc @@ -791,8 +791,8 @@ void RadioComponentController::_writeCalibration(void) if (_px4Vehicle()) { // If the RC_CHAN_COUNT parameter is available write the channel count - if (parameterExists(FactSystem::defaultComponentId, "RC_CHAN_CNT")) { - getParameterFact(FactSystem::defaultComponentId, "RC_CHAN_CNT")->setRawValue(_chanCount); + if (parameterExists(FactSystem::defaultComponentId, QStringLiteral("RC_CHAN_CNT"))) { + getParameterFact(FactSystem::defaultComponentId, QStringLiteral("RC_CHAN_CNT"))->setRawValue(_chanCount); } } @@ -815,7 +815,7 @@ void RadioComponentController::_startCalibration(void) _uas->startCalibration(UASInterface::StartCalibrationRadio); } - _nextButton->setProperty("text", "Next"); + _nextButton->setProperty("text", tr("Next")); _cancelButton->setEnabled(true); _currentStep = 0; @@ -838,7 +838,7 @@ void RadioComponentController::_stopCalibration(void) _statusText->setProperty("text", ""); - _nextButton->setProperty("text", "Calibrate"); + _nextButton->setProperty("text", tr("Calibrate")); _nextButton->setEnabled(true); _cancelButton->setEnabled(false); _skipButton->setEnabled(false); @@ -861,8 +861,8 @@ void RadioComponentController::_rcCalSave(void) _rcCalState = rcCalStateSave; _statusText->setProperty("text", - "The current calibration settings are now displayed for each channel 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 channel 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/AutoPilotPlugins/Common/SyslinkComponentController.cc b/src/AutoPilotPlugins/Common/SyslinkComponentController.cc index 63145c074..02191021f 100644 --- a/src/AutoPilotPlugins/Common/SyslinkComponentController.cc +++ b/src/AutoPilotPlugins/Common/SyslinkComponentController.cc @@ -20,17 +20,17 @@ QGC_LOGGING_CATEGORY(SyslinkComponentControllerLog, "SyslinkComponentControllerL //----------------------------------------------------------------------------- SyslinkComponentController::SyslinkComponentController() { - _dataRates.append("750Kb/s"); - _dataRates.append("1Mb/s"); - _dataRates.append("2Mb/s"); + _dataRates.append(QStringLiteral("750Kb/s")); + _dataRates.append(QStringLiteral("1Mb/s")); + _dataRates.append(QStringLiteral("2Mb/s")); - Fact* chan = getParameterFact(_vehicle->id(), "SLNK_RADIO_CHAN"); + Fact* chan = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_CHAN")); connect(chan, &Fact::valueChanged, this, &SyslinkComponentController::_channelChanged); - Fact* rate = getParameterFact(_vehicle->id(), "SLNK_RADIO_RATE"); + Fact* rate = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_RATE")); connect(rate, &Fact::valueChanged, this, &SyslinkComponentController::_rateChanged); - Fact* addr1 = getParameterFact(_vehicle->id(), "SLNK_RADIO_ADDR1"); + Fact* addr1 = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_ADDR1")); connect(addr1, &Fact::valueChanged, this, &SyslinkComponentController::_addressChanged); - Fact* addr2 = getParameterFact(_vehicle->id(), "SLNK_RADIO_ADDR2"); + Fact* addr2 = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_ADDR2")); connect(addr2, &Fact::valueChanged, this, &SyslinkComponentController::_addressChanged); } @@ -44,14 +44,14 @@ SyslinkComponentController::~SyslinkComponentController() int SyslinkComponentController::radioChannel() { - return getParameterFact(_vehicle->id(), "SLNK_RADIO_CHAN")->rawValue().toUInt(); + return getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_CHAN"))->rawValue().toUInt(); } //----------------------------------------------------------------------------- void SyslinkComponentController::setRadioChannel(int num) { - Fact* f = getParameterFact(_vehicle->id(), "SLNK_RADIO_CHAN"); + Fact* f = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_CHAN")); f->setRawValue(QVariant(num)); } @@ -59,8 +59,8 @@ SyslinkComponentController::setRadioChannel(int num) QString SyslinkComponentController::radioAddress() { - uint32_t val_uh = getParameterFact(_vehicle->id(), "SLNK_RADIO_ADDR1")->rawValue().toUInt(); - uint32_t val_lh = getParameterFact(_vehicle->id(), "SLNK_RADIO_ADDR2")->rawValue().toUInt(); + uint32_t val_uh = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_ADDR1"))->rawValue().toUInt(); + uint32_t val_lh = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_ADDR2"))->rawValue().toUInt(); uint64_t val = (((uint64_t) val_uh) << 32) | ((uint64_t) val_lh); return QString().number(val, 16); @@ -70,8 +70,8 @@ SyslinkComponentController::radioAddress() void SyslinkComponentController::setRadioAddress(QString str) { - Fact *uh = getParameterFact(_vehicle->id(), "SLNK_RADIO_ADDR1"); - Fact *lh = getParameterFact(_vehicle->id(), "SLNK_RADIO_ADDR2"); + Fact *uh = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_ADDR1")); + Fact *lh = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_ADDR2")); uint64_t val = str.toULongLong(0, 16); @@ -86,7 +86,7 @@ SyslinkComponentController::setRadioAddress(QString str) int SyslinkComponentController::radioRate() { - return getParameterFact(_vehicle->id(), "SLNK_RADIO_RATE")->rawValue().toInt(); + return getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_RATE"))->rawValue().toInt(); } //----------------------------------------------------------------------------- @@ -94,7 +94,7 @@ void SyslinkComponentController::setRadioRate(int idx) { if(idx >= 0 && idx <= 2 && idx != radioRate()) { - Fact* r = getParameterFact(_vehicle->id(), "SLNK_RADIO_RATE"); + Fact* r = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_RATE")); r->setRawValue(idx); } } @@ -103,10 +103,10 @@ SyslinkComponentController::setRadioRate(int idx) void SyslinkComponentController::resetDefaults() { - Fact* chan = getParameterFact(_vehicle->id(), "SLNK_RADIO_CHAN"); - Fact* rate = getParameterFact(_vehicle->id(), "SLNK_RADIO_RATE"); - Fact* addr1 = getParameterFact(_vehicle->id(), "SLNK_RADIO_ADDR1"); - Fact* addr2 = getParameterFact(_vehicle->id(), "SLNK_RADIO_ADDR2"); + Fact* chan = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_CHAN")); + Fact* rate = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_RATE")); + Fact* addr1 = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_ADDR1")); + Fact* addr2 = getParameterFact(_vehicle->id(), QStringLiteral("SLNK_RADIO_ADDR2")); chan->setRawValue(chan->rawDefaultValue()); rate->setRawValue(rate->rawDefaultValue()); diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.cc b/src/AutoPilotPlugins/PX4/AirframeComponent.cc index 67b356c85..19dc7a5c4 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponent.cc +++ b/src/AutoPilotPlugins/PX4/AirframeComponent.cc @@ -45,12 +45,12 @@ bool AirframeComponent::requiresSetup(void) const bool AirframeComponent::setupComplete(void) const { - return _vehicle->parameterManager()->getParameter(FactSystem::defaultComponentId, "SYS_AUTOSTART")->rawValue().toInt() != 0; + return _vehicle->parameterManager()->getParameter(FactSystem::defaultComponentId, QStringLiteral("SYS_AUTOSTART"))->rawValue().toInt() != 0; } QStringList AirframeComponent::setupCompleteChangedTriggerList(void) const { - return QStringList("SYS_AUTOSTART"); + return QStringList(QStringLiteral("SYS_AUTOSTART")); } QUrl AirframeComponent::setupSource(void) const -- 2.22.0