OSDN Git Service

Implement adding new project into opened subdirs project
authorJarek Kobus <jkobus@trolltech.com>
Thu, 26 Aug 2010 16:33:16 +0000 (18:33 +0200)
committerJarek Kobus <jkobus@trolltech.com>
Thu, 26 Aug 2010 16:35:05 +0000 (18:35 +0200)
Reviewed-by: dt <qtc-committer@nokia.com>
30 files changed:
src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp
src/plugins/cmakeprojectmanager/cmakeprojectnodes.h
src/plugins/coreplugin/basefilewizard.cpp
src/plugins/coreplugin/basefilewizard.h
src/plugins/coreplugin/ifilewizardextension.h
src/plugins/genericprojectmanager/genericprojectnodes.cpp
src/plugins/genericprojectmanager/genericprojectnodes.h
src/plugins/genericprojectmanager/genericprojectwizard.cpp
src/plugins/genericprojectmanager/genericprojectwizard.h
src/plugins/projectexplorer/customwizard/customwizard.cpp
src/plugins/projectexplorer/customwizard/customwizard.h
src/plugins/projectexplorer/projectfilewizardextension.cpp
src/plugins/projectexplorer/projectfilewizardextension.h
src/plugins/projectexplorer/projectnodes.h
src/plugins/qmlprojectmanager/qmlprojectnodes.cpp
src/plugins/qmlprojectmanager/qmlprojectnodes.h
src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.cpp
src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.h
src/plugins/qt4projectmanager/qt4nodes.cpp
src/plugins/qt4projectmanager/qt4nodes.h
src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp
src/plugins/qt4projectmanager/wizards/consoleappwizard.h
src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp
src/plugins/qt4projectmanager/wizards/emptyprojectwizard.h
src/plugins/qt4projectmanager/wizards/guiappwizard.cpp
src/plugins/qt4projectmanager/wizards/guiappwizard.h
src/plugins/qt4projectmanager/wizards/librarywizard.cpp
src/plugins/qt4projectmanager/wizards/librarywizard.h
src/plugins/qt4projectmanager/wizards/testwizard.cpp
src/plugins/qt4projectmanager/wizards/testwizard.h

index 6659d96..356c6fc 100644 (file)
@@ -49,6 +49,12 @@ QList<ProjectExplorer::ProjectNode::ProjectAction> CMakeProjectNode::supportedAc
     return QList<ProjectAction>();
 }
 
+bool CMakeProjectNode::canAddSubProject(const QString &proFilePath) const
+{
+    Q_UNUSED(proFilePath)
+    return false;
+}
+
 bool CMakeProjectNode::addSubProjects(const QStringList &proFilePaths)
 {
     Q_UNUSED(proFilePaths)
index eb96a46..2ba10e4 100644 (file)
@@ -43,6 +43,9 @@ public:
     CMakeProjectNode(const QString &fileName);
     virtual bool hasBuildTargets() const;
     virtual QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const;
+
+    virtual bool canAddSubProject(const QString &proFilePath) const;
+
     virtual bool addSubProjects(const QStringList &proFilePaths);
     virtual bool removeSubProjects(const QStringList &proFilePaths);
     virtual bool addFiles(const ProjectExplorer::FileType fileType,
index 14d7b21..9ab88b1 100644 (file)
@@ -530,7 +530,7 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
         }
         if (firstExtensionPageHit)
             foreach (IFileWizardExtension *ex, extensions)
-                ex->firstExtensionPageShown(files);
+                ex->firstExtensionPageShown(files, generatedProjectFilePath(wizard.data()));
         if (accepted)
             break;
     }
@@ -558,12 +558,23 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
             return QStringList();
         }
     }
+    bool removeOpenProjectAttribute = false;
     // Run the extensions
