diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-06-01 15:53:27 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-06-01 19:34:36 (GMT) |
commit | 531614ae15a2bc43e782c247a2dee5387566397a (patch) | |
tree | b25baf4b0a4ffb2487bb6f2daa25596553ff262c /tools | |
parent | f1249f94c07654f0b76e7a90fb81ed5b58cd30f7 (diff) | |
download | Qt-531614ae15a2bc43e782c247a2dee5387566397a.zip Qt-531614ae15a2bc43e782c247a2dee5387566397a.tar.gz Qt-531614ae15a2bc43e782c247a2dee5387566397a.tar.bz2 |
nuke Translator::release(), make saveQM() non-static instead
this "factory" served only to obfuscate the code
Diffstat (limited to 'tools')
-rw-r--r-- | tools/linguist/linguist/messagemodel.cpp | 2 | ||||
-rw-r--r-- | tools/linguist/lrelease/main.cpp | 2 | ||||
-rw-r--r-- | tools/linguist/shared/qm.cpp | 2 | ||||
-rw-r--r-- | tools/linguist/shared/translator.cpp | 10 | ||||
-rw-r--r-- | tools/linguist/shared/translator.h | 3 |
5 files changed, 5 insertions, 14 deletions
diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp index 9eea2a3..5cbc5e8 100644 --- a/tools/linguist/linguist/messagemodel.cpp +++ b/tools/linguist/linguist/messagemodel.cpp @@ -375,7 +375,7 @@ bool DataModel::release(const QString &fileName, bool verbose, bool ignoreUnfini cd.m_verbose = verbose; cd.m_ignoreUnfinished = ignoreUnfinished; cd.m_saveMode = mode; - bool ok = tor.release(&file, cd); + bool ok = saveQM(tor, file, cd); if (!ok) QMessageBox::warning(parent, QObject::tr("Qt Linguist"), cd.error()); return ok; diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index f9e08a0..9adaff5 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -157,7 +157,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, } tor.normalizeTranslations(cd); - bool ok = tor.release(&file, cd); + bool ok = saveQM(tor, file, cd); file.close(); if (!ok) { diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index b8cfeca..06603fe 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -697,7 +697,7 @@ static bool containsStripped(const Translator &translator, const TranslatorMessa return false; } -static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData &cd) +bool saveQM(const Translator &translator, QIODevice &dev, ConversionData &cd) { Releaser releaser; QLocale::Language l; diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index a29372a..2a15fe7 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -329,16 +329,6 @@ void Translator::languageAndCountry(const QString &languageCode, } } -bool Translator::release(QFile *iod, ConversionData &cd) const -{ - foreach (const FileFormat &format, registeredFileFormats()) { - if (format.extension == QLatin1String("qm")) - return (*format.saver)(*this, *iod, cd); - } - cd.appendError(QLatin1String("No .qm saver available.")); - return false; -} - int Translator::find(const TranslatorMessage &msg) const { for (int i = 0; i < m_messages.count(); ++i) { diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index fb9bd2d..b9bc94c 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -125,7 +125,6 @@ public: bool load(const QString &filename, ConversionData &err, const QString &format /* = "auto" */); bool save(const QString &filename, ConversionData &err, const QString &format /* = "auto" */) const; - bool release(QFile *iod, ConversionData &cd) const; int find(const TranslatorMessage &msg) const; TranslatorMessage find(const QString &context, @@ -235,6 +234,8 @@ private: bool getNumerusInfo(QLocale::Language language, QLocale::Country country, QByteArray *rules, QStringList *forms, const char **gettextRules); +bool saveQM(const Translator &translator, QIODevice &dev, ConversionData &cd); + /* This is a quick hack. The proper way to handle this would be to extend Translator's interface. |