diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-05-27 23:25:07 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-05-27 23:25:07 (GMT) |
commit | fb2e33b21557412ae7bde009662ca89870407f5f (patch) | |
tree | 61e7765a4e644d12a0addc21a0bf63e13e992cb9 /tools/linguist | |
parent | d53e4499f864719446abdb7fdeff433dbb3f7d98 (diff) | |
parent | fcfdccc03b6dd26a82e87a6b6a0ca48d67f78cf6 (diff) | |
download | Qt-fb2e33b21557412ae7bde009662ca89870407f5f.zip Qt-fb2e33b21557412ae7bde009662ca89870407f5f.tar.gz Qt-fb2e33b21557412ae7bde009662ca89870407f5f.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Conflicts:
mkspecs/features/qt.prf
src/corelib/animation/qanimationgroup.cpp
src/corelib/animation/qparallelanimationgroup.cpp
src/corelib/animation/qpauseanimation.cpp
src/corelib/animation/qpropertyanimation.cpp
src/corelib/animation/qsequentialanimationgroup.cpp
src/corelib/kernel/kernel.pri
src/corelib/kernel/qvariant_p.h
src/corelib/tools/qeasingcurve.cpp
src/gui/graphicsview/qgraphicsitem.cpp
src/opengl/opengl.pro
src/opengl/qgl_x11egl.cpp
tests/auto/auto.pro
Diffstat (limited to 'tools/linguist')
-rw-r--r-- | tools/linguist/lconvert/main.cpp | 24 | ||||
-rw-r--r-- | tools/linguist/lupdate/java.cpp | 13 | ||||
-rw-r--r-- | tools/linguist/shared/translator.cpp | 20 | ||||
-rw-r--r-- | tools/linguist/shared/translator.h | 3 |
4 files changed, 48 insertions, 12 deletions
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index bdc6c9a..ce17b6f 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -97,6 +97,11 @@ static int usage(const QStringList &args) " Drop obsolete messages.\n\n" " --no-finished\n" " Drop finished messages.\n\n" + " --locations {absolute|relative|none}\n" + " Override how source code references are saved in ts files.\n" + " Default is absolute.\n}n" + " --no-ui-lines\n" + " Drop line numbers from references to .ui files.\n\n" " --verbose\n" " be a bit more verbose\n\n" "Long options can be specified with only one leading dash, too.\n\n" @@ -129,6 +134,8 @@ int main(int argc, char *argv[]) bool noObsolete = false; bool noFinished = false; bool verbose = false; + bool noUiLines = false; + Translator::LocationsType locations = Translator::DefaultLocations; ConversionData cd; Translator tr; @@ -180,6 +187,19 @@ int main(int argc, char *argv[]) noObsolete = true; } else if (args[i] == QLatin1String("-no-finished")) { noFinished = true; + } else if (args[i] == QLatin1String("-locations")) { + if (++i >= args.size()) + return usage(args); + if (args[i] == QLatin1String("none")) + locations = Translator::NoLocations; + else if (args[i] == QLatin1String("relative")) + locations = Translator::RelativeLocations; + else if (args[i] == QLatin1String("absolute")) + locations = Translator::AbsoluteLocations; + else + return usage(args); + } else if (args[i] == QLatin1String("-no-ui-lines")) { + noUiLines = true; } else if (args[i] == QLatin1String("-verbose")) { verbose = true; } else if (args[i].startsWith(QLatin1Char('-'))) { @@ -224,6 +244,10 @@ int main(int argc, char *argv[]) tr.stripFinishedMessages(); if (dropTranslations) tr.dropTranslations(); + if (noUiLines) + tr.dropUiLines(); + if (locations != Translator::DefaultLocations) + tr.setLocationsType(locations); if (!tr.save(outFileName, cd, outFormat)) { qWarning("%s", qPrintable(cd.error())); diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp index 31024f9..658aebf 100644 --- a/tools/linguist/lupdate/java.cpp +++ b/tools/linguist/lupdate/java.cpp @@ -375,22 +375,13 @@ static bool matchString( QString &s ) return true; } -static bool matchInteger( qlonglong *number) -{ - bool matches = (yyTok == Tok_Integer); - if (matches) { - yyTok = getToken(); - *number = yyInteger; - } - return matches; -} - static bool matchStringOrNull(QString &s) { bool matches = matchString(s); if (!matches) { matches = (yyTok == Tok_null); - if (matches) yyTok = getToken(); + if (matches) + yyTok = getToken(); } return matches; } diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index 312bb71..c1f242d 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -416,6 +416,26 @@ void Translator::dropTranslations() } } +void Translator::dropUiLines() +{ + QString uiXt = QLatin1String(".ui"); + QString juiXt = QLatin1String(".jui"); + for (TMM::Iterator it = m_messages.begin(); it != m_messages.end(); ++it) { + QHash<QString, int> have; + QList<TranslatorMessage::Reference> refs; + foreach (const TranslatorMessage::Reference &itref, it->allReferences()) { + const QString &fn = itref.fileName(); + if (fn.endsWith(uiXt) || fn.endsWith(juiXt)) { + if (++have[fn] == 1) + refs.append(TranslatorMessage::Reference(fn, -1)); + } else { + refs.append(itref); + } + } + it->setReferences(refs); + } +} + QSet<TranslatorMessagePtr> Translator::resolveDuplicates() { QSet<TranslatorMessagePtr> dups; diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index 4e97000..5d0549b 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -132,6 +132,7 @@ public: void stripNonPluralForms(); void stripIdenticalSourceTranslations(); void dropTranslations(); + void dropUiLines(); void makeFileNamesAbsolute(const QDir &originalPath); QSet<TranslatorMessagePtr> resolveDuplicates(); static void reportDuplicates(const QSet<TranslatorMessagePtr> &dupes, @@ -143,7 +144,7 @@ public: QString languageCode() const { return m_language; } QString sourceLanguageCode() const { return m_sourceLanguage; } - enum LocationsType { NoLocations, RelativeLocations, AbsoluteLocations }; + enum LocationsType { DefaultLocations, NoLocations, RelativeLocations, AbsoluteLocations }; void setLocationsType(LocationsType lt) { m_locationsType = lt; } LocationsType locationsType() const { return m_locationsType; } |