From 92e9a481518d1c13df32bc2f1a9c8a0ba0b8961a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 6 Nov 2009 21:07:15 +0100 Subject: eliminate Translator::replace() --- tools/linguist/lupdate/merge.cpp | 10 +++------- tools/linguist/shared/translator.cpp | 9 --------- tools/linguist/shared/translator.h | 1 - 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index 1ae4cfb..6b8d4bb 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -247,10 +247,8 @@ int applyNumberHeuristic(Translator &tor) t = translated.find(zeroKey((*u).sourceText())); if (t != translated.end() && !t.key().isEmpty() && t->sourceText() != u->sourceText()) { - TranslatorMessage m = *u; - m.setTranslation(translationAttempt(t->translation(), t->sourceText(), - u->sourceText())); - tor.replace(m); + u->setTranslation(translationAttempt(t->translation(), t->sourceText(), + u->sourceText())); inserted++; } } @@ -305,9 +303,7 @@ int applySameTextHeuristic(Translator &tor) QString key = u->sourceText(); t = translated.find(key); if (t != translated.end()) { - TranslatorMessage m = *u; - m.setTranslations(t->translations()); - tor.replace(m); + u->setTranslations(t->translations()); ++inserted; } } diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index 3b7ee9a..92ecf07 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -80,15 +80,6 @@ QList &Translator::registeredFileFormats() return theFormats; } -void Translator::replace(const TranslatorMessage &msg) -{ - int index = m_messages.indexOf(msg); - if (index == -1) - m_messages.append(msg); - else - m_messages[index] = msg; -} - void Translator::replaceSorted(const TranslatorMessage &msg) { int index = m_messages.indexOf(msg); diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index 6db6f3a..c51993d 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -122,7 +122,6 @@ public: bool contains(const QString &context) const; TranslatorMessage find(const QString &context) const; - void replace(const TranslatorMessage &msg); void replaceSorted(const TranslatorMessage &msg); void extend(const TranslatorMessage &msg); // Only for single-location messages void append(const TranslatorMessage &msg); -- cgit v0.12