forked from qt-creator/qt-creator
load the generated project.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
#include "genericprojectwizard.h"
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QtGui/QWizard>
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QtDebug>
|
||||
|
||||
using namespace GenericProjectManager::Internal;
|
||||
@@ -20,10 +23,11 @@ GenericProjectWizard::~GenericProjectWizard()
|
||||
Core::BaseFileWizardParameters GenericProjectWizard::parameters()
|
||||
{
|
||||
static Core::BaseFileWizardParameters parameters(ProjectWizard);
|
||||
parameters.setIcon(QIcon(":/wizards/images/console.png"));
|
||||
parameters.setName(tr("Existing Project"));
|
||||
parameters.setDescription(tr("Import Existing Project"));
|
||||
parameters.setCategory(QLatin1String("Import"));
|
||||
parameters.setTrCategory(tr("Import"));
|
||||
parameters.setCategory(QLatin1String("Projects"));
|
||||
parameters.setTrCategory(tr("Projects"));
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@@ -36,7 +40,7 @@ QWizard *GenericProjectWizard::createWizardDialog(QWidget *parent,
|
||||
setupWizard(wizard);
|
||||
|
||||
QWizardPage *firstPage = new QWizardPage;
|
||||
firstPage->setTitle(tr(""));
|
||||
firstPage->setTitle(tr("Project"));
|
||||
|
||||
QFormLayout *layout = new QFormLayout(firstPage);
|
||||
|
||||
@@ -56,7 +60,35 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const
|
||||
{
|
||||
PathChooser *pathChooser = w->findChild<PathChooser *>("pathChooser");
|
||||
const QString projectName = QFileInfo(pathChooser->path()).baseName() + QLatin1String(".creator");
|
||||
const QDir dir(pathChooser->path());
|
||||
|
||||
return Core::GeneratedFiles();
|
||||
// ### FIXME: use the mimetype database.
|
||||
// ### FIXME: import nested folders.
|
||||
const QStringList sources = dir.entryList(QStringList() << "Makefile" << "*.c" << "*.cpp" << "*.h", QDir::Files);
|
||||
|
||||
QString projectContents;
|
||||
QTextStream stream(&projectContents);
|
||||
stream << "files=" << sources.join(",");
|
||||
stream << endl;
|
||||
|
||||
Core::GeneratedFile file(QFileInfo(dir, projectName).absoluteFilePath()); // ### fixme
|
||||
file.setContents(projectContents);
|
||||
|
||||
Core::GeneratedFiles files;
|
||||
files.append(file);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
bool GenericProjectWizard::postGenerateFiles(const Core::GeneratedFiles &l, QString *errorMessage)
|
||||
{
|
||||
// Post-Generate: Open the project
|
||||
const QString proFileName = l.back().path();
|
||||
if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFileName)) {
|
||||
*errorMessage = tr("The project %1 could not be opened.").arg(proFileName);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user