-    foreach (IFileWizardExtension *ex, extensions)
-        if (!ex->process(files, &errorMessage)) {
+    foreach (IFileWizardExtension *ex, extensions) {
+        bool remove;
+        if (!ex->process(files, generatedProjectFilePath(wizard.data()), &remove, &errorMessage)) {
             QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage);
             return QStringList();
         }
+        removeOpenProjectAttribute |= remove;
+    }
+
+    if (removeOpenProjectAttribute) {
+        for (int i = 0; i < files.count(); i++) {
+            if (files[i].attributes() & Core::GeneratedFile::OpenProjectAttribute)
+                files[i].setAttributes(Core::GeneratedFile::OpenEditorAttribute);
+        }
+    }
 
     // Post generation handler
     if (!postGenerateFiles(wizard.data(), files, &errorMessage)) {
@@ -596,6 +607,12 @@ void BaseFileWizard::applyExtensionPageShortTitle(Utils::Wizard *wizard, int pag
       item->setTitle(shortTitle);
 }
 
+QString BaseFileWizard::generatedProjectFilePath(const QWizard *wizard) const
+{
+    Q_UNUSED(wizard)
+    return QString();
+}
+
 bool BaseFileWizard::postGenerateFiles(const QWizard *, const GeneratedFiles &l, QString *errorMessage)
 {
     return BaseFileWizard::postGenerateOpenEditors(l, errorMessage);
index e1f5a36..ac094be 100644 (file)
@@ -200,6 +200,9 @@ protected:
     virtual GeneratedFiles generateFiles(const QWizard *w,
                                          QString *errorMessage) const = 0;
 
+    // Overwrite for ProjectWizard kind and return the path to the generated project file
+    virtual QString generatedProjectFilePath(const QWizard *wizard) const;
+
     /* Overwrite to perform steps to be done after files are actually created.
      * The default implementation opens editors with the newly generated files. */
     virtual bool postGenerateFiles(const QWizard *w, const GeneratedFiles &l, QString *errorMessage);
index 237cf59..18172f5 100644 (file)
@@ -57,11 +57,18 @@ public:
     virtual QList<QWizardPage *> extensionPages(const IWizard *wizard) = 0;
 
     /* Process the files using the extension parameters */
-    virtual bool process(const QList<GeneratedFile> &files, QString *errorMessage) = 0;
+    virtual bool process(const QList<GeneratedFile> &files,
+                         const QString &generatedProjectFilePath,
+                         bool *removeOpenProjectAttribute,
+                         QString *errorMessage) = 0;
 
 public slots:
     /* Notification about the first extension page being shown. */
-    virtual void firstExtensionPageShown(const QList<GeneratedFile> &) {}
+    virtual void firstExtensionPageShown(const QList<GeneratedFile> &files,
+                                         const QString &generatedProjectFilePath) {
+        Q_UNUSED(files)
+        Q_UNUSED(generatedProjectFilePath)
+        }
 };
 
 } // namespace Core
index 61e43a8..beda4a3 100644 (file)
@@ -179,6 +179,12 @@ QList<ProjectExplorer::ProjectNode::ProjectAction> GenericProjectNode::supported
         << RemoveFile;
 }
 
+bool GenericProjectNode::canAddSubProject(const QString &proFilePath) const
+{
+    Q_UNUSED(proFilePath)
+    return false;
+}
+
 bool GenericProjectNode::addSubProjects(const QStringList &proFilePaths)
 {
     Q_UNUSED(proFilePaths)
index edca4e2..89a4a09 100644 (file)
@@ -57,6 +57,8 @@ public:
 
     virtual QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const;
 
+    virtual bool canAddSubProject(const QString &proFilePath) const;
+
     virtual bool addSubProjects(const QStringList &proFilePaths);
     virtual bool removeSubProjects(const QStringList &proFilePaths);
 
index b7f184e..6f53486 100644 (file)
@@ -231,6 +231,17 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
     return files;
 }
 
+QString GenericProjectWizard::generatedProjectFilePath(const QWizard *w) const
+{
+    const GenericProjectWizardDialog *wizard = qobject_cast<const GenericProjectWizardDialog *>(w);
+    const QString projectPath = wizard->path();
+    const QDir dir(projectPath);
+    const QString projectName = wizard->projectName();
+    const QString creatorFileName = QFileInfo(dir, projectName + QLatin1String(".creator")).absoluteFilePath();
+
+    return creatorFileName;
+}
+
 bool GenericProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
 {
     Q_UNUSED(w);
index 833d89e..9925e92 100644 (file)
@@ -81,6 +81,8 @@ protected:
     virtual Core::GeneratedFiles generateFiles(const QWizard *w,
                                                QString *errorMessage) const;
 
+    virtual QString generatedProjectFilePath(const QWizard *w) const;
+
     virtual bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
 
     bool isValidDir(const QFileInfo &fileInfo) const;
index 34870de..98f2eff 100644 (file)
@@ -451,6 +451,25 @@ bool CustomProjectWizard::postGenerateOpen(const Core::GeneratedFiles &l, QStrin
     return BaseFileWizard::postGenerateOpenEditors(l, errorMessage);
 }
 
+QString CustomProjectWizard::generatedProjectFilePath(const QWizard *wizard) const
+{
+    const BaseProjectWizardDialog *dialog = qobject_cast<const BaseProjectWizardDialog *>(wizard);
+    QTC_ASSERT(dialog, return QString())
+    const QString targetPath = dialog->path() + QLatin1Char('/') + dialog->projectName();
+    const QChar slash =  QLatin1Char('/');
+    // take the first from parameters()->files list which have cwFile.openProject set
+    foreach(const Internal::CustomWizardFile &file, parameters()->files) {
+        if (file.openProject) {
+            FieldReplacementMap fieldReplacementMap = replacementMap(dialog);
+            fieldReplacementMap.insert(QLatin1String("ProjectName"), dialog->projectName());
+            QString target = file.target;
+            Internal::CustomWizardContext::replaceFields(fieldReplacementMap, &target);
+            return QDir::toNativeSeparators(targetPath + slash + target);
+        }
+    }
+    return QString();
+}
+
 bool CustomProjectWizard::postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage)
 {
     if (CustomWizardPrivate::verbose)
index 5197004..2df8bda 100644 (file)
@@ -162,6 +162,7 @@ signals:
     void projectLocationChanged(const QString &path);
 
 protected:
+    QString generatedProjectFilePath(const QWizard *wizard) const;
     virtual bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
 
     void initProjectWizardDialog(BaseProjectWizardDialog *w, const QString &defaultPath,
index a432e5c..5ff438b 100644 (file)
@@ -38,7 +38,6 @@
 #include <utils/stringutils.h>
 
 #include <coreplugin/basefilewizard.h>
-#include <coreplugin/dialogs/iwizard.h>
 #include <coreplugin/filemanager.h>
 #include <coreplugin/icore.h>
 #include <coreplugin/iversioncontrol.h>
@@ -156,11 +155,13 @@ struct ProjectWizardContext
     ProjectWizardPage *page;
     bool repositoryExists; // Is VCS 'add' sufficient, or should a repository be created?
     QString commonDirectory;
+    const Core::IWizard *wizard;
 };
 
 ProjectWizardContext::ProjectWizardContext() :
     page(0),
-    repositoryExists(false)
+    repositoryExists(false),
+    wizard(0)
 {
 }
 
@@ -171,6 +172,7 @@ void ProjectWizardContext::clear()
     commonDirectory.clear();
     page = 0;
     repositoryExists = false;
+    wizard = 0;
 }
 
 // ---- ProjectFileWizardExtension
@@ -222,8 +224,12 @@ static int findMatchingProject(const QList<ProjectEntry> &projects,
     return bestMatch;
 }
 
-void ProjectFileWizardExtension::firstExtensionPageShown(const QList<Core::GeneratedFile> &files)
+void ProjectFileWizardExtension::firstExtensionPageShown(
+        const QList<Core::GeneratedFile> &files,
+        const QString &generatedProjectFilePath)
 {
+    initProjectChoices(generatedProjectFilePath);
+
     if (debugExtension)
         qDebug() << Q_FUNC_INFO << files.size();
     // Parametrize wizard page: find best project to add to, set up files display and
@@ -307,13 +313,11 @@ QList<QWizardPage *> ProjectFileWizardExtension::extensionPages(const Core::IWiz
     }
     // Init context with page and projects
     m_context->page = new ProjectWizardPage;
-    // Project list remains the same over duration of wizard execution
-    // Note that projects cannot be added to projects.
-    initProjectChoices(wizard->kind() != Core::IWizard::ProjectWizard);
+    m_context->wizard = wizard;
     return QList<QWizardPage *>() << m_context->page;
 }
 
