diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-07-03 16:52:20 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-04 05:33:31 +0800 |
commit | 57c01f7a66ccd04fc2e83b67a840519db4661798 (patch) | |
tree | 4134dd2be823ea62ab3370cfb7ee567a6a53d4ec /desktop-widgets | |
parent | 2f951413303e10a80e540cacd0c6c282f8ce82cc (diff) | |
download | subsurface-57c01f7a66ccd04fc2e83b67a840519db4661798.tar.gz |
Translations: unify gettextFromC::tr() and QObject::tr()
There were two catch-all classes for translations outside of class
context. gettextFromC was used exclusively from C, but C++ used
both, gettextFromC and QObject. Some of the string were even present
in both. Therefore, unify to gettextFromC throughout the code base.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-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 |
5 files changed, 11 insertions, 11 deletions
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") { |