Commit 79169238 authored by Roberto Raggi's avatar Roberto Raggi

Fun with Core::IWizard.

parent 37f7e5db
......@@ -7,12 +7,14 @@ HEADERS = genericproject.h \
genericprojectmanager.h \
genericprojectconstants.h \
genericprojectnodes.h \
genericprojectwizard.h \
pkgconfigtool.h \
makestep.h
SOURCES = genericproject.cpp \
genericprojectplugin.cpp \
genericprojectmanager.cpp \
genericprojectnodes.cpp \
genericprojectwizard.cpp \
pkgconfigtool.cpp \
makestep.cpp
RESOURCES += genericproject.qrc
......@@ -29,6 +29,7 @@
#include "genericprojectplugin.h"
#include "genericprojectmanager.h"
#include "genericprojectwizard.h"
#include "makestep.h"
#include <coreplugin/icore.h>
......@@ -57,8 +58,9 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage
if (! mimeDB->addMimeTypes(mimetypesXml, errorMessage))
return false;
addAutoReleasedObject(new Manager());
addAutoReleasedObject(new MakeBuildStepFactory());
addAutoReleasedObject(new Manager);
addAutoReleasedObject(new MakeBuildStepFactory);
addAutoReleasedObject(new GenericProjectWizard);
return true;
}
......
#include "genericprojectwizard.h"
#include <utils/pathchooser.h>
#include <QtGui/QWizard>
#include <QtGui/QFormLayout>
#include <QtCore/QtDebug>
using namespace GenericProjectManager::Internal;
using namespace Core::Utils;
GenericProjectWizard::GenericProjectWizard()
: Core::BaseFileWizard(parameters())
{
}
GenericProjectWizard::~GenericProjectWizard()
{
}
Core::BaseFileWizardParameters GenericProjectWizard::parameters()
{
static Core::BaseFileWizardParameters parameters(ProjectWizard);
parameters.setName(tr("Existing Project"));
parameters.setDescription(tr("Import Existing Project"));
parameters.setCategory(QLatin1String("Import"));
parameters.setTrCategory(tr("Import"));
return parameters;
}
QWizard *GenericProjectWizard::createWizardDialog(QWidget *parent,
const QString &defaultPath,
const WizardPageList &extensionPages) const
{
QWizard *wizard = new QWizard(parent);
wizard->setWindowTitle(tr("Import Existing Project"));
setupWizard(wizard);
QWizardPage *firstPage = new QWizardPage;
firstPage->setTitle(tr(""));
QFormLayout *layout = new QFormLayout(firstPage);
PathChooser *pathChooser = new PathChooser;
pathChooser->setObjectName("pathChooser");
layout->addRow(tr("Source Directory:"), pathChooser);
wizard->addPage(firstPage);
foreach (QWizardPage *p, extensionPages)
wizard->addPage(p);
return wizard;
}
Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
QString *errorMessage) const
{
PathChooser *pathChooser = w->findChild<PathChooser *>("pathChooser");
return Core::GeneratedFiles();
}
#ifndef GENERICPROJECTWIZARD_H
#define GENERICPROJECTWIZARD_H
#include <coreplugin/basefilewizard.h>
namespace GenericProjectManager {
namespace Internal {
class GenericProjectWizard : public Core::BaseFileWizard
{
Q_OBJECT
public:
GenericProjectWizard();
virtual ~GenericProjectWizard();
static Core::BaseFileWizardParameters parameters();
protected:
virtual QWizard *createWizardDialog(QWidget *parent,
const QString &defaultPath,
const WizardPageList &extensionPages) const;
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
QString *errorMessage) const;
};
} // end of namespace Internal
} // end of namespace GenericProjectManager
#endif // GENERICPROJECTWIZARD_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment