summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-06 20:14:15 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-11-11 17:21:19 (GMT)
commita0021a60bbec8b6ab5c9f8854747857e9e388457 (patch)
tree4fa9ba46a23de53038441e1ec59206247cc080c7 /tools
parentd9dfd186247203924f22dc2e4641d8bc4766dbef (diff)
downloadQt-a0021a60bbec8b6ab5c9f8854747857e9e388457.zip
Qt-a0021a60bbec8b6ab5c9f8854747857e9e388457.tar.gz
Qt-a0021a60bbec8b6ab5c9f8854747857e9e388457.tar.bz2
eliminate Translator::contains()
replace the one use case with something more efficient
Diffstat (limited to 'tools')
-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;