From 879cb73b8bda364f63cc97c0f9963cfddc581add Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 17 Jun 2018 21:03:16 +0200 Subject: Localization: remove gettextFromC::instance() There were a handfull instances of the kind 1) gettextFromC::instance()->tr(...) 2) gettextFromC::instance()->trGettext(...) 1) is pointless, as tr is a static function. All instances of 2) were likewise pointless, because trGettext() returns a C-string, which was then immediately converted to a QString. Thus, replace both constructs by gettextFromC::tr(...). After this change there was only one user of gettextFromC::instance() left, viz. the C-interface funtion trGettext(). Therefore, remove gettextFromC::instance() and do all the caching / translating directly in the global trGettext(). Signed-off-by: Berthold Stoeger --- qt-models/cylindermodel.cpp | 2 +- qt-models/divelocationmodel.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'qt-models') diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index 19302421e..9a093112c 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -222,7 +222,7 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const ret = get_depth_string(gas_mnd(&cyl->gasmix, prefs.bestmixend, &displayed_dive, M_OR_FT(1,1)), true); break; case USE: - ret = gettextFromC::instance()->trGettext(cylinderuse_text[cyl->cylinder_use]); + ret = gettextFromC::tr(cylinderuse_text[cyl->cylinder_use]); break; } break; diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index c706744a3..2e62997f9 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -176,7 +176,7 @@ GeoReferencingOptionsModel::GeoReferencingOptionsModel(QObject *parent) : QStrin QStringList list; int i; for (i = 0; i < TC_NR_CATEGORIES; i++) - list << gettextFromC::instance()->trGettext(taxonomy_category_names[i]); + list << gettextFromC::tr(taxonomy_category_names[i]); setStringList(list); } -- cgit v1.2.3-70-g09d2