Core::GeneratedFiles Html5App::generateFiles(QString *errorMessage) const
{
    Core::GeneratedFiles files = AbstractMobileApp::generateFiles(errorMessage);
    if (m_mainHtmlMode == ModeGenerate) {
        files.append(file(generateFile(Html5AppGeneratedFileInfo::MainHtmlFile, errorMessage), path(MainHtml)));
        files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute);
    }

    files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)));
    files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)));
    files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH)));

    return files;
}
Core::GeneratedFiles QtQuickApp::generateFiles(QString *errorMessage) const
{
    Core::GeneratedFiles files = AbstractMobileApp::generateFiles(errorMessage);
    if (!useExistingMainQml()) {
        files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainQmlFile, errorMessage), path(MainQml)));
        if ((componentSet() == QtQuickApp::Meego10Components))
            files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainPageQmlFile, errorMessage), path(MainPageQml)));
        files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute);
    }

    files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)));
    files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)));
    files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH)));

    return files;
}
Exemple #3
0
Core::GeneratedFiles QmlApp::generateFiles(QString *errorMessage)
{

    Core::GeneratedFiles files;

    QTC_ASSERT(errorMessage, return files);

    errorMessage->clear();
    setReplacementVariables();
    const QFileInfoList templateFiles = allFilesRecursive(templateDirectory());

    foreach (const QFileInfo &templateFile, templateFiles) {
        const QString targetSubDirectory = templateFile.path().mid(templateDirectory().length());
        const QString targetDirectory = projectDirectory() + targetSubDirectory + QLatin1Char('/');

        QString targetFileName = templateFile.fileName();

        if (templateFile.fileName() == QLatin1String("main.pro")) {
            targetFileName = projectName() + QLatin1String(".pro");
            m_creatorFileName = Core::BaseFileWizard::buildFileName(projectDirectory(),
                                                                    projectName(),
                                                                    QLatin1String("pro"));
        } else  if (templateFile.fileName() == QLatin1String("main.qmlproject")) {
            targetFileName = projectName() + QLatin1String(".qmlproject");
            m_creatorFileName = Core::BaseFileWizard::buildFileName(projectDirectory(),
                                                                    projectName(),
                                                                    QLatin1String("qmlproject"));
        } else if (templateFile.fileName() == QLatin1String("main.qbp")) {
            targetFileName = projectName() + QLatin1String(".qbp");
        } else if (targetFileName == QLatin1String("template.xml")
                   || targetFileName == QLatin1String("template.png")) {
            continue;
        } else {
            targetFileName = renameQmlFile(templateFile.fileName());
        }

        if (binaryFiles().contains(templateFile.suffix())) {
            bool canAddBinaryFile = addBinaryFile(templateFile.absolutePath(),
                                                  templateFile.fileName(),
                                                  targetDirectory,
                                                  targetFileName,
                                                  &files,
                                                  errorMessage);
            if (!canAddBinaryFile)
                return Core::GeneratedFiles();
        } else {
            bool canAddTemplate = addTemplate(templateFile.absolutePath(),
                                              templateFile.fileName(),
                                              targetDirectory,
                                              targetFileName,
                                              &files,
                                              errorMessage);
            if (!canAddTemplate)
                return Core::GeneratedFiles();

            if (templateFile.fileName() == QLatin1String("main.pro")) {
                files.last().setAttributes(Core::GeneratedFile::OpenProjectAttribute);
            } else if (templateFile.fileName() == QLatin1String("main.qmlproject")) {
                files.last().setAttributes(Core::GeneratedFile::OpenProjectAttribute);
            } else if (templateFile.fileName() == m_templateInfo.openFile) {
                files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute);
            }
        }
    }

    return files;
}