[Companion] Radio data translation/strings (#5554)
* [Companion] Add Qt tr() functions to all radio data classes instead of using generic QObject type. (no functional changes) * Small fix for gcc. * Move more element name string generation to individual classes; settle on nameToString as function name. * Also put firmware build options translations into Firmware scope.
This commit is contained in:
committed by
Bertrand Songis
parent
7806c2096d
commit
a951292f27
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "sensordata.h"
|
||||
|
||||
#include "radiodata.h"
|
||||
|
||||
void SensorData::updateUnit()
|
||||
{
|
||||
if (type == TELEM_TYPE_CALCULATED) {
|
||||
@@ -32,54 +34,59 @@ QString SensorData::unitString() const
|
||||
{
|
||||
switch (unit) {
|
||||
case UNIT_VOLTS:
|
||||
return QObject::tr("V");
|
||||
return tr("V");
|
||||
case UNIT_AMPS:
|
||||
return QObject::tr("A");
|
||||
return tr("A");
|
||||
case UNIT_MILLIAMPS:
|
||||
return QObject::tr("mA");
|
||||
return tr("mA");
|
||||
case UNIT_KTS:
|
||||
return QObject::tr("kts");
|
||||
return tr("kts");
|
||||
case UNIT_METERS_PER_SECOND:
|
||||
return QObject::tr("m/s");
|
||||
return tr("m/s");
|
||||
case UNIT_KMH:
|
||||
return QObject::tr("km/h");
|
||||
return tr("km/h");
|
||||
case UNIT_MPH:
|
||||
return QObject::tr("mph");
|
||||
return tr("mph");
|
||||
case UNIT_METERS:
|
||||
return QObject::tr("m");
|
||||
return tr("m");
|
||||
case UNIT_FEET:
|
||||
return QObject::tr("f");
|
||||
return tr("f");
|
||||
case UNIT_CELSIUS:
|
||||
return QObject::trUtf8("°C");
|
||||
return trUtf8("°C");
|
||||
case UNIT_FAHRENHEIT:
|
||||
return QObject::trUtf8("°F");
|
||||
return trUtf8("°F");
|
||||
case UNIT_PERCENT:
|
||||
return QObject::tr("%");
|
||||
return tr("%");
|
||||
case UNIT_MAH:
|
||||
return QObject::tr("mAh");
|
||||
return tr("mAh");
|
||||
case UNIT_WATTS:
|
||||
return QObject::tr("W");
|
||||
return tr("W");
|
||||
case UNIT_MILLIWATTS:
|
||||
return QObject::tr("mW");
|
||||
return tr("mW");
|
||||
case UNIT_DB:
|
||||
return QObject::tr("dB");
|
||||
return tr("dB");
|
||||
case UNIT_RPMS:
|
||||
return QObject::tr("rpms");
|
||||
return tr("rpms");
|
||||
case UNIT_G:
|
||||
return QObject::tr("g");
|
||||
return tr("g");
|
||||
case UNIT_DEGREE:
|
||||
return QObject::trUtf8("°");
|
||||
return trUtf8("°");
|
||||
case UNIT_RADIANS:
|
||||
return QObject::trUtf8("Rad");
|
||||
return trUtf8("Rad");
|
||||
case UNIT_HOURS:
|
||||
return QObject::tr("hours");
|
||||
return tr("hours");
|
||||
case UNIT_MINUTES:
|
||||
return QObject::tr("minutes");
|
||||
return tr("minutes");
|
||||
case UNIT_SECONDS:
|
||||
return QObject::tr("seconds");
|
||||
return tr("seconds");
|
||||
case UNIT_CELLS:
|
||||
return QObject::tr("V");
|
||||
return tr("V");
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
QString SensorData::nameToString(int index) const
|
||||
{
|
||||
return RadioData::getElementName(tr("TELE"), index + 1, label);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user