Exemplo n.º 1
0
 TemplateInfoList()
 {
     QMultiMap<QString, TemplateInfo> multiMap;
     foreach (const QString &templateName, templateNames()) {
         const QString templatePath = templateRootDirectory() + templateName;
         QFile xmlFile(templatePath + QLatin1String("/template.xml"));
         if (!xmlFile.open(QIODevice::ReadOnly)) {
             qWarning().nospace() << QString::fromLatin1("Cannot open %1").arg(QDir::toNativeSeparators(QFileInfo(xmlFile.fileName()).absoluteFilePath()));
             continue;
         }
         TemplateInfo info;
         info.templateName = templateName;
         info.templatePath = templatePath;
         QXmlStreamReader reader(&xmlFile);
         if (parseTemplateXml(reader, &info))
             multiMap.insert(info.priority, info);
     }
     m_templateInfoList = multiMap.values();
 }
Exemplo n.º 2
0
QList<TemplateInfo> QmlApp::templateInfos()
{
    QList<TemplateInfo> result;
    foreach (const QString &templateName, templateNames()) {
        const QString templatePath = templateRootDirectory() + templateName;
        QFile xmlFile(templatePath + QLatin1String("/template.xml"));
        if (!xmlFile.open(QIODevice::ReadOnly)) {
            qWarning().nospace() << QString::fromLatin1("Cannot open %1").arg(QDir::toNativeSeparators(QFileInfo(xmlFile.fileName()).absoluteFilePath()));
            continue;
        }
        TemplateInfo info;
        info.templateName = templateName;
        info.templatePath = templatePath;
        QXmlStreamReader reader(&xmlFile);
        if (parseTemplateXml(reader, &info))
            result.append(info);
    }
    return result;
}