void MainWindow::on_actionNouveau_triggered()
{
    cont_->setFilePath("");
    if (cont_->getFileModified_()){
        askSaveFile();
    }
    QDir templateDirectory(cont_->getTemplateDirectory());
    QStringList filters;
    filters << "*.ulk";
    templateDirectory.setNameFilters(filters);
    if(NULL != newList_)
    {
        delete newList_;
    }
    newList_ = new NewList(boutonAnnulerActif_, templateDirectory.entryList(), this);
    newList_->show();
    QObject::connect(newList_,SIGNAL(createList(QString, bool, QString, QDateTime)),this,SLOT(createList(QString, bool, QString, QDateTime)));
    boutonAnnulerActif_ = true;
}
Exemple #2
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;
}