Commit 8c8e9753 authored by Alessandro Portale's avatar Alessandro Portale

EmptyProjectWizard allows us to create an empty project.

parent b4787c0a
......@@ -20,6 +20,8 @@ HEADERS = qt4projectmanagerplugin.h \
wizards/librarywizard.h \
wizards/librarywizarddialog.h \
wizards/guiappwizarddialog.h \
wizards/emptyprojectwizard.h \
wizards/emptyprojectwizarddialog.h \
wizards/modulespage.h \
wizards/filespage.h \
wizards/qtwizard.h \
......@@ -51,6 +53,8 @@ SOURCES = qt4projectmanagerplugin.cpp \
wizards/librarywizard.cpp \
wizards/librarywizarddialog.cpp \
wizards/guiappwizarddialog.cpp \
wizards/emptyprojectwizard.cpp \
wizards/emptyprojectwizarddialog.cpp \
wizards/modulespage.cpp \
wizards/filespage.cpp \
wizards/qtwizard.cpp \
......
......@@ -33,6 +33,7 @@
#include "wizards/consoleappwizard.h"
#include "wizards/guiappwizard.h"
#include "wizards/librarywizard.h"
#include "wizards/emptyprojectwizard.h"
#include "profileeditorfactory.h"
#include "qt4projectmanagerconstants.h"
#include "qt4project.h"
......@@ -115,6 +116,8 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
m_proFileEditorFactory = new ProFileEditorFactory(m_qt4ProjectManager, editorHandler);
addObject(m_proFileEditorFactory);
addAutoReleasedObject(new EmptyProjectWizard);
GuiAppWizard *guiWizard = new GuiAppWizard;
addAutoReleasedObject(guiWizard);
......
......@@ -43,6 +43,7 @@ namespace Internal {
class ProFileEditorFactory;
class ConsoleAppWizard;
class GuiAppWizard;
class EmptyProjectWizard;
class QMakeStepFactory;
class MakeStepFactory;
class GccParserFactory;
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "emptyprojectwizard.h"
#include "emptyprojectwizarddialog.h"
#include <utils/pathchooser.h>
namespace Qt4ProjectManager {
namespace Internal {
EmptyProjectWizard::EmptyProjectWizard()
: QtWizard(tr("Empty Qt4 Project"),
tr("Creates an empty Qt project."),
QIcon(":/wizards/images/gui.png"))
{
}
QWizard *EmptyProjectWizard::createWizardDialog(QWidget *parent,
const QString &defaultPath,
const WizardPageList &extensionPages) const
{
EmptyProjectWizardDialog *dialog = new EmptyProjectWizardDialog(name(), icon(), extensionPages, parent);
dialog->setPath(defaultPath.isEmpty() ? Core::Utils::PathChooser::homePath() : defaultPath);
return dialog;
}
Core::GeneratedFiles
EmptyProjectWizard::generateFiles(const QWizard *w,
QString * /*errorMessage*/) const
{
const EmptyProjectWizardDialog *wizard = qobject_cast< const EmptyProjectWizardDialog *>(w);
const QtProjectParameters params = wizard->parameters();
const QString projectPath = params.projectPath();
const QString profileName = Core::BaseFileWizard::buildFileName(projectPath, params.name, profileSuffix());
Core::GeneratedFile profile(profileName);
return Core::GeneratedFiles() << profile;
}
} // namespace Internal
} // namespace Qt4ProjectManager
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef EMPTYPROJECTWIZARD_H
#define EMPTYPROJECTWIZARD_H
#include "qtwizard.h"
namespace Qt4ProjectManager {
namespace Internal {
class EmptyProjectWizard : public QtWizard
{
Q_OBJECT
public:
EmptyProjectWizard();
protected:
virtual QWizard *createWizardDialog(QWidget *parent,
const QString &defaultPath,
const WizardPageList &extensionPages) const;
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
QString *errorMessage) const;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // EMPTYPROJECTWIZARD_H
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "emptyprojectwizarddialog.h"
#include "emptyprojectwizard.h"
#include <utils/projectintropage.h>
namespace Qt4ProjectManager {
namespace Internal {
EmptyProjectWizardDialog::EmptyProjectWizardDialog(const QString &templateName,
const QIcon &icon,
const QList<QWizardPage*> &extensionPages,
QWidget *parent) :
QWizard(parent),
m_introPage(new Core::Utils::ProjectIntroPage)
{
setWindowIcon(icon);
setWindowTitle(templateName);
Core::BaseFileWizard::setupWizard(this);
m_introPage->setDescription(tr("This wizard generates an empty Qt4 project. "
"Add files to it later on by using the other wizards. "
"You can press 'Finish' at any point in time."));
addPage(m_introPage);
foreach (QWizardPage *p, extensionPages)
addPage(p);
}
void EmptyProjectWizardDialog::setPath(const QString &path)
{
m_introPage->setPath(path);
}
void EmptyProjectWizardDialog::setName(const QString &name)
{
m_introPage->setName(name);
}
QtProjectParameters EmptyProjectWizardDialog::parameters() const
{
QtProjectParameters rc;
rc.type = QtProjectParameters::EmptyProject;
rc.name = m_introPage->name();
rc.path = m_introPage->path();
return rc;
}
} // namespace Internal
} // namespace Qt4ProjectManager
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef EMPTYPROJECTWIZARDDIALOG_H
#define EMPTYPROJECTWIZARDDIALOG_H
#include <QtGui/QWizard>
namespace Core {
namespace Utils {
class ProjectIntroPage;
}
}
namespace Qt4ProjectManager {
namespace Internal {
struct QtProjectParameters;
class EmptyProjectWizardDialog : public QWizard
{
Q_OBJECT
public:
explicit EmptyProjectWizardDialog(const QString &templateName,
const QIcon &icon,
const QList<QWizardPage*> &extensionPages,
QWidget *parent = 0);
QtProjectParameters parameters() const;
public slots:
void setPath(const QString &path);
void setName(const QString &name);
private:
Core::Utils::ProjectIntroPage *m_introPage;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // EMPTYPROJECTWIZARDDIALOG_H
......@@ -77,6 +77,8 @@ void QtProjectParameters::writeProFile(QTextStream &str) const
case Qt4Plugin:
str << "TEMPLATE = lib\nCONFIG += plugin\n";
break;
default:
break;
}
if (!targetDirectory.isEmpty())
......
......@@ -47,7 +47,7 @@ QString createMacro(const QString &name, const QString &suffix);
// write a .pro-file section.
struct QtProjectParameters {
enum Type { ConsoleApp, GuiApp, StaticLibrary, SharedLibrary, Qt4Plugin };
enum Type { ConsoleApp, GuiApp, StaticLibrary, SharedLibrary, Qt4Plugin, EmptyProject };
QtProjectParameters();
// Return project path as "path/name"
......
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