From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 17:43:49 +0000 (+0200) Subject: remove Translator::translatedMessages() X-Git-Tag: accepted/tizen/20131212.181521~468 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5cfff4988276aa2981c8fc833a760206e3aa3370;p=platform%2Fupstream%2Fqttools.git remove Translator::translatedMessages() it's inefficient to construct a new list. on top of that, the only user actually checks the message state again. (cherry picked from commit 8a5d0e6c3d1cf6b269f755a8d54b25b704ba8356) Change-Id: I54159bc041fa5188affb1d54862f742c1e445628 Reviewed-on: http://codereview.qt-project.org/4610 Reviewed-by: Qt Sanity Bot Reviewed-by: Oswald Buddenhagen --- diff --git a/src/linguist/shared/simtexth.cpp b/src/linguist/shared/simtexth.cpp index 31253d6..8933507 100644 --- a/src/linguist/shared/simtexth.cpp +++ b/src/linguist/shared/simtexth.cpp @@ -238,9 +238,7 @@ CandidateList similarTextHeuristicCandidates(const Translator *tor, QList scores; CandidateList candidates; - TML all = tor->translatedMessages(); - - foreach (const TranslatorMessage &mtm, all) { + foreach (const TranslatorMessage &mtm, tor->messages()) { if (mtm.type() == TranslatorMessage::Unfinished || mtm.translation().isEmpty()) continue; diff --git a/src/linguist/shared/translator.cpp b/src/linguist/shared/translator.cpp index 0c2678d..0cf24f5 100644 --- a/src/linguist/shared/translator.cpp +++ b/src/linguist/shared/translator.cpp @@ -613,15 +613,6 @@ QList Translator::messages() const return m_messages; } -QList Translator::translatedMessages() const -{ - TMM result; - for (TMM::ConstIterator it = m_messages.begin(); it != m_messages.end(); ++it) - if (it->type() == TranslatorMessage::Finished) - result.append(*it); - return result; -} - QStringList Translator::normalizedTranslations(const TranslatorMessage &msg, int numPlurals) { QStringList translations = msg.translations(); diff --git a/src/linguist/shared/translator.h b/src/linguist/shared/translator.h index bb147b8..9685e21 100644 --- a/src/linguist/shared/translator.h +++ b/src/linguist/shared/translator.h @@ -169,7 +169,6 @@ public: void setSourceLanguageCode(const QString &languageCode) { m_sourceLanguage = languageCode; } static QString guessLanguageCodeFromFileName(const QString &fileName); QList messages() const; - QList translatedMessages() const; static QStringList normalizedTranslations(const TranslatorMessage &m, int numPlurals); void normalizeTranslations(ConversionData &cd); QStringList normalizedTranslations(const TranslatorMessage &m, ConversionData &cd, bool *ok) const;