本文整理汇总了C++中ConversionData类的典型用法代码示例。如果您正苦于以下问题:C++ ConversionData类的具体用法?C++ ConversionData怎么用?C++ ConversionData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConversionData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
bool DataModel::load(const QString &fileName, bool *langGuessed, QWidget *parent)
{
Translator tor;
ConversionData cd;
bool ok = tor.load(fileName, cd, QLatin1String("auto"));
if (!ok) {
QMessageBox::warning(parent, QObject::tr("Qt Linguist"), cd.error());
return false;
}
Translator::Duplicates dupes = tor.resolveDuplicates();
if (!dupes.byId.isEmpty() || !dupes.byContents.isEmpty()) {
QString err = tr("<qt>Duplicate messages found in '%1':").arg(Qt::escape(fileName));
int numdups = 0;
foreach (int i, dupes.byId) {
if (++numdups >= 5) {
err += tr("<p>[more duplicates omitted]");
goto doWarn;
}
err += tr("<p>* ID: %1").arg(Qt::escape(tor.message(i).id()));
}
foreach (int j, dupes.byContents) {
const TranslatorMessage &msg = tor.message(j);
if (++numdups >= 5) {
err += tr("<p>[more duplicates omitted]");
break;
}
err += tr("<p>* Context: %1<br>* Source: %2")
.arg(Qt::escape(msg.context()), Qt::escape(msg.sourceText()));
if (!msg.comment().isEmpty())
err += tr("<br>* Comment: %3").arg(Qt::escape(msg.comment()));
}
doWarn:
QMessageBox::warning(parent, QObject::tr("Qt Linguist"), err);
}
示例2: loadUI
bool loadUI(Translator &translator, const QString &filename, ConversionData &cd)
{
cd.m_sourceFileName = filename;
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
cd.appendError(QString::fromLatin1("Cannot open %1: %2")
.arg(filename, file.errorString()));
return false;
}
QXmlInputSource in(&file);
QXmlSimpleReader reader;
reader.setFeature(QLatin1String("http://xml.org/sax/features/namespaces"), false);
reader.setFeature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"), true);
reader.setFeature(QLatin1String(
"http://trolltech.com/xml/features/report-whitespace-only-CharData"), false);
UiReader handler(translator, cd);
reader.setContentHandler(&handler);
reader.setErrorHandler(&handler);
bool result = reader.parse(in);
if (!result)
cd.appendError(QLatin1String("Parse error in UI file"));
reader.setContentHandler(0);
reader.setErrorHandler(0);
return result;
}
示例3: loadTsFile
static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbose */)
{
ConversionData cd;
bool ok = tor.load(tsFileName, cd, QLatin1String("auto"));
if (!ok) {
qWarning("lrelease error: %s\n", qPrintable(cd.error()));
} else {
if (!cd.errors().isEmpty())
printOut(cd.error());
}
return ok;
}
示例4: loadTsFile
static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbose */)
{
ConversionData cd;
bool ok = tor.load(tsFileName, cd, QLatin1String("auto"));
if (!ok) {
printErr(LR::tr("lrelease error: %1").arg(cd.error()));
} else {
if (!cd.errors().isEmpty())
printOut(cd.error());
}
cd.clearErrors();
return ok;
}
示例5: updateTsFiles
static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFileNames,
const QStringList &alienFiles,
const QString &sourceLanguage, const QString &targetLanguage,
UpdateOptions options, bool *fail)
{
QList<Translator> aliens;
foreach (const QString &fileName, alienFiles) {
ConversionData cd;
Translator tor;
if (!tor.load(fileName, cd, QLatin1String("auto"))) {
printErr(cd.error());
*fail = true;
continue;
}
tor.resolveDuplicates();
aliens << tor;
}
示例6: releaseTranslator
static bool releaseTranslator(Translator &tor, const QString &qmFileName,
ConversionData &cd, bool removeIdentical)
{
tor.reportDuplicates(tor.resolveDuplicates(), qmFileName, cd.isVerbose());
if (cd.isVerbose())
printOut(LR::tr("Updating '%1'...\n").arg(qmFileName));
if (removeIdentical) {
if (cd.isVerbose())
printOut(LR::tr("Removing translations equal to source text in '%1'...\n").arg(qmFileName));
tor.stripIdenticalSourceTranslations();
}
QFile file(qmFileName);
if (!file.open(QIODevice::WriteOnly)) {
printErr(LR::tr("lrelease error: cannot create '%1': %2\n")
.arg(qmFileName, file.errorString()));
return false;
}
tor.normalizeTranslations(cd);
bool ok = saveQM(tor, file, cd);
file.close();
if (!ok) {
printErr(LR::tr("lrelease error: cannot save '%1': %2")
.arg(qmFileName, cd.error()));
} else if (!cd.errors().isEmpty()) {
printOut(cd.error());
}
cd.clearErrors();
return ok;
}
示例7: extend
void Translator::extend(const TranslatorMessage &msg, ConversionData &cd)
{
int index = find(msg);
if (index == -1) {
append(msg);
} else {
TranslatorMessage &emsg = m_messages[index];
if (emsg.sourceText().isEmpty()) {
delIndex(index);
emsg.setSourceText(msg.sourceText());
addIndex(index, msg);
} else if (!msg.sourceText().isEmpty() && emsg.sourceText() != msg.sourceText()) {
cd.appendError(QString::fromLatin1("Contradicting source strings for message with id '%1'.")
.arg(emsg.id()));
return;
}
if (emsg.extras().isEmpty()) {
emsg.setExtras(msg.extras());
} else if (!msg.extras().isEmpty() && emsg.extras() != msg.extras()) {
cd.appendError(QString::fromLatin1("Contradicting meta data for for %1.")
.arg(!emsg.id().isEmpty()
? QString::fromLatin1("message with id '%1'").arg(emsg.id())
: QString::fromLatin1("message '%1'").arg(makeMsgId(msg))));
return;
}
emsg.addReferenceUniq(msg.fileName(), msg.lineNumber());
if (!msg.extraComment().isEmpty()) {
QString cmt = emsg.extraComment();
if (!cmt.isEmpty()) {
QStringList cmts = cmt.split(QLatin1String("\n----------\n"));
if (!cmts.contains(msg.extraComment())) {
cmts.append(msg.extraComment());
cmt = cmts.join(QLatin1String("\n----------\n"));
}
} else {
cmt = msg.extraComment();
}
emsg.setExtraComment(cmt);
}
}
}
示例8: updateTsFiles
static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFileNames,
const QStringList &alienFiles,
const QString &sourceLanguage, const QString &targetLanguage,
UpdateOptions options, bool *fail)
{
for (int i = 0; i < fetchedTor.messageCount(); i++) {
const TranslatorMessage &msg = fetchedTor.constMessage(i);
if (!msg.id().isEmpty() && msg.sourceText().isEmpty())
printErr(LU::tr("lupdate warning: Message with id '%1' has no source.\n")
.arg(msg.id()));
}
QList<Translator> aliens;
foreach (const QString &fileName, alienFiles) {
ConversionData cd;
Translator tor;
if (!tor.load(fileName, cd, QLatin1String("auto"))) {
printErr(cd.error());
*fail = true;
continue;
}
tor.resolveDuplicates();
aliens << tor;
}
示例9: releaseTsFile
static bool releaseTsFile(const QString& tsFileName,
ConversionData &cd, bool removeIdentical)
{
Translator tor;
if (!loadTsFile(tor, tsFileName, cd.isVerbose()))
return false;
QString qmFileName = tsFileName;
foreach (const Translator::FileFormat &fmt, Translator::registeredFileFormats()) {
if (qmFileName.endsWith(QLatin1Char('.') + fmt.extension)) {
qmFileName.chop(fmt.extension.length() + 1);
break;
}
}
qmFileName += QLatin1String(".qm");
return releaseTranslator(tor, qmFileName, cd, removeIdentical);
}
示例10: loadJava
bool loadJava(Translator &translator, const QString &filename, ConversionData &cd)
{
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
cd.appendError(QString::fromLatin1("Cannot open %1: %2")
.arg(filename, file.errorString()));
return false;
}
yyDefaultContext = cd.m_defaultContext;
yyInPos = -1;
yyFileName = filename;
yyPackage.clear();
yyScope.clear();
yyTok = -1;
yyParenDepth = 0;
yyCurLineNo = 0;
yyParenLineNo = 1;
QTextStream ts(&file);
QByteArray codecName;
if (!cd.m_codecForSource.isEmpty())
codecName = cd.m_codecForSource;
else
codecName = translator.codecName(); // Just because it should be latin1 already
ts.setCodec(QTextCodec::codecForName(codecName));
ts.setAutoDetectUnicode(true);
yyInStr = ts.readAll();
yyInPos = 0;
yyFileName = filename;
yyCurLineNo = 1;
yyParenLineNo = 1;
parse(&translator);
// Java uses UTF-16 internally and Jambi makes UTF-8 for tr() purposes of it.
translator.setCodecName("UTF-8");
return true;
}
示例11: updateTsFiles
static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFileNames,
bool setCodec, const QString &sourceLanguage, const QString &targetLanguage,
UpdateOptions options, bool *fail)
{
QDir dir;
QString err;
foreach (const QString &fileName, tsFileNames) {
QString fn = dir.relativeFilePath(fileName);
ConversionData cd;
Translator tor;
cd.m_sortContexts = !(options & NoSort);
if (QFile(fileName).exists()) {
if (!tor.load(fileName, cd, QLatin1String("auto"))) {
printErr(cd.error());
*fail = true;
continue;
}
tor.resolveDuplicates();
cd.clearErrors();
if (setCodec && fetchedTor.codec() != tor.codec())
printErr(LU::tr("lupdate warning: Codec for tr() '%1' disagrees with"
" existing file's codec '%2'. Expect trouble.\n")
.arg(QString::fromLatin1(fetchedTor.codecName()),
QString::fromLatin1(tor.codecName())));
if (!targetLanguage.isEmpty() && targetLanguage != tor.languageCode())
printErr(LU::tr("lupdate warning: Specified target language '%1' disagrees with"
" existing file's language '%2'. Ignoring.\n")
.arg(targetLanguage, tor.languageCode()));
if (!sourceLanguage.isEmpty() && sourceLanguage != tor.sourceLanguageCode())
printErr(LU::tr("lupdate warning: Specified source language '%1' disagrees with"
" existing file's language '%2'. Ignoring.\n")
.arg(sourceLanguage, tor.sourceLanguageCode()));
} else {
if (setCodec)
tor.setCodec(fetchedTor.codec());
if (!targetLanguage.isEmpty())
tor.setLanguageCode(targetLanguage);
else
tor.setLanguageCode(Translator::guessLanguageCodeFromFileName(fileName));
if (!sourceLanguage.isEmpty())
tor.setSourceLanguageCode(sourceLanguage);
}
tor.makeFileNamesAbsolute(QFileInfo(fileName).absoluteDir());
if (options & NoLocations)
tor.setLocationsType(Translator::NoLocations);
else if (options & RelativeLocations)
tor.setLocationsType(Translator::RelativeLocations);
else if (options & AbsoluteLocations)
tor.setLocationsType(Translator::AbsoluteLocations);
if (options & Verbose)
printOut(LU::tr("Updating '%1'...\n").arg(fn));
UpdateOptions theseOptions = options;
if (tor.locationsType() == Translator::NoLocations) // Could be set from file
theseOptions |= NoLocations;
Translator out = merge(tor, fetchedTor, theseOptions, err);
if (setCodec)
out.setCodec(fetchedTor.codec());
if ((options & Verbose) && !err.isEmpty()) {
printOut(err);
err.clear();
}
if (options & PluralOnly) {
if (options & Verbose)
printOut(LU::tr("Stripping non plural forms in '%1'...\n").arg(fn));
out.stripNonPluralForms();
}
if (options & NoObsolete)
out.stripObsoleteMessages();
out.stripEmptyContexts();
out.normalizeTranslations(cd);
if (!cd.errors().isEmpty()) {
printErr(cd.error());
cd.clearErrors();
}
if (!out.save(fileName, cd, QLatin1String("auto"))) {
printErr(cd.error());
*fail = true;
}
}
示例12: saveXLIFF
bool saveXLIFF(const Translator &translator, QIODevice &dev, ConversionData &cd)
{
bool ok = true;
int indent = 0;
QTextStream ts(&dev);
ts.setCodec(QTextCodec::codecForName("UTF-8"));
QStringList dtgs = cd.dropTags();
dtgs << QLatin1String("po-(old_)?msgid_plural");
QRegExp drops(dtgs.join(QLatin1String("|")));
QHash<QString, QHash<QString, QList<TranslatorMessage> > > messageOrder;
QHash<QString, QList<QString> > contextOrder;
QList<QString> fileOrder;
foreach (const TranslatorMessage &msg, translator.messages()) {
QString fn = msg.fileName();
if (fn.isEmpty() && msg.type() == TranslatorMessage::Obsolete)
fn = QLatin1String(MAGIC_OBSOLETE_REFERENCE);
QHash<QString, QList<TranslatorMessage> > &file = messageOrder[fn];
if (file.isEmpty())
fileOrder.append(fn);
QList<TranslatorMessage> &context = file[msg.context()];
if (context.isEmpty())
contextOrder[fn].append(msg.context());
context.append(msg);
}
ts.setFieldAlignment(QTextStream::AlignRight);
ts << "<?xml version=\"1.0\"";
ts << " encoding=\"utf-8\"?>\n";
ts << "<xliff version=\"1.2\" xmlns=\"" << XLIFF12namespaceURI
<< "\" xmlns:trolltech=\"" << TrollTsNamespaceURI << "\">\n";
++indent;
writeExtras(ts, indent, translator.extras(), drops);
QString sourceLanguageCode = translator.sourceLanguageCode();
if (sourceLanguageCode.isEmpty() || sourceLanguageCode == QLatin1String("C"))
sourceLanguageCode = QLatin1String("en");
else
sourceLanguageCode.replace(QLatin1Char('_'), QLatin1Char('-'));
QString languageCode = translator.languageCode();
languageCode.replace(QLatin1Char('_'), QLatin1Char('-'));
foreach (const QString &fn, fileOrder) {
writeIndent(ts, indent);
ts << "<file original=\"" << fn << "\""
<< " datatype=\"" << dataType(messageOrder[fn].begin()->first()) << "\""
<< " source-language=\"" << sourceLanguageCode.toLatin1() << "\""
<< " target-language=\"" << languageCode.toLatin1() << "\""
<< "><body>\n";
++indent;
foreach (const QString &ctx, contextOrder[fn]) {
if (!ctx.isEmpty()) {
writeIndent(ts, indent);
ts << "<group restype=\"" << restypeContext << "\""
<< " resname=\"" << protect(ctx) << "\">\n";
++indent;
}
foreach (const TranslatorMessage &msg, messageOrder[fn][ctx])
writeMessage(ts, msg, drops, indent);
if (!ctx.isEmpty()) {
--indent;
writeIndent(ts, indent);
ts << "</group>\n";
}
}
--indent;
writeIndent(ts, indent);
ts << "</body></file>\n";
}
示例13: main
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
#ifndef Q_OS_WIN32
QTranslator translator;
QTranslator qtTranslator;
QString sysLocale = QLocale::system().name();
QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)
&& qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
app.installTranslator(&translator);
app.installTranslator(&qtTranslator);
}
#endif // Q_OS_WIN32
QStringList args = app.arguments();
QList<File> inFiles;
QString inFormat(QLatin1String("auto"));
QString outFileName;
QString outFormat(QLatin1String("auto"));
QString targetLanguage;
QString sourceLanguage;
bool dropTranslations = false;
bool noObsolete = false;
bool noFinished = false;
bool verbose = false;
bool noUiLines = false;
Translator::LocationsType locations = Translator::DefaultLocations;
ConversionData cd;
Translator tr;
for (int i = 1; i < args.size(); ++i) {
if (args[i].startsWith(QLatin1String("--")))
args[i].remove(0, 1);
if (args[i] == QLatin1String("-o")
|| args[i] == QLatin1String("-output-file")) {
if (++i >= args.size())
return usage(args);
outFileName = args[i];
} else if (args[i] == QLatin1String("-of")
|| args[i] == QLatin1String("-output-format")) {
if (++i >= args.size())
return usage(args);
outFormat = args[i];
} else if (args[i] == QLatin1String("-i")
|| args[i] == QLatin1String("-input-file")) {
if (++i >= args.size())
return usage(args);
File file;
file.name = args[i];
file.format = inFormat;
inFiles.append(file);
} else if (args[i] == QLatin1String("-if")
|| args[i] == QLatin1String("-input-format")) {
if (++i >= args.size())
return usage(args);
inFormat = args[i];
} else if (args[i] == QLatin1String("-input-codec")) {
if (++i >= args.size())
return usage(args);
cd.m_codecForSource = args[i].toLatin1();
} else if (args[i] == QLatin1String("-output-codec")) {
if (++i >= args.size())
return usage(args);
cd.m_outputCodec = args[i].toLatin1();
} else if (args[i] == QLatin1String("-drop-tag")) {
if (++i >= args.size())
return usage(args);
cd.m_dropTags.append(args[i]);
} else if (args[i] == QLatin1String("-drop-translations")) {
dropTranslations = true;
} else if (args[i] == QLatin1String("-target-language")) {
if (++i >= args.size())
return usage(args);
targetLanguage = args[i];
} else if (args[i] == QLatin1String("-source-language")) {
if (++i >= args.size())
return usage(args);
sourceLanguage = args[i];
} else if (args[i].startsWith(QLatin1String("-h"))) {
usage(args);
return 0;
} else if (args[i] == QLatin1String("-no-obsolete")) {
noObsolete = true;
} else if (args[i] == QLatin1String("-no-finished")) {
noFinished = true;
} else if (args[i] == QLatin1String("-sort-contexts")) {
cd.m_sortContexts = 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);
//.........这里部分代码省略.........
示例14: main
int main(int argc, char **argv)
{
#ifdef QT_BOOTSTRAPPED
initBinaryDir(
#ifndef Q_OS_WIN
argv[0]
#endif
);
#else
QCoreApplication app(argc, argv);
#ifndef Q_OS_WIN32
QTranslator translator;
QTranslator qtTranslator;
QString sysLocale = QLocale::system().name();
QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)
&& qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
app.installTranslator(&translator);
app.installTranslator(&qtTranslator);
}
#endif // Q_OS_WIN32
#endif // QT_BOOTSTRAPPED
ConversionData cd;
cd.m_verbose = true; // the default is true starting with Qt 4.2
bool removeIdentical = false;
Translator tor;
QStringList inputFiles;
QString outputFile;
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "-compress")) {
cd.m_saveMode = SaveStripped;
continue;
} else if (!strcmp(argv[i], "-idbased")) {
cd.m_idBased = true;
continue;
} else if (!strcmp(argv[i], "-nocompress")) {
cd.m_saveMode = SaveEverything;
continue;
} else if (!strcmp(argv[i], "-removeidentical")) {
removeIdentical = true;
continue;
} else if (!strcmp(argv[i], "-nounfinished")) {
cd.m_ignoreUnfinished = true;
continue;
} else if (!strcmp(argv[i], "-markuntranslated")) {
if (i == argc - 1) {
printUsage();
return 1;
}
cd.m_unTrPrefix = QString::fromLocal8Bit(argv[++i]);
} else if (!strcmp(argv[i], "-silent")) {
cd.m_verbose = false;
continue;
} else if (!strcmp(argv[i], "-verbose")) {
cd.m_verbose = true;
continue;
} else if (!strcmp(argv[i], "-version")) {
printOut(LR::tr("lrelease version %1\n").arg(QLatin1String(QT_VERSION_STR)));
return 0;
} else if (!strcmp(argv[i], "-qm")) {
if (i == argc - 1) {
printUsage();
return 1;
}
outputFile = QString::fromLocal8Bit(argv[++i]);
} else if (!strcmp(argv[i], "-help")) {
printUsage();
return 0;
} else if (argv[i][0] == '-') {
printUsage();
return 1;
} else {
inputFiles << QString::fromLocal8Bit(argv[i]);
}
}
if (inputFiles.isEmpty()) {
printUsage();
return 1;
}
foreach (const QString &inputFile, inputFiles) {
if (inputFile.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive)
|| inputFile.endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) {
QFileInfo fi(inputFile);
parseHandler.verbose = evalHandler.verbose = cd.isVerbose();
ProFileOption option;
#ifdef QT_BOOTSTRAPPED
option.initProperties(binDir + QLatin1String("/qmake"));
#else
option.initProperties(app.applicationDirPath() + QLatin1String("/qmake"));
#endif
ProFileParser parser(0, &parseHandler);
ProFileEvaluator visitor(&option, &parser, &evalHandler);
ProFile *pro;
if (!(pro = parser.parsedProFile(QDir::cleanPath(fi.absoluteFilePath())))) {
//.........这里部分代码省略.........
示例15: main
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
#ifndef Q_OS_WIN32
QTranslator translator;
QTranslator qtTranslator;
QString sysLocale = QLocale::system().name();
QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)
&& qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
app.installTranslator(&translator);
app.installTranslator(&qtTranslator);
}
#endif
ConversionData cd;
cd.m_verbose = true; // the default is true starting with Qt 4.2
bool removeIdentical = false;
Translator tor;
QStringList inputFiles;
QString outputFile;
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "-compress")) {
cd.m_saveMode = SaveStripped;
continue;
} else if (!strcmp(argv[i], "-idbased")) {
cd.m_idBased = true;
continue;
} else if (!strcmp(argv[i], "-nocompress")) {
cd.m_saveMode = SaveEverything;
continue;
} else if (!strcmp(argv[i], "-removeidentical")) {
removeIdentical = true;
continue;
} else if (!strcmp(argv[i], "-nounfinished")) {
cd.m_ignoreUnfinished = true;
continue;
} else if (!strcmp(argv[i], "-markuntranslated")) {
if (i == argc - 1) {
printUsage();
return 1;
}
cd.m_unTrPrefix = QString::fromLocal8Bit(argv[++i]);
} else if (!strcmp(argv[i], "-silent")) {
cd.m_verbose = false;
continue;
} else if (!strcmp(argv[i], "-verbose")) {
cd.m_verbose = true;
continue;
} else if (!strcmp(argv[i], "-version")) {
printOut(LR::tr("lrelease version %1\n").arg(QLatin1String(CS_VERSION_STR)));
return 0;
} else if (!strcmp(argv[i], "-qm")) {
if (i == argc - 1) {
printUsage();
return 1;
}
outputFile = QString::fromLocal8Bit(argv[++i]);
} else if (!strcmp(argv[i], "-help")) {
printUsage();
return 0;
} else if (argv[i][0] == '-') {
printUsage();
return 1;
} else {
inputFiles << QString::fromLocal8Bit(argv[i]);
}
}
if (inputFiles.isEmpty()) {
printUsage();
return 1;
}
foreach (const QString &inputFile, inputFiles) {
if (outputFile.isEmpty()) {
if (!releaseTsFile(inputFile, cd, removeIdentical))
return 1;
} else {
if (!loadTsFile(tor, inputFile, cd.isVerbose()))
return 1;
}
}
if (!outputFile.isEmpty())
return releaseTranslator(tor, outputFile, cd, removeIdentical) ? 0 : 1;
return 0;
}