-void ProjectFileWizardExtension::initProjectChoices(bool enabled)
+void ProjectFileWizardExtension::initProjectChoices(const QString &generatedProjectFilePath)
 {
     // Set up project list which remains the same over duration of wizard execution
     // As tooltip, set the directory for disambiguation (should someone have
@@ -321,56 +325,84 @@ void ProjectFileWizardExtension::initProjectChoices(bool enabled)
     //: No project selected
     QStringList projectChoices(tr("<None>"));
     QStringList projectToolTips((QString()));
-    if (enabled) {
-        typedef QMap<ProjectEntry, bool> ProjectEntryMap;
-        // Sort by base name and purge duplicated entries (resulting from dependencies)
-        // via Map.
-        ProjectEntryMap entryMap;
 
-        foreach(ProjectNode *n, AllProjectNodesVisitor::allProjects(ProjectNode::AddNewFile))
+    typedef QMap<ProjectEntry, bool> ProjectEntryMap;
+    // Sort by base name and purge duplicated entries (resulting from dependencies)
+    // via Map.
+    ProjectEntryMap entryMap;
+
+    ProjectNode::ProjectAction projectAction =
+            m_context->wizard->kind() == Core::IWizard::ProjectWizard
+            ? ProjectNode::AddSubProject : ProjectNode::AddNewFile;
+    foreach(ProjectNode *n, AllProjectNodesVisitor::allProjects(projectAction)) {
+        if (projectAction == ProjectNode::AddNewFile
+                || (projectAction == ProjectNode::AddSubProject
+                && n->canAddSubProject(generatedProjectFilePath)))
             entryMap.insert(ProjectEntry(n), true);
-        // Collect names
-        const ProjectEntryMap::const_iterator cend = entryMap.constEnd();
-        for (ProjectEntryMap::const_iterator it = entryMap.constBegin(); it != cend; ++it) {
-            m_context->projects.push_back(it.key());
-            projectChoices.push_back(it.key().fileName);
-            projectToolTips.push_back(it.key().nativeDirectory);
-        }
     }
+
+    m_context->projects.clear();
+
+    // Collect names
+    const ProjectEntryMap::const_iterator cend = entryMap.constEnd();
+    for (ProjectEntryMap::const_iterator it = entryMap.constBegin(); it != cend; ++it) {
+        m_context->projects.push_back(it.key());
+        projectChoices.push_back(it.key().fileName);
+        projectToolTips.push_back(it.key().nativeDirectory);
+    }
+
     m_context->page->setProjects(projectChoices);
     m_context->page->setProjectToolTips(projectToolTips);
 }
 
-bool ProjectFileWizardExtension::process(const QList<Core::GeneratedFile> &files, QString *errorMessage)
+bool ProjectFileWizardExtension::process(
+        const QList<Core::GeneratedFile> &files,
+        const QString &generatedProjectFilePath,
+        bool *removeOpenProjectAttribute, QString *errorMessage)
 {
-    return processProject(files, errorMessage) &&
+    return processProject(files, generatedProjectFilePath,
+                          removeOpenProjectAttribute, errorMessage) &&
            processVersionControl(files, errorMessage);
 }
 
 // Add files to project && version control
-bool ProjectFileWizardExtension::processProject(const QList<Core::GeneratedFile> &files, QString *errorMessage)
+bool ProjectFileWizardExtension::processProject(
+        const QList<Core::GeneratedFile> &files,
+        const QString &generatedProjectFilePath,
+        bool *removeOpenProjectAttribute, QString *errorMessage)
 {
     typedef QMultiMap<FileType, QString> TypeFileMap;
 
+    *removeOpenProjectAttribute = false;
+
     // Add files to  project (Entry at 0 is 'None').
     const int projectIndex = m_context->page->currentProjectIndex() - 1;
     if (projectIndex < 0 || projectIndex >= m_context->projects.size())
         return true;
     ProjectNode *project = m_context->projects.at(projectIndex).node;
-    // Split into lists by file type and bulk-add them.
-    TypeFileMap typeFileMap;
-    const Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase();
-    foreach (const Core::GeneratedFile &generatedFile, files) {
-        const QString path = generatedFile.path();
-        typeFileMap.insert(typeForFileName(mdb, path), path);
-    }
-    foreach (FileType type, typeFileMap.uniqueKeys()) {
-        const QStringList typeFiles = typeFileMap.values(type);
-        if (!project->addFiles(type, typeFiles)) {
-            *errorMessage = tr("Failed to add one or more files to project\n'%1' (%2).").
-                            arg(project->path(), typeFiles.join(QString(QLatin1Char(','))));
+    if (m_context->wizard->kind() == Core::IWizard::ProjectWizard) {
+        if (!project->addSubProjects(QStringList(generatedProjectFilePath))) {
+            *errorMessage = tr("Failed to add subproject '%1'\nto project '%2'.")
+                            .arg(generatedProjectFilePath).arg(project->path());
             return false;
         }
+        *removeOpenProjectAttribute = true;
+    } else {
+        // Split into lists by file type and bulk-add them.
+        TypeFileMap typeFileMap;
+        const Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase();
+        foreach (const Core::GeneratedFile &generatedFile, files) {
+            const QString path = generatedFile.path();
+            typeFileMap.insert(typeForFileName(mdb, path), path);
+        }
+        foreach (FileType type, typeFileMap.uniqueKeys()) {
+            const QStringList typeFiles = typeFileMap.values(type);
+            if (!project->addFiles(type, typeFiles)) {
+                *errorMessage = tr("Failed to add one or more files to project\n'%1' (%2).").
+                                arg(project->path(), typeFiles.join(QString(QLatin1Char(','))));
+                return false;
+            }
+        }
     }
     return true;
 }
index d7ba722..5c9dbe0 100644 (file)
@@ -50,15 +50,20 @@ public:
     virtual ~ProjectFileWizardExtension();
 
     virtual QList<QWizardPage *> extensionPages(const Core::IWizard *wizard);
-    virtual bool process(const QList<Core::GeneratedFile> &files, QString *errorMessage);
+    virtual bool process(const QList<Core::GeneratedFile> &files,
+                         const QString &generatedProjectFilePath,
+                         bool *removeOpenProjectAttribute, QString *errorMessage);
 
 public slots:
-    virtual void firstExtensionPageShown(const QList<Core::GeneratedFile> &);
+    virtual void firstExtensionPageShown(const QList<Core::GeneratedFile> &files,
+                                         const QString &generatedProjectFilePath);
 
 private:
-    void initProjectChoices(bool enabled);
+    void initProjectChoices(const QString &generatedProjectFilePath);
     void initializeVersionControlChoices();
-    bool processProject(const QList<Core::GeneratedFile> &files, QString *errorMessage);
+    bool processProject(const QList<Core::GeneratedFile> &files,
+                        const QString &generatedProjectFilePath,
+                        bool *removeOpenProjectAttribute, QString *errorMessage);
     bool processVersionControl(const QList<Core::GeneratedFile> &files, QString *errorMessage);
 
     ProjectWizardContext *m_context;
index 1545f33..62a7f29 100644 (file)
@@ -182,6 +182,8 @@ public:
 
     virtual QList<ProjectAction> supportedActions(Node *node) const = 0;
 
+    virtual bool canAddSubProject(const QString &proFilePath) const = 0;
+
     virtual bool addSubProjects(const QStringList &proFilePaths) = 0;
 
     virtual bool removeSubProjects(const QStringList &proFilePaths) = 0;
index 2be16f0..021c55d 100644 (file)
@@ -180,6 +180,12 @@ QList<ProjectExplorer::ProjectNode::ProjectAction> QmlProjectNode::supportedActi
     return actions;
 }
 
+bool QmlProjectNode::canAddSubProject(const QString &proFilePath) const
+{
+    Q_UNUSED(proFilePath)
+    return false;
+}
+
 bool QmlProjectNode::addSubProjects(const QStringList &proFilePaths)
 {
     Q_UNUSED(proFilePaths)
index 8413e93..2b6f7dc 100644 (file)
@@ -58,6 +58,8 @@ public:
 
     virtual QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const;
 
+    virtual bool canAddSubProject(const QString &proFilePath) const;
+
     virtual bool addSubProjects(const QStringList &proFilePaths);
     virtual bool removeSubProjects(const QStringList &proFilePaths);
 
index c59d5f3..db7e72b 100644 (file)
@@ -75,5 +75,16 @@ Core::GeneratedFiles CustomWidgetWizard::generateFiles(const QWizard *w,
     return PluginGenerator::generatePlugin(p, *(cw->pluginOptions()), errorMessage);
 }
 
+QString CustomWidgetWizard::generatedProjectFilePath(const QWizard *w) const
+{
+    const CustomWidgetWizardDialog *cw = qobject_cast<const CustomWidgetWizardDialog *>(w);
+    const QChar slash = QLatin1Char('/');
+    QString baseDir = cw->path();
+    baseDir += slash;
+    baseDir += cw->projectName();
+    baseDir += slash;
+    return baseDir + cw->projectName() + QLatin1String(".pro");
+}
+
 } // namespace Internal
 } // namespace Qt4ProjectManager
index c458575..0762774 100644 (file)
@@ -49,6 +49,8 @@ protected:
 
     virtual Core::GeneratedFiles generateFiles(const QWizard *w,
                                                QString *errorMessage) const;
+
+    virtual QString generatedProjectFilePath(const QWizard *w) const;
 };
 
 } // namespace Internal
