summaryrefslogtreecommitdiffstats
path: root/tools/linguist/shared
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-06 20:14:15 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-06 21:58:01 (GMT)
commite9a0d840133f53e2a2fb138b9042000c883d0283 (patch)
treeca3257e7666e3cfd8673834a94afda120f6695b5 /tools/linguist/shared
parent92e9a481518d1c13df32bc2f1a9c8a0ba0b8961a (diff)
downloadQt-e9a0d840133f53e2a2fb138b9042000c883d0283.zip
Qt-e9a0d840133f53e2a2fb138b9042000c883d0283.tar.gz
Qt-e9a0d840133f53e2a2fb138b9042000c883d0283.tar.bz2
eliminate Translator::contains()
replace the one use case with something more efficient
Diffstat (limited to 'tools/linguist/shared')
-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 5965aac..99aedef 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 92ecf07..a35666d 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 c51993d..a44d53c 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;