summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-06 21:14:15 +0100
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-06 22:58:01 +0100
commite9a0d840133f53e2a2fb138b9042000c883d0283 (patch)
treeca3257e7666e3cfd8673834a94afda120f6695b5
parent92e9a481518d1c13df32bc2f1a9c8a0ba0b8961a (diff)
eliminate Translator::contains()
replace the one use case with something more efficient
-rw-r--r--tools/linguist/shared/qm.cpp12
-rw-r--r--tools/linguist/shared/translator.cpp7
-rw-r--r--tools/linguist/shared/translator.h3
3 files changed, 11 insertions, 11 deletions
diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp
index 5965aac956..99aedef8fe 100644
--- a/tools/linguist/shared/qm.cpp
+++ b/tools/linguist/shared/qm.cpp
@@ -685,6 +685,16 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd)
+static bool containsStripped(const Translator &translator, const TranslatorMessage &msg)
+{
+ foreach (const TranslatorMessage &tmsg, translator.messages())
+ if (tmsg.sourceText() == msg.sourceText()
+ && tmsg.context() == msg.context()
+ && tmsg.comment().isEmpty())
+ return true;
+ return false;
+}
+
static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData &cd)
{
Releaser releaser;
@@ -741,7 +751,7 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData
bool forceComment =
msg.comment().isEmpty()
|| msg.context().isEmpty()
- || translator.contains(msg.context(), msg.sourceText(), QString());
+ || containsStripped(translator, msg);
releaser.insert(msg, tlns, forceComment);
}
}
diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp
index 92ecf0774a..a35666d420 100644
--- a/tools/linguist/shared/translator.cpp
+++ b/tools/linguist/shared/translator.cpp
@@ -302,13 +302,6 @@ bool Translator::release(QFile *iod, ConversionData &cd) const
return false;
}
-bool Translator::contains(const QString &context,
- const QString &sourceText, const QString &comment) const
-{
- return m_messages.contains(TranslatorMessage(context, sourceText, comment,
- QString(), QString(), 0));
-}
-
TranslatorMessage Translator::find(const QString &context,
const QString &comment, const TranslatorMessage::References &refs) const
{
diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h
index c51993d7b1..a44d53c7a7 100644
--- a/tools/linguist/shared/translator.h
+++ b/tools/linguist/shared/translator.h
@@ -113,9 +113,6 @@ public:
bool save(const QString &filename, ConversionData &err, const QString &format /*= "auto"*/) const;
bool release(QFile *iod, ConversionData &cd) const;
- bool contains(const QString &context, const QString &sourceText,
- const QString &comment) const;
-
TranslatorMessage find(const QString &context,
const QString &comment, const TranslatorMessage::References &refs) const;