index 343a44a..be01abe 100644 (file)
@@ -771,10 +771,39 @@ QList<ProjectNode::ProjectAction> Qt4PriFileNode::supportedActions(Node *node) c
     return actions;
 }
 
+bool Qt4PriFileNode::canAddSubProject(const QString &proFilePath) const
+{
+    QFileInfo fi(proFilePath);
+    if (fi.suffix() == QLatin1String("pro")
+        || fi.suffix() == QLatin1String("pri"))
+        return true;
+    return false;
+}
+
 bool Qt4PriFileNode::addSubProjects(const QStringList &proFilePaths)
 {
-    Q_UNUSED(proFilePaths)
-    return false; //changeIncludes(m_includeFile, proFilePaths, AddToProFile);
+    ProjectExplorer::FindAllFilesVisitor visitor;
+    accept(&visitor);
+    const QStringList &allFiles = visitor.filePaths();
+
+    QStringList uniqueProFilePaths;
+    foreach (const QString &proFile, proFilePaths) {
+        if (!allFiles.contains(proFile)) {
+            // if proFilePath is like: _path_/projectName/projectName.pro
+            // we simplify it to: _path_/projectName
+            QString proFilePath = proFile;
+            QFileInfo fi(proFile);
+            QFileInfo parentFi(fi.absolutePath());
+            if (parentFi.fileName() == fi.baseName())
+                proFilePath = parentFi.absoluteFilePath();
+            uniqueProFilePaths.append(proFilePath);
+        }
+    }
+
+    QStringList failedFiles;
+    changeFiles(ProjectExplorer::ProjectFileType, uniqueProFilePaths, &failedFiles, AddToProFile);
+
+    return failedFiles.isEmpty();
 }
 
 bool Qt4PriFileNode::removeSubProjects(const QStringList &proFilePaths)
@@ -1085,6 +1114,9 @@ QStringList Qt4PriFileNode::varNames(ProjectExplorer::FileType type)
     case ProjectExplorer::FormType:
         vars << QLatin1String("FORMS");
         break;
+    case ProjectExplorer::ProjectFileType:
+        vars << QLatin1String("SUBDIRS");
+        break;
     case ProjectExplorer::QMLType:
         break;
     default:
index 001c45c..371de84 100644 (file)
@@ -140,6 +140,8 @@ public:
 
     bool hasBuildTargets() const { return false; }
 
+    bool canAddSubProject(const QString &proFilePath) const;
+
     bool addSubProjects(const QStringList &proFilePaths);
     bool removeSubProjects(const QStringList &proFilePaths);
 
index fa8dc63..091d49e 100644 (file)
@@ -104,5 +104,14 @@ Core::GeneratedFiles
     return Core::GeneratedFiles() <<  source << profile;
 }
 
+QString ConsoleAppWizard::generatedProjectFilePath(const QWizard *w) const
+{
+    const ConsoleAppWizardDialog *wizard = qobject_cast< const ConsoleAppWizardDialog *>(w);
+    const QtProjectParameters params = wizard->parameters();
+    const QString projectPath = params.projectPath();
+
+    return Core::BaseFileWizard::buildFileName(projectPath, params.fileName, profileSuffix());
+}
+
 } // namespace Internal
 } // namespace Qt4ProjectManager
index de21cda..9ad1471 100644 (file)
@@ -51,6 +51,8 @@ protected:
 
     virtual Core::GeneratedFiles generateFiles(const QWizard *w,
                                                QString *errorMessage) const;
+
+    QString generatedProjectFilePath(const QWizard *w) const;
 };
 
 } // namespace Internal
index 63cbf6f..f5367d8 100644 (file)
@@ -74,5 +74,13 @@ Core::GeneratedFiles
     return Core::GeneratedFiles() << profile;
 }
 
+QString EmptyProjectWizard::generatedProjectFilePath(const QWizard *w) const
+{
+    const EmptyProjectWizardDialog *wizard = qobject_cast< const EmptyProjectWizardDialog *>(w);
+    const QtProjectParameters params = wizard->parameters();
+    const QString projectPath = params.projectPath();
+    return Core::BaseFileWizard::buildFileName(projectPath, params.fileName, profileSuffix());
+}
+
 } // namespace Internal
 } // namespace Qt4ProjectManager
index 038b47a..d951046 100644 (file)
@@ -49,6 +49,8 @@ protected:
 
     virtual Core::GeneratedFiles generateFiles(const QWizard *w,
                                                QString *errorMessage) const;
+
+    QString generatedProjectFilePath(const QWizard *w) const;
 };
 
 } // namespace Internal
index 24e6344..1b755b7 100644 (file)
@@ -237,6 +237,15 @@ Core::GeneratedFiles GuiAppWizard::generateFiles(const QWizard *w,
     return rc;
 }
 
+QString GuiAppWizard::generatedProjectFilePath(const QWizard *w) const
+{
+    const GuiAppWizardDialog *dialog = qobject_cast<const GuiAppWizardDialog *>(w);
+    const QtProjectParameters projectParams = dialog->projectParameters();
+    const QString projectPath = projectParams.projectPath();
+
+    return buildFileName(projectPath, projectParams.fileName, profileSuffix());
+}
+
 bool GuiAppWizard::parametrizeTemplate(const QString &templatePath, const QString &templateName,
                                        const GuiAppParameters &params,
                                        QString *target, QString *errorMessage)
index ae47a4c..4432ecd 100644 (file)
@@ -61,6 +61,8 @@ protected:
     virtual Core::GeneratedFiles generateFiles(const QWizard *w,
                                                QString *errorMessage) const;
 
+    QString generatedProjectFilePath(const QWizard *w) const;
+
 private:
     static bool parametrizeTemplate(const QString &templatePath, const QString &templateName,
                                     const GuiAppParameters &params,
index e86de20..1c6e877 100644 (file)
@@ -137,5 +137,15 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w,
     return rc;
 }
 
+QString LibraryWizard::generatedProjectFilePath(const QWizard *w) const
+{
+    const LibraryWizardDialog *dialog = qobject_cast<const LibraryWizardDialog *>(w);
+    const QtProjectParameters projectParams = dialog->parameters();
+    const QString projectPath = projectParams.projectPath();
+
+    return buildFileName(projectPath, projectParams.fileName, profileSuffix());
+}
+
+
 } // namespace Internal
 } // namespace Qt4ProjectManager
index b0c1d86..9ce0228 100644 (file)
@@ -54,6 +54,8 @@ protected:
     virtual Core::GeneratedFiles generateFiles(const QWizard *w,
                                                QString *errorMessage) const;
 
+
+    QString generatedProjectFilePath(const QWizard *w) const;
 };
 
 } // namespace Internal
index a493270..7d38283 100644 (file)
@@ -184,5 +184,14 @@ Core::GeneratedFiles TestWizard::generateFiles(const QWizard *w, QString *errorM
     return Core::GeneratedFiles() <<  source << profile;
 }
 
+QString TestWizard::generatedProjectFilePath(const QWizard *w) const
+{
+    const TestWizardDialog *wizardDialog = qobject_cast<const TestWizardDialog *>(w);
+    const QtProjectParameters projectParams = wizardDialog->projectParameters();
+    const QString projectPath = projectParams.projectPath();
+
+    return buildFileName(projectPath, projectParams.fileName, profileSuffix());
+}
+
 } // namespace Internal
 } // namespace Qt4ProjectManager
index 71a9bb2..16aa5d8 100644 (file)
@@ -50,6 +50,7 @@ protected:
     virtual Core::GeneratedFiles generateFiles(const QWizard *w,
                                                QString *errorMessage) const;
 
+    QString generatedProjectFilePath(const QWizard *w) const;
 signals:
 
 public slots: