Unverified Commit 78f7a849 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #7553 from patrickelectric/qstring_tr

Fix QString, QStringLiteral and tr calls
parents 1fa5d444 72c1c41b
...@@ -205,7 +205,7 @@ Item { ...@@ -205,7 +205,7 @@ Item {
return qsTr("Not Connected") return qsTr("Not Connected")
switch(_authStatus) { switch(_authStatus) {
case AirspaceManager.Unknown: case AirspaceManager.Unknown:
return qsTr("") return ""
case AirspaceManager.Anonymous: case AirspaceManager.Anonymous:
return qsTr("Anonymous") return qsTr("Anonymous")
case AirspaceManager.Authenticated: case AirspaceManager.Authenticated:
......
...@@ -45,7 +45,7 @@ bool QJsonWebToken::setHeaderJDoc(QJsonDocument jdocHeader) ...@@ -45,7 +45,7 @@ bool QJsonWebToken::setHeaderJDoc(QJsonDocument jdocHeader)
} }
// check if supported algorithm // check if supported algorithm
QString strAlgorithm = jdocHeader.object().value("alg").toString(""); QString strAlgorithm = jdocHeader.object().value("alg").toString();
if (!isAlgorithmSupported(strAlgorithm)) if (!isAlgorithmSupported(strAlgorithm))
{ {
return false; return false;
......
...@@ -27,20 +27,20 @@ QString ...@@ -27,20 +27,20 @@ QString
AirspaceAdvisory::typeStr() AirspaceAdvisory::typeStr()
{ {
switch(type()) { switch(type()) {
case Airport: return QString(tr("Airport")); case Airport: return tr("Airport");
case Controlled_airspace: return QString(tr("Controlled Airspace")); case Controlled_airspace: return tr("Controlled Airspace");
case Special_use_airspace: return QString(tr("Special Use Airspace")); case Special_use_airspace: return tr("Special Use Airspace");
case Tfr: return QString(tr("TFR")); case Tfr: return tr("TFR");
case Wildfire: return QString(tr("Wild Fire")); case Wildfire: return tr("Wild Fire");
case Park: return QString(tr("Park")); case Park: return tr("Park");
case Power_plant: return QString(tr("Power Plant")); case Power_plant: return tr("Power Plant");
case Heliport: return QString(tr("Heliport")); case Heliport: return tr("Heliport");
case Prison: return QString(tr("Prison")); case Prison: return tr("Prison");
case School: return QString(tr("School")); case School: return tr("School");
case Hospital: return QString(tr("Hospital")); case Hospital: return tr("Hospital");
case Fire: return QString(tr("Fire")); case Fire: return tr("Fire");
case Emergency: return QString(tr("Emergency")); case Emergency: return tr("Emergency");
case Invalid: return QString(tr("Custom")); case Invalid: return tr("Custom");
default: return QString(tr("Unknown")); default: return tr("Unknown");
} }
} }
...@@ -135,9 +135,6 @@ void GeoTagController::_setErrorMessage(const QString& error) ...@@ -135,9 +135,6 @@ void GeoTagController::_setErrorMessage(const QString& error)
GeoTagWorker::GeoTagWorker() GeoTagWorker::GeoTagWorker()
: _cancel(false) : _cancel(false)
, _logFile("")
, _imageDirectory("")
, _saveDirectory("")
{ {
} }
......
...@@ -177,7 +177,7 @@ LogDownloadController::_logEntry(UASInterface* uas, uint32_t time_utc, uint32_t ...@@ -177,7 +177,7 @@ LogDownloadController::_logEntry(UASInterface* uas, uint32_t time_utc, uint32_t
entry->setSize(size); entry->setSize(size);
entry->setTime(QDateTime::fromTime_t(time_utc)); entry->setTime(QDateTime::fromTime_t(time_utc));
entry->setReceived(true); entry->setReceived(true);
entry->setStatus(QString(tr("Available"))); entry->setStatus(tr("Available"));
} else { } else {
qWarning() << "Received log entry for out-of-bound index:" << id; qWarning() << "Received log entry for out-of-bound index:" << id;
} }
...@@ -224,7 +224,7 @@ LogDownloadController::_resetSelection(bool canceled) ...@@ -224,7 +224,7 @@ LogDownloadController::_resetSelection(bool canceled)
if(entry) { if(entry) {
if(entry->selected()) { if(entry->selected()) {
if(canceled) { if(canceled) {
entry->setStatus(QString(tr("Canceled"))); entry->setStatus(tr("Canceled"));
} }
entry->setSelected(false); entry->setSelected(false);
} }
...@@ -271,7 +271,7 @@ LogDownloadController::_findMissingEntries() ...@@ -271,7 +271,7 @@ LogDownloadController::_findMissingEntries()
for(int i = 0; i < num_logs; i++) { for(int i = 0; i < num_logs; i++) {
QGCLogEntry* entry = _logEntriesModel[i]; QGCLogEntry* entry = _logEntriesModel[i];
if(entry && !entry->received()) { if(entry && !entry->received()) {
entry->setStatus(QString(tr("Error"))); entry->setStatus(tr("Error"));
} }
} }
//-- Give up //-- Give up
...@@ -357,7 +357,7 @@ LogDownloadController::_logData(UASInterface* uas, uint32_t ofs, uint16_t id, ui ...@@ -357,7 +357,7 @@ LogDownloadController::_logData(UASInterface* uas, uint32_t ofs, uint16_t id, ui
_timer.start(timeout_time); _timer.start(timeout_time);
//-- Do we have it all? //-- Do we have it all?
if(_logComplete()) { if(_logComplete()) {
_downloadData->entry->setStatus(QString(tr("Downloaded"))); _downloadData->entry->setStatus(tr("Downloaded"));
//-- Check for more //-- Check for more
_receivedAllData(); _receivedAllData();
} else if (_chunkComplete()) { } else if (_chunkComplete()) {
...@@ -376,7 +376,7 @@ LogDownloadController::_logData(UASInterface* uas, uint32_t ofs, uint16_t id, ui ...@@ -376,7 +376,7 @@ LogDownloadController::_logData(UASInterface* uas, uint32_t ofs, uint16_t id, ui
qWarning() << "Received log offset greater than expected"; qWarning() << "Received log offset greater than expected";
} }
if(!result) { if(!result) {
_downloadData->entry->setStatus(QString(tr("Error"))); _downloadData->entry->setStatus(tr("Error"));
} }
} }
...@@ -423,7 +423,7 @@ LogDownloadController::_findMissingData() ...@@ -423,7 +423,7 @@ LogDownloadController::_findMissingData()
} }
if(_retries++ > 2) { if(_retries++ > 2) {
_downloadData->entry->setStatus(QString(tr("Timed Out"))); _downloadData->entry->setStatus(tr("Timed Out"));
//-- Give up //-- Give up
qWarning() << "Too many errors retreiving log data. Giving up."; qWarning() << "Too many errors retreiving log data. Giving up.";
_receivedAllData(); _receivedAllData();
...@@ -541,7 +541,7 @@ void LogDownloadController::downloadToDirectory(const QString& dir) ...@@ -541,7 +541,7 @@ void LogDownloadController::downloadToDirectory(const QString& dir)
QGCLogEntry* entry = _logEntriesModel[i]; QGCLogEntry* entry = _logEntriesModel[i];
if(entry) { if(entry) {
if(entry->selected()) { if(entry->selected()) {
entry->setStatus(QString(tr("Waiting"))); entry->setStatus(tr("Waiting"));
} }
} }
} }
...@@ -632,7 +632,7 @@ LogDownloadController::_prepareLogDownload() ...@@ -632,7 +632,7 @@ LogDownloadController::_prepareLogDownload()
if (_downloadData->file.exists()) { if (_downloadData->file.exists()) {
_downloadData->file.remove(); _downloadData->file.remove();
} }
_downloadData->entry->setStatus(QString(tr("Error"))); _downloadData->entry->setStatus(tr("Error"));
delete _downloadData; delete _downloadData;
_downloadData = NULL; _downloadData = NULL;
} }
...@@ -686,7 +686,7 @@ LogDownloadController::cancel(void) ...@@ -686,7 +686,7 @@ LogDownloadController::cancel(void)
_receivedAllEntries(); _receivedAllEntries();
} }
if(_downloadData) { if(_downloadData) {
_downloadData->entry->setStatus(QString(tr("Canceled"))); _downloadData->entry->setStatus(tr("Canceled"));
if (_downloadData->file.exists()) { if (_downloadData->file.exists()) {
_downloadData->file.remove(); _downloadData->file.remove();
} }
......
...@@ -409,7 +409,7 @@ MAVLinkInspectorController::_vehicleAdded(Vehicle* vehicle) ...@@ -409,7 +409,7 @@ MAVLinkInspectorController::_vehicleAdded(Vehicle* vehicle)
} else { } else {
v = new QGCMAVLinkVehicle(this, static_cast<uint8_t>(vehicle->id())); v = new QGCMAVLinkVehicle(this, static_cast<uint8_t>(vehicle->id()));
_vehicles.append(v); _vehicles.append(v);
_vehicleNames.append(QString(tr("Vehicle %1")).arg(vehicle->id())); _vehicleNames.append(tr("Vehicle %1").arg(vehicle->id()));
} }
emit vehiclesChanged(); emit vehiclesChanged();
} }
...@@ -422,7 +422,7 @@ MAVLinkInspectorController::_vehicleRemoved(Vehicle* vehicle) ...@@ -422,7 +422,7 @@ MAVLinkInspectorController::_vehicleRemoved(Vehicle* vehicle)
if(v) { if(v) {
v->deleteLater(); v->deleteLater();
_vehicles.removeOne(v); _vehicles.removeOne(v);
QString vs = QString(tr("Vehicle %1")).arg(vehicle->id()); QString vs = tr("Vehicle %1").arg(vehicle->id());
_vehicleNames.removeOne(vs); _vehicleNames.removeOne(vs);
emit vehiclesChanged(); emit vehiclesChanged();
} }
...@@ -438,7 +438,7 @@ MAVLinkInspectorController::_receiveMessage(LinkInterface* link, mavlink_message ...@@ -438,7 +438,7 @@ MAVLinkInspectorController::_receiveMessage(LinkInterface* link, mavlink_message
if(!v) { if(!v) {
v = new QGCMAVLinkVehicle(this, message.sysid); v = new QGCMAVLinkVehicle(this, message.sysid);
_vehicles.append(v); _vehicles.append(v);
_vehicleNames.append(QString(tr("Vehicle %1")).arg(message.sysid)); _vehicleNames.append(tr("Vehicle %1").arg(message.sysid));
emit vehiclesChanged(); emit vehiclesChanged();
if(!_activeVehicle) { if(!_activeVehicle) {
_activeVehicle = v; _activeVehicle = v;
......
...@@ -25,7 +25,7 @@ MavlinkConsoleController::MavlinkConsoleController() ...@@ -25,7 +25,7 @@ MavlinkConsoleController::MavlinkConsoleController()
MavlinkConsoleController::~MavlinkConsoleController() MavlinkConsoleController::~MavlinkConsoleController()
{ {
if (_vehicle) { if (_vehicle) {
QByteArray msg(""); QByteArray msg;
_sendSerialData(msg, true); _sendSerialData(msg, true);
} }
} }
......
...@@ -625,7 +625,7 @@ void QGCApplication::saveTelemetryLogOnMainThread(QString tempLogfile) ...@@ -625,7 +625,7 @@ void QGCApplication::saveTelemetryLogOnMainThread(QString tempLogfile)
int tryIndex = 1; int tryIndex = 1;
QString saveFileName = nameFormat.arg( QString saveFileName = nameFormat.arg(
QDateTime::currentDateTime().toString(dtFormat)).arg("").arg(toolbox()->settingsManager()->appSettings()->telemetryFileExtension); QDateTime::currentDateTime().toString(dtFormat)).arg(QStringLiteral("")).arg(toolbox()->settingsManager()->appSettings()->telemetryFileExtension);
while (saveDir.exists(saveFileName)) { while (saveDir.exists(saveFileName)) {
saveFileName = nameFormat.arg( saveFileName = nameFormat.arg(
QDateTime::currentDateTime().toString(dtFormat)).arg(QStringLiteral(".%1").arg(tryIndex++)).arg(toolbox()->settingsManager()->appSettings()->telemetryFileExtension); QDateTime::currentDateTime().toString(dtFormat)).arg(QStringLiteral(".%1").arg(tryIndex++)).arg(toolbox()->settingsManager()->appSettings()->telemetryFileExtension);
......
...@@ -498,7 +498,7 @@ TaisyncManager::_updateSettings(QByteArray jSonData) ...@@ -498,7 +498,7 @@ TaisyncManager::_updateSettings(QByteArray jSonData)
//-- Link Status? //-- Link Status?
if(jSonData.contains("\"flight\":")) { if(jSonData.contains("\"flight\":")) {
_reqMask &= ~static_cast<uint32_t>(REQ_LINK_STATUS); _reqMask &= ~static_cast<uint32_t>(REQ_LINK_STATUS);
bool tlinkConnected = jObj["flight"].toString("") == "online"; bool tlinkConnected = jObj["flight"].toString() == "online";
if(tlinkConnected != _linkConnected) { if(tlinkConnected != _linkConnected) {
_linkConnected = tlinkConnected; _linkConnected = tlinkConnected;
emit linkConnectedChanged(); emit linkConnectedChanged();
......
...@@ -197,14 +197,14 @@ Rectangle { ...@@ -197,14 +197,14 @@ Rectangle {
Layout.minimumWidth: _labelWidth Layout.minimumWidth: _labelWidth
} }
QGCLabel { QGCLabel {
text: QGroundControl.taisyncManager.connected ? QGroundControl.taisyncManager.serialNumber : qsTr("") text: QGroundControl.taisyncManager.connected ? QGroundControl.taisyncManager.serialNumber : ""
Layout.minimumWidth: _valueWidth Layout.minimumWidth: _valueWidth
} }
QGCLabel { QGCLabel {
text: qsTr("Firmware Version:") text: qsTr("Firmware Version:")
} }
QGCLabel { QGCLabel {
text: QGroundControl.taisyncManager.connected ? QGroundControl.taisyncManager.fwVersion : qsTr("") text: QGroundControl.taisyncManager.connected ? QGroundControl.taisyncManager.fwVersion : ""
} }
} }
} }
......
...@@ -1539,7 +1539,7 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message) ...@@ -1539,7 +1539,7 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message)
if (sysStatus.battery_remaining > 0) { if (sysStatus.battery_remaining > 0) {
if (sysStatus.battery_remaining < _settingsManager->appSettings()->batteryPercentRemainingAnnounce()->rawValue().toInt() && if (sysStatus.battery_remaining < _settingsManager->appSettings()->batteryPercentRemainingAnnounce()->rawValue().toInt() &&
sysStatus.battery_remaining < _lastAnnouncedLowBatteryPercent) { sysStatus.battery_remaining < _lastAnnouncedLowBatteryPercent) {
_say(QString(tr("%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));
} }
_lastAnnouncedLowBatteryPercent = sysStatus.battery_remaining; _lastAnnouncedLowBatteryPercent = sysStatus.battery_remaining;
} }
...@@ -2934,7 +2934,7 @@ QString Vehicle::vehicleTypeName() const { ...@@ -2934,7 +2934,7 @@ QString Vehicle::vehicleTypeName() const {
QString Vehicle::_vehicleIdSpeech(void) QString Vehicle::_vehicleIdSpeech(void)
{ {
if (_toolbox->multiVehicleManager()->vehicles()->count() > 1) { if (_toolbox->multiVehicleManager()->vehicles()->count() > 1) {
return QString(tr("vehicle %1")).arg(id()); return tr("vehicle %1").arg(id());
} else { } else {
return QString(); return QString();
} }
...@@ -2942,13 +2942,13 @@ QString Vehicle::_vehicleIdSpeech(void) ...@@ -2942,13 +2942,13 @@ QString Vehicle::_vehicleIdSpeech(void)
void Vehicle::_handleFlightModeChanged(const QString& flightMode) void Vehicle::_handleFlightModeChanged(const QString& flightMode)
{ {
_say(QString(tr("%1 %2 flight mode")).arg(_vehicleIdSpeech()).arg(flightMode)); _say(tr("%1 %2 flight mode").arg(_vehicleIdSpeech()).arg(flightMode));
emit guidedModeChanged(_firmwarePlugin->isGuidedMode(this)); emit guidedModeChanged(_firmwarePlugin->isGuidedMode(this));
} }
void Vehicle::_announceArmedChanged(bool armed) void Vehicle::_announceArmedChanged(bool armed)
{ {
_say(QString("%1 %2").arg(_vehicleIdSpeech()).arg(armed ? QString(tr("armed")) : QString(tr("disarmed")))); _say(QString("%1 %2").arg(_vehicleIdSpeech()).arg(armed ? tr("armed") : tr("disarmed")));
} }
void Vehicle::_setFlying(bool flying) void Vehicle::_setFlying(bool flying)
......
...@@ -345,7 +345,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -345,7 +345,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
**/ **/
QString MAVLinkProtocol::getName() QString MAVLinkProtocol::getName()
{ {
return QString(tr("MAVLink protocol")); return tr("MAVLink protocol");
} }
/** @return System id of this application */ /** @return System id of this application */
......
...@@ -149,42 +149,41 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString ...@@ -149,42 +149,41 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString
} }
// And determine the text for the severitie // And determine the text for the severitie
QString severityText(""); QString severityText;
switch (severity) switch (severity)
{ {
case MAV_SEVERITY_EMERGENCY: case MAV_SEVERITY_EMERGENCY:
severityText = QString(tr(" EMERGENCY:")); severityText = tr(" EMERGENCY:");
break; break;
case MAV_SEVERITY_ALERT: case MAV_SEVERITY_ALERT:
severityText = QString(tr(" ALERT:")); severityText = tr(" ALERT:");
break; break;
case MAV_SEVERITY_CRITICAL: case MAV_SEVERITY_CRITICAL:
severityText = QString(tr(" Critical:")); severityText = tr(" Critical:");
break; break;
case MAV_SEVERITY_ERROR: case MAV_SEVERITY_ERROR:
severityText = QString(tr(" Error:")); severityText = tr(" Error:");
break; break;
case MAV_SEVERITY_WARNING: case MAV_SEVERITY_WARNING:
severityText = QString(tr(" Warning:")); severityText = tr(" Warning:");
break; break;
case MAV_SEVERITY_NOTICE: case MAV_SEVERITY_NOTICE:
severityText = QString(tr(" Notice:")); severityText = tr(" Notice:");
break; break;
case MAV_SEVERITY_INFO: case MAV_SEVERITY_INFO:
severityText = QString(tr(" Info:")); severityText = tr(" Info:");
break; break;
case MAV_SEVERITY_DEBUG: case MAV_SEVERITY_DEBUG:
severityText = QString(tr(" Debug:")); severityText = tr(" Debug:");
break; break;
default: default:
severityText = QString(tr(""));
break; break;
} }
// Finally preppend the properly-styled text with a timestamp. // Finally preppend the properly-styled text with a timestamp.
QString dateString = QDateTime::currentDateTime().toString("hh:mm:ss.zzz"); QString dateString = QDateTime::currentDateTime().toString("hh:mm:ss.zzz");
UASMessage* message = new UASMessage(compId, severity, text); UASMessage* message = new UASMessage(compId, severity, text);
QString compString(""); QString compString;
if (_multiComp) { if (_multiComp) {
compString = QString(" COMP:%1").arg(compId); compString = QString(" COMP:%1").arg(compId);
} }
......
...@@ -227,7 +227,7 @@ void MAVLinkDecoder::emitFieldValue(mavlink_message_t* msg, int fieldid, quint64 ...@@ -227,7 +227,7 @@ void MAVLinkDecoder::emitFieldValue(mavlink_message_t* msg, int fieldid, quint64
QString fieldType; QString fieldType;
uint8_t* m = (uint8_t*)(msgDict[msgid].payload64); uint8_t* m = (uint8_t*)(msgDict[msgid].payload64);
QString name("%1.%2"); QString name("%1.%2");
QString unit(""); QString unit;
// Debug vector messages // Debug vector messages
if (msgid == MAVLINK_MSG_ID_DEBUG_VECT) if (msgid == MAVLINK_MSG_ID_DEBUG_VECT)
......
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