diff options
-rw-r--r-- | core/divelogexportlogic.cpp | 4 | ||||
-rw-r--r-- | core/divesite-helper.cpp | 5 | ||||
-rw-r--r-- | core/gpslocation.h | 2 | ||||
-rw-r--r-- | core/qthelper.cpp | 40 | ||||
-rw-r--r-- | core/qthelper.h | 3 | ||||
-rw-r--r-- | core/subsurface-qt/DiveObjectHelper.cpp | 4 | ||||
-rw-r--r-- | desktop-widgets/diveplanner.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/simplewidgets.cpp | 6 | ||||
-rw-r--r-- | desktop-widgets/subsurfacewebservices.cpp | 8 | ||||
-rw-r--r-- | desktop-widgets/templatelayout.h | 4 |
11 files changed, 41 insertions, 39 deletions
diff --git a/core/divelogexportlogic.cpp b/core/divelogexportlogic.cpp index 7617e6c23..82c8b452f 100644 --- a/core/divelogexportlogic.cpp +++ b/core/divelogexportlogic.cpp @@ -53,7 +53,7 @@ static void exportHTMLstatisticsTotal(QTextStream &out, stats_t *total_stats) out << "\"YEAR\":\"Total\","; out << "\"DIVES\":\"" << total_stats->selection_size << "\","; out << "\"TOTAL_TIME\":\"" << get_dive_duration_string(total_stats->total_time.seconds, - QObject::tr("h"), QObject::tr("min"), QObject::tr("sec"), " ") << "\","; + gettextFromC::tr("h"), gettextFromC::tr("min"), gettextFromC::tr("sec"), " ") << "\","; out << "\"AVERAGE_TIME\":\"--\","; out << "\"SHORTEST_TIME\":\"--\","; out << "\"LONGEST_TIME\":\"--\","; @@ -89,7 +89,7 @@ static void exportHTMLstatistics(const QString filename, struct htmlExportSettin out << "\"YEAR\":\"" << stats_yearly[i].period << "\","; out << "\"DIVES\":\"" << stats_yearly[i].selection_size << "\","; out << "\"TOTAL_TIME\":\"" << get_dive_duration_string(stats_yearly[i].total_time.seconds, - QObject::tr("h"), QObject::tr("min"), QObject::tr("sec"), " ") << "\","; + gettextFromC::tr("h"), gettextFromC::tr("min"), gettextFromC::tr("sec"), " ") << "\","; out << "\"AVERAGE_TIME\":\"" << get_minutes(stats_yearly[i].total_time.seconds / stats_yearly[i].selection_size) << "\","; out << "\"SHORTEST_TIME\":\"" << get_minutes(stats_yearly[i].shortest_time.seconds) << "\","; out << "\"LONGEST_TIME\":\"" << get_minutes(stats_yearly[i].longest_time.seconds) << "\","; diff --git a/core/divesite-helper.cpp b/core/divesite-helper.cpp index 56030afd1..55ebb3aba 100644 --- a/core/divesite-helper.cpp +++ b/core/divesite-helper.cpp @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "divesite.h" #include "pref.h" +#include "gettextfromc.h" QString constructLocationTags(struct dive_site *ds, bool for_maintab) { @@ -17,7 +18,7 @@ QString constructLocationTags(struct dive_site *ds, bool for_maintab) } if (!prefs_set && !for_maintab) { - locationTag = QString("<small><small>") + QObject::tr("No dive site layout categories set in preferences!") + + locationTag = QString("<small><small>") + gettextFromC::tr("No dive site layout categories set in preferences!") + QString("</small></small>"); return locationTag; } @@ -25,7 +26,7 @@ QString constructLocationTags(struct dive_site *ds, bool for_maintab) return locationTag; if (for_maintab) - locationTag = QString("<small><small>(") + QObject::tr("Tags") + QString(": "); + locationTag = QString("<small><small>(") + gettextFromC::tr("Tags") + QString(": "); else locationTag = QString("<small><small>"); QString connector; diff --git a/core/gpslocation.h b/core/gpslocation.h index fb4f4c802..b277091a3 100644 --- a/core/gpslocation.h +++ b/core/gpslocation.h @@ -11,7 +11,7 @@ #include <QNetworkReply> #include <QMap> -#define GPS_CURRENT_POS QObject::tr("Waiting to aquire GPS location") +#define GPS_CURRENT_POS gettextFromC::tr("Waiting to aquire GPS location") struct gpsTracker { degrees_t latitude; diff --git a/core/qthelper.cpp b/core/qthelper.cpp index a6125526b..299f8771b 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -762,9 +762,9 @@ int parseLengthToMm(const QString &text) if (numOnly.isEmpty()) return 0; double number = numOnly.toDouble(); - if (text.contains(QObject::tr("m"), Qt::CaseInsensitive)) { + if (text.contains(gettextFromC::tr("m"), Qt::CaseInsensitive)) { mm = lrint(number * 1000); - } else if (text.contains(QObject::tr("ft"), Qt::CaseInsensitive)) { + } else if (text.contains(gettextFromC::tr("ft"), Qt::CaseInsensitive)) { mm = feet_to_mm(number); } else { switch (prefs.units.length) { @@ -790,9 +790,9 @@ int parseTemperatureToMkelvin(const QString &text) if (numOnly.isEmpty()) return 0; double number = numOnly.toDouble(); - if (text.contains(QObject::tr("C"), Qt::CaseInsensitive)) { + if (text.contains(gettextFromC::tr("C"), Qt::CaseInsensitive)) { mkelvin = C_to_mkelvin(number); - } else if (text.contains(QObject::tr("F"), Qt::CaseInsensitive)) { + } else if (text.contains(gettextFromC::tr("F"), Qt::CaseInsensitive)) { mkelvin = F_to_mkelvin(number); } else { switch (prefs.units.temperature) { @@ -817,9 +817,9 @@ int parseWeightToGrams(const QString &text) if (numOnly.isEmpty()) return 0; double number = numOnly.toDouble(); - if (text.contains(QObject::tr("kg"), Qt::CaseInsensitive)) { + if (text.contains(gettextFromC::tr("kg"), Qt::CaseInsensitive)) { grams = lrint(number * 1000); - } else if (text.contains(QObject::tr("lbs"), Qt::CaseInsensitive)) { + } else if (text.contains(gettextFromC::tr("lbs"), Qt::CaseInsensitive)) { grams = lbs_to_grams(number); } else { switch (prefs.units.weight) { @@ -844,9 +844,9 @@ int parsePressureToMbar(const QString &text) if (numOnly.isEmpty()) return 0; double number = numOnly.toDouble(); - if (text.contains(QObject::tr("bar"), Qt::CaseInsensitive)) { + if (text.contains(gettextFromC::tr("bar"), Qt::CaseInsensitive)) { mbar = lrint(number * 1000); - } else if (text.contains(QObject::tr("psi"), Qt::CaseInsensitive)) { + } else if (text.contains(gettextFromC::tr("psi"), Qt::CaseInsensitive)) { mbar = psi_to_mbar(number); } else { switch (prefs.units.pressure) { @@ -867,9 +867,9 @@ int parseGasMixO2(const QString &text) { QString gasString = text; int o2, number; - if (gasString.contains(QObject::tr("AIR"), Qt::CaseInsensitive)) { + if (gasString.contains(gettextFromC::tr("AIR"), Qt::CaseInsensitive)) { o2 = O2_IN_AIR; - } else if (gasString.contains(QObject::tr("EAN"), Qt::CaseInsensitive)) { + } else if (gasString.contains(gettextFromC::tr("EAN"), Qt::CaseInsensitive)) { gasString.remove(QRegExp("[^0-9]")); number = gasString.toInt(); o2 = number * 10; @@ -1007,7 +1007,7 @@ QString get_trip_date_string(timestamp_t when, int nr, bool getday) localTime.setTimeSpec(Qt::UTC); QString ret ; - QString suffix = " " + QObject::tr("(%n dive(s))", "", nr); + QString suffix = " " + gettextFromC::tr("(%n dive(s))", "", nr); if (getday) { ret = localTime.date().toString(prefs.date_format) + suffix; } else { @@ -1235,7 +1235,7 @@ extern "C" char *picturedir_string() QString get_gas_string(struct gasmix gas) { uint o2 = (get_o2(&gas) + 5) / 10, he = (get_he(&gas) + 5) / 10; - QString result = gasmix_is_air(&gas) ? QObject::tr("AIR") : he == 0 ? (o2 == 100 ? QObject::tr("OXYGEN") : QString("EAN%1").arg(o2, 2, 10, QChar('0'))) : QString("%1/%2").arg(o2).arg(he); + QString result = gasmix_is_air(&gas) ? gettextFromC::tr("AIR") : he == 0 ? (o2 == 100 ? gettextFromC::tr("OXYGEN") : QString("EAN%1").arg(o2, 2, 10, QChar('0'))) : QString("%1/%2").arg(o2).arg(he); return result; } @@ -1258,8 +1258,8 @@ weight_t string_to_weight(const char *str) const char *end; double value = strtod_flags(str, &end, 0); QString rest = QString(end).trimmed(); - QString local_kg = QObject::tr("kg"); - QString local_lbs = QObject::tr("lbs"); + QString local_kg = gettextFromC::tr("kg"); + QString local_lbs = gettextFromC::tr("lbs"); weight_t weight; if (rest.startsWith("kg") || rest.startsWith(local_kg)) @@ -1282,8 +1282,8 @@ depth_t string_to_depth(const char *str) const char *end; double value = strtod_flags(str, &end, 0); QString rest = QString(end).trimmed(); - QString local_ft = QObject::tr("ft"); - QString local_m = QObject::tr("m"); + QString local_ft = gettextFromC::tr("ft"); + QString local_m = gettextFromC::tr("m"); depth_t depth; if (value < 0) @@ -1307,8 +1307,8 @@ pressure_t string_to_pressure(const char *str) const char *end; double value = strtod_flags(str, &end, 0); QString rest = QString(end).trimmed(); - QString local_psi = QObject::tr("psi"); - QString local_bar = QObject::tr("bar"); + QString local_psi = gettextFromC::tr("psi"); + QString local_bar = gettextFromC::tr("bar"); pressure_t pressure; if (rest.startsWith("bar") || rest.startsWith(local_bar)) @@ -1330,8 +1330,8 @@ volume_t string_to_volume(const char *str, pressure_t workp) const char *end; double value = strtod_flags(str, &end, 0); QString rest = QString(end).trimmed(); - QString local_l = QObject::tr("l"); - QString local_cuft = QObject::tr("cuft"); + QString local_l = gettextFromC::tr("l"); + QString local_cuft = gettextFromC::tr("cuft"); volume_t volume; if (rest.startsWith("l") || rest.startsWith("ℓ") || rest.startsWith(local_l)) diff --git a/core/qthelper.h b/core/qthelper.h index 2bd933e0f..64a57798d 100644 --- a/core/qthelper.h +++ b/core/qthelper.h @@ -18,6 +18,7 @@ enum inertgas {N2, HE}; #include <QString> #include <QTranslator> #include <QDir> +#include "core/gettextfromc.h" QString weight_string(int weight_in_grams); QString distance_string(int distanceInMeters); bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out = 0); @@ -69,7 +70,7 @@ int parsePressureToMbar(const QString &text); int parseGasMixO2(const QString &text); int parseGasMixHE(const QString &text); QString render_seconds_to_string(int seconds); -QString get_dive_duration_string(timestamp_t when, QString hoursText, QString minutesText, QString secondsText = QObject::tr("sec"), QString separator = ":", bool isFreeDive = false); +QString get_dive_duration_string(timestamp_t when, QString hoursText, QString minutesText, QString secondsText = gettextFromC::tr("sec"), QString separator = ":", bool isFreeDive = false); QString get_dive_surfint_string(timestamp_t when, QString daysText, QString hoursText, QString minutesText, QString separator = " ", int maxdays = 4); QString get_dive_date_string(timestamp_t when); QString get_short_dive_date_string(timestamp_t when); diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp index 46f274522..4c5a30912 100644 --- a/core/subsurface-qt/DiveObjectHelper.cpp +++ b/core/subsurface-qt/DiveObjectHelper.cpp @@ -27,7 +27,7 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) const char *desc = cyl->type.description; if (!desc && idx > 0) return QString(EMPTY_DIVE_STRING); - QString fmt = desc ? QString(desc) : QObject::tr("unknown"); + QString fmt = desc ? QString(desc) : gettextFromC::tr("unknown"); fmt += ", " + get_volume_string(cyl->type.size, true); fmt += ", " + get_pressure_string(cyl->type.workingpressure, true); fmt += ", " + get_pressure_string(cyl->start, false) + " - " + get_pressure_string(cyl->end, true); @@ -129,7 +129,7 @@ QVariant DiveObjectHelper::dive_site_uuid() const QString DiveObjectHelper::duration() const { - return get_dive_duration_string(m_dive->duration.seconds, QObject::tr("h"), QObject::tr("min")); + return get_dive_duration_string(m_dive->duration.seconds, gettextFromC::tr("h"), gettextFromC::tr("min")); } bool DiveObjectHelper::noDive() const diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 91f8e2aba..6ec14795f 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -62,7 +62,7 @@ void DiveHandler::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) // don't allow removing the last point if (plannerModel->rowCount() > 1) { m.addSeparator(); - m.addAction(QObject::tr("Remove this point"), this, SLOT(selfRemove())); + m.addAction(gettextFromC::tr("Remove this point"), this, SLOT(selfRemove())); m.exec(event->screenPos()); } } diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 9ea1d25c0..cca10fd86 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -635,7 +635,7 @@ void MainWindow::on_actionCloudstorageopen_triggered() static bool saveToCloudOK() { if (!dive_table.nr) { - report_error(qPrintable(QObject::tr("Don't save an empty log to the cloud"))); + report_error(qPrintable(gettextFromC::tr("Don't save an empty log to the cloud"))); return false; } return true; diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 9866925ef..f6b7a3fa1 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -31,13 +31,13 @@ public: { avgIco = new QLabel(owner); avgIco->setPixmap(QIcon(":value-average-icon").pixmap(16, 16)); - avgIco->setToolTip(QObject::tr("Average")); + avgIco->setToolTip(gettextFromC::tr("Average")); minIco = new QLabel(owner); minIco->setPixmap(QIcon(":value-minimum-icon").pixmap(16, 16)); - minIco->setToolTip(QObject::tr("Minimum")); + minIco->setToolTip(gettextFromC::tr("Minimum")); maxIco = new QLabel(owner); maxIco->setPixmap(QIcon(":value-maximum-icon").pixmap(16, 16)); - maxIco->setToolTip(QObject::tr("Maximum")); + maxIco->setToolTip(gettextFromC::tr("Maximum")); avgValue = new QLabel(owner); minValue = new QLabel(owner); maxValue = new QLabel(owner); diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp index d5a6f005f..5ed068d2f 100644 --- a/desktop-widgets/subsurfacewebservices.cpp +++ b/desktop-widgets/subsurfacewebservices.cpp @@ -620,7 +620,7 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData) * </DiveDateReader> */ QXmlStreamReader reader(xmlData); - const QString invalidXmlError = QObject::tr("Invalid response from server"); + const QString invalidXmlError = gettextFromC::tr("Invalid response from server"); bool seenDiveDates = false; DiveListResult result; result.idCount = 0; @@ -628,7 +628,7 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData) if (reader.readNextStartElement() && reader.name() != "DiveDateReader") { result.errorCondition = invalidXmlError; result.errorDetails = - QObject::tr("Expected XML tag 'DiveDateReader', got instead '%1") + gettextFromC::tr("Expected XML tag 'DiveDateReader', got instead '%1") .arg(reader.name().toString()); goto out; } @@ -674,14 +674,14 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData) if (!seenDiveDates) { result.errorCondition = invalidXmlError; - result.errorDetails = QObject::tr("Expected XML tag 'DiveDates' not found"); + result.errorDetails = gettextFromC::tr("Expected XML tag 'DiveDates' not found"); } out: if (reader.hasError()) { // if there was an XML error, overwrite the result or other error conditions result.errorCondition = invalidXmlError; - result.errorDetails = QObject::tr("Malformed XML response. Line %1: %2") + result.errorDetails = gettextFromC::tr("Malformed XML response. Line %1: %2") .arg(reader.lineNumber()) .arg(reader.errorString()); } diff --git a/desktop-widgets/templatelayout.h b/desktop-widgets/templatelayout.h index 2f5b24354..3b574c0db 100644 --- a/desktop-widgets/templatelayout.h +++ b/desktop-widgets/templatelayout.h @@ -107,8 +107,8 @@ if (property == "year") { } else if (property == "max_temp") { return object.year->max_temp.mkelvin == 0 ? "0" : get_temperature_string(object.year->max_temp, true); } else if (property == "total_time") { - return get_dive_duration_string(object.year->total_time.seconds, QObject::tr("h"), - QObject::tr("min"), QObject::tr("sec"), " "); + return get_dive_duration_string(object.year->total_time.seconds, gettextFromC::tr("h"), + gettextFromC::tr("min"), gettextFromC::tr("sec"), " "); } else if (property == "avg_time") { return get_minutes(object.year->total_time.seconds / object.year->selection_size); } else if (property == "shortest_time") { |