Commit adc58b04 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

refactoring (from qt)

parent bed8c719
......@@ -1765,28 +1765,13 @@ void ProFileEvaluator::setVerbose(bool on)
d->m_verbose = on;
}
bool evaluateProFile(const QString &fileName, bool verbose, QHash<QByteArray, QStringList> *varMap)
void evaluateProFile(const ProFileEvaluator &visitor, QHash<QByteArray, QStringList> *varMap)
{
QStringList sourceFiles;
QString codecForTr;
QString codecForSource;
QStringList tsFileNames;
QFileInfo fi(fileName);
if (!fi.exists())
return false;
ProFile pro(fi.absoluteFilePath());
ProFileEvaluator visitor;
visitor.setVerbose(verbose);
if (!visitor.queryProFile(&pro))
return false;
if (!visitor.accept(&pro))
return false;
// app/lib template
sourceFiles += visitor.values(QLatin1String("SOURCES"));
sourceFiles += visitor.values(QLatin1String("HEADERS"));
......@@ -1823,6 +1808,27 @@ bool evaluateProFile(const QString &fileName, bool verbose, QHash<QByteArray, QS
varMap->insert("CODECFORTR", QStringList() << codecForTr);
varMap->insert("CODECFORSRC", QStringList() << codecForSource);
varMap->insert("TRANSLATIONS", tsFileNames);
}
bool evaluateProFile(const QString &fileName, bool verbose, QHash<QByteArray, QStringList> *varMap)
{
QFileInfo fi(fileName);
if (!fi.exists())
return false;
ProFile pro(fi.absoluteFilePath());
ProFileEvaluator visitor;
visitor.setVerbose(verbose);
if (!visitor.queryProFile(&pro))
return false;
if (!visitor.accept(&pro))
return false;
evaluateProFile(visitor, varMap);
return true;
}
......
......@@ -45,7 +45,9 @@
QT_BEGIN_NAMESPACE
class ProFile;
class ProFileEvaluator;
void evaluateProFile(const ProFileEvaluator &visitor, QHash<QByteArray, QStringList> *varMap);
bool evaluateProFile(const QString &fileName, bool verbose, QHash<QByteArray, QStringList> *varMap);
class ProFileEvaluator
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment