diff options
Diffstat (limited to 'qt-gui.cpp')
-rw-r--r-- | qt-gui.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp index 532d1b509..f361e34df 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -39,7 +39,9 @@ #include <QLibraryInfo> #include <gettextfromc.h> -#define tr(arg) gettextFromC::instance()->tr(arg) + +// this will create a warning when executing lupdate +#define translate(_context, arg) gettextFromC::instance()->tr("gettextFromC",arg) const char *default_dive_computer_vendor; const char *default_dive_computer_product; @@ -192,10 +194,10 @@ QString get_depth_string(int mm, bool showunit, bool showdecimal) { if (prefs.units.length == units::METERS) { double meters = mm / 1000.0; - return QString("%1%2").arg(meters, 0, 'f', (showdecimal && meters < 20.0) ? 1 : 0 ).arg(showunit ? tr("m") : ""); + return QString("%1%2").arg(meters, 0, 'f', (showdecimal && meters < 20.0) ? 1 : 0 ).arg(showunit ? translate("gettextFromC","m") : ""); } else { double feet = mm_to_feet(mm); - return QString("%1%2").arg(feet, 0, 'f', showdecimal ? 1 : 0). arg(showunit ? tr("ft") : ""); + return QString("%1%2").arg(feet, 0, 'f', showdecimal ? 1 : 0). arg(showunit ? translate("gettextFromC","ft") : ""); } } @@ -216,9 +218,9 @@ QString get_weight_string(weight_t weight, bool showunit) { QString str = weight_string (weight.grams); if (get_units()->weight == units::KG) { - str = QString ("%1%2").arg(str).arg(showunit ? tr("kg") : ""); + str = QString ("%1%2").arg(str).arg(showunit ? translate("gettextFromC","kg") : ""); } else { - str = QString ("%1%2").arg(str).arg(showunit ? tr("lbs") : ""); + str = QString ("%1%2").arg(str).arg(showunit ? translate("gettextFromC","lbs") : ""); } return (str); } @@ -258,7 +260,7 @@ QString get_cylinder_used_gas_string(cylinder_t *cyl, bool showunit) gas_usage = get_pressure_units(gas_usage, &unit); decimals = 0; } - // tr("%.*f %s" + // translate("gettextFromC","%.*f %s" return QString("%1 %2").arg(gas_usage, 0, 'f', decimals).arg(showunit ? unit : ""); } @@ -269,11 +271,11 @@ QString get_temperature_string(temperature_t temp, bool showunit) } else if (prefs.units.temperature == units::CELSIUS) { double celsius = mkelvin_to_C(temp.mkelvin); return QString("%1%2%3").arg(celsius, 0, 'f', 1).arg(showunit ? (UTF8_DEGREE): "") - .arg(showunit ? tr("C") : ""); + .arg(showunit ? translate("gettextFromC","C") : ""); } else { double fahrenheit = mkelvin_to_F(temp.mkelvin); return QString("%1%2%3").arg(fahrenheit, 0, 'f', 1).arg(showunit ? (UTF8_DEGREE): "") - .arg(showunit ? tr("F") : ""); + .arg(showunit ? translate("gettextFromC","F") : ""); } } @@ -289,10 +291,10 @@ QString get_volume_string(volume_t volume, bool showunit) { if (prefs.units.volume == units::LITER) { double liter = volume.mliter / 1000.0; - return QString("%1%2").arg(liter, 0, 'f', liter >= 40.0 ? 0 : 1 ).arg(showunit ? tr("l") : ""); + return QString("%1%2").arg(liter, 0, 'f', liter >= 40.0 ? 0 : 1 ).arg(showunit ? translate("gettextFromC","l") : ""); } else { double cuft = ml_to_cuft(volume.mliter); - return QString("%1%2").arg(cuft, 0, 'f', cuft >= 20.0 ? 0 : (cuft >= 2.0 ? 1 : 2)).arg(showunit ? tr("cuft") : ""); + return QString("%1%2").arg(cuft, 0, 'f', cuft >= 20.0 ? 0 : (cuft >= 2.0 ? 1 : 2)).arg(showunit ? translate("gettextFromC","cuft") : ""); } } @@ -308,10 +310,10 @@ QString get_pressure_string(pressure_t pressure, bool showunit) { if (prefs.units.pressure == units::BAR) { double bar = pressure.mbar / 1000.0; - return QString("%1%2").arg(bar, 0, 'f', 1).arg(showunit ? tr("bar") : ""); + return QString("%1%2").arg(bar, 0, 'f', 1).arg(showunit ? translate("gettextFromC","bar") : ""); } else { double psi = mbar_to_PSI(pressure.mbar); - return QString("%1%2").arg(psi, 0, 'f', 0).arg(showunit ? tr("psi") : ""); + return QString("%1%2").arg(psi, 0, 'f', 0).arg(showunit ? translate("gettextFromC","psi") : ""); } } |