diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-11-05 21:39:24 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2009-11-11 17:21:16 (GMT) |
commit | e28eec0c6bee31dfea46f6d4076d108c2369b793 (patch) | |
tree | 97ea9a9acb2e9a35f8fba6e3260a5b54a150d917 /tools | |
parent | e029886be27c2434ecfb71f08a0c1a574a1ae533 (diff) | |
download | Qt-e28eec0c6bee31dfea46f6d4076d108c2369b793.zip Qt-e28eec0c6bee31dfea46f6d4076d108c2369b793.tar.gz Qt-e28eec0c6bee31dfea46f6d4076d108c2369b793.tar.bz2 |
don't construct a new message for look-up purposes only
Diffstat (limited to 'tools')
-rw-r--r-- | tools/linguist/lupdate/merge.cpp | 8 | ||||
-rw-r--r-- | tools/linguist/shared/translator.cpp | 8 | ||||
-rw-r--r-- | tools/linguist/shared/translator.h | 2 |
3 files changed, 5 insertions, 13 deletions
diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index b5f77cd..cffbfa3 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -351,8 +351,9 @@ Translator merge(const Translator &tor, const Translator &virginTor, if (!mv.isNull()) m.setComment(mv.comment()); } else { - TranslatorMessage mv = virginTor.find(m.context(), m.sourceText(), m.comment()); - if (mv.isNull()) { + TranslatorMessage mv; + int mvi = virginTor.messages().indexOf(m); + if (mvi < 0) { if (!(options & HeuristicSimilarText)) { newType = TranslatorMessage::Obsolete; if (m.type() != TranslatorMessage::Obsolete) @@ -402,6 +403,7 @@ Translator merge(const Translator &tor, const Translator &virginTor, } } } else { + mv = virginTor.message(mvi); switch (m.type()) { case TranslatorMessage::Finished: default: @@ -446,7 +448,7 @@ Translator merge(const Translator &tor, const Translator &virginTor, if (tor.contains(mv.context())) continue; } else { - if (tor.contains(mv.context(), mv.sourceText(), mv.comment())) + if (tor.messages().contains(mv)) continue; if (options & HeuristicSimilarText) { TranslatorMessage m = tor.find(mv.context(), mv.comment(), mv.allReferences()); diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index cd670cc..3b7ee9a 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -319,14 +319,6 @@ bool Translator::contains(const QString &context, } TranslatorMessage Translator::find(const QString &context, - const QString &sourceText, const QString &comment) const -{ - TranslatorMessage needle(context, sourceText, comment, QString(), QString(), 0); - int index = m_messages.indexOf(needle); - return index == -1 ? TranslatorMessage() : m_messages.at(index); -} - -TranslatorMessage Translator::find(const QString &context, const QString &comment, const TranslatorMessage::References &refs) const { if (!refs.isEmpty()) { diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index ef81d2a..6db6f3a 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -115,8 +115,6 @@ public: bool contains(const QString &context, const QString &sourceText, const QString &comment) const; - TranslatorMessage find(const QString &context, - const QString &sourceText, const QString &comment) const; TranslatorMessage find(const QString &context, const QString &comment, const TranslatorMessage::References &refs) const; |