forked from qt-creator/qt-creator
Fixes: Add new subdirs project wizard
Task: QTCREATORBUG-1297 RevBy: dt <qtc-committer@nokia.com>
This commit is contained in:
@@ -2106,7 +2106,7 @@ void ProjectExplorerPlugin::addNewSubproject()
|
||||
if (d->m_currentNode->nodeType() == ProjectNodeType
|
||||
&& d->m_currentNode->projectNode()->supportedActions(
|
||||
d->m_currentNode->projectNode()).contains(ProjectNode::AddSubProject)) {
|
||||
Core::ICore::instance()->showNewItemDialog(tr("New Project", "Title of dialog"),
|
||||
Core::ICore::instance()->showNewItemDialog(tr("New Subproject", "Title of dialog"),
|
||||
Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard),
|
||||
location);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ HEADERS += qt4deployconfiguration.h \
|
||||
wizards/abstractmobileapp.h \
|
||||
wizards/qmlstandaloneapp.h \
|
||||
wizards/abstractmobileappwizard.h \
|
||||
wizards/subdirsprojectwizard.h \
|
||||
wizards/subdirsprojectwizarddialog.h \
|
||||
qt4projectmanagerconstants.h \
|
||||
makestep.h \
|
||||
qmakestep.h \
|
||||
@@ -103,6 +105,8 @@ SOURCES += qt4projectmanagerplugin.cpp \
|
||||
wizards/abstractmobileapp.cpp \
|
||||
wizards/qmlstandaloneapp.cpp \
|
||||
wizards/abstractmobileappwizard.cpp \
|
||||
wizards/subdirsprojectwizard.cpp \
|
||||
wizards/subdirsprojectwizarddialog.cpp \
|
||||
makestep.cpp \
|
||||
qmakestep.cpp \
|
||||
qt4runconfiguration.cpp \
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "wizards/librarywizard.h"
|
||||
#include "wizards/testwizard.h"
|
||||
#include "wizards/emptyprojectwizard.h"
|
||||
#include "wizards/subdirsprojectwizard.h"
|
||||
#include "wizards/qmlstandaloneappwizard.h"
|
||||
#include "customwidgetwizard/customwidgetwizard.h"
|
||||
#include "profileeditorfactory.h"
|
||||
@@ -132,20 +133,12 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
|
||||
addObject(m_proFileEditorFactory);
|
||||
|
||||
addAutoReleasedObject(new EmptyProjectWizard);
|
||||
|
||||
GuiAppWizard *guiWizard = new GuiAppWizard;
|
||||
addAutoReleasedObject(guiWizard);
|
||||
|
||||
ConsoleAppWizard *consoleWizard = new ConsoleAppWizard;
|
||||
addAutoReleasedObject(consoleWizard);
|
||||
|
||||
MobileAppWizard *mobileWizard = new MobileAppWizard;
|
||||
addAutoReleasedObject(mobileWizard);
|
||||
|
||||
addAutoReleasedObject(new SubdirsProjectWizard);
|
||||
addAutoReleasedObject(new GuiAppWizard);
|
||||
addAutoReleasedObject(new ConsoleAppWizard);
|
||||
addAutoReleasedObject(new MobileAppWizard);
|
||||
addAutoReleasedObject(new QmlStandaloneAppWizard());
|
||||
|
||||
LibraryWizard *libWizard = new LibraryWizard;
|
||||
addAutoReleasedObject(libWizard);
|
||||
addAutoReleasedObject(new LibraryWizard);
|
||||
addAutoReleasedObject(new TestWizard);
|
||||
addAutoReleasedObject(new CustomWidgetWizard);
|
||||
|
||||
|
||||
@@ -50,12 +50,6 @@ class QtVersionManager;
|
||||
namespace Internal {
|
||||
|
||||
class ProFileEditorFactory;
|
||||
class ConsoleAppWizard;
|
||||
class GuiAppWizard;
|
||||
class EmptyProjectWizard;
|
||||
class QMakeStepFactory;
|
||||
class MakeStepFactory;
|
||||
class EmbeddedPropertiesPage;
|
||||
class GettingStartedWelcomePage;
|
||||
|
||||
class Qt4ProjectManagerPlugin : public ExtensionSystem::IPlugin
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (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 http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "subdirsprojectwizard.h"
|
||||
|
||||
#include "subdirsprojectwizarddialog.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
SubdirsProjectWizard::SubdirsProjectWizard()
|
||||
: QtWizard(QLatin1String("U.Qt4Subdirs"),
|
||||
QLatin1String(ProjectExplorer::Constants::PROJECT_WIZARD_CATEGORY),
|
||||
QLatin1String(ProjectExplorer::Constants::PROJECT_WIZARD_TR_SCOPE),
|
||||
QLatin1String(ProjectExplorer::Constants::PROJECT_WIZARD_TR_CATEGORY),
|
||||
tr("Subdirs Project"),
|
||||
tr("Creates a qmake-based subdirs project. This allows you to group "
|
||||
"your projects in a tree structure."),
|
||||
QIcon(QLatin1String(":/wizards/images/gui.png")))
|
||||
{
|
||||
}
|
||||
|
||||
QWizard *SubdirsProjectWizard::createWizardDialog(QWidget *parent,
|
||||
const QString &defaultPath,
|
||||
const WizardPageList &extensionPages) const
|
||||
{
|
||||
SubdirsProjectWizardDialog *dialog = new SubdirsProjectWizardDialog(displayName(), icon(), extensionPages, parent);
|
||||
dialog->setPath(defaultPath);
|
||||
dialog->setProjectName(SubdirsProjectWizardDialog::uniqueProjectName(defaultPath));
|
||||
const QString buttonText = dialog->wizardStyle() == QWizard::MacStyle
|
||||
? tr("Done && Add Subproject") : tr("Finish && Add Subproject");
|
||||
dialog->setButtonText(QWizard::FinishButton, buttonText);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
Core::GeneratedFiles SubdirsProjectWizard::generateFiles(const QWizard *w,
|
||||
QString * /*errorMessage*/) const
|
||||
{
|
||||
const SubdirsProjectWizardDialog *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
|
||||
const QtProjectParameters params = wizard->parameters();
|
||||
const QString projectPath = params.projectPath();
|
||||
const QString profileName = Core::BaseFileWizard::buildFileName(projectPath, params.fileName, profileSuffix());
|
||||
|
||||
Core::GeneratedFile profile(profileName);
|
||||
profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute | Core::GeneratedFile::OpenEditorAttribute);
|
||||
profile.setContents(QLatin1String("TEMPLATE = subdirs\n"));
|
||||
return Core::GeneratedFiles() << profile;
|
||||
}
|
||||
|
||||
bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &files, QString *errorMessage)
|
||||
{
|
||||
const SubdirsProjectWizardDialog *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
|
||||
if (QtWizard::qt4ProjectPostGenerateFiles(wizard, files, errorMessage)) {
|
||||
Core::ICore::instance()->showNewItemDialog(tr("New Subproject", "Title of dialog"),
|
||||
Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard),
|
||||
wizard->parameters().projectPath());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
58
src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.h
Normal file
58
src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (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 http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef SUBDIRSPROJECTWIZARD_H
|
||||
#define SUBDIRSPROJECTWIZARD_H
|
||||
|
||||
#include "qtwizard.h"
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class SubdirsProjectWizard : public QtWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SubdirsProjectWizard();
|
||||
|
||||
protected:
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
const QString &defaultPath,
|
||||
const WizardPageList &extensionPages) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
virtual bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
#endif // SUBDIRSPROJECTWIZARD_H
|
||||
@@ -0,0 +1,64 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (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 http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "subdirsprojectwizarddialog.h"
|
||||
#include "qtprojectparameters.h"
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
SubdirsProjectWizardDialog::SubdirsProjectWizardDialog(const QString &templateName,
|
||||
const QIcon &icon,
|
||||
const QList<QWizardPage*> &extensionPages,
|
||||
QWidget *parent) :
|
||||
BaseQt4ProjectWizardDialog(parent)
|
||||
{
|
||||
setWindowIcon(icon);
|
||||
setWindowTitle(templateName);
|
||||
|
||||
setIntroDescription(tr("This wizard generates Qt4 subdirs project. "
|
||||
"Add subprojects to it later on by using the other wizards."));
|
||||
|
||||
addTargetSetupPage();
|
||||
|
||||
foreach (QWizardPage *p, extensionPages)
|
||||
Core::BaseFileWizard::applyExtensionPageShortTitle(this, addPage(p));
|
||||
}
|
||||
|
||||
QtProjectParameters SubdirsProjectWizardDialog::parameters() const
|
||||
{
|
||||
QtProjectParameters rc;
|
||||
rc.type = QtProjectParameters::EmptyProject;
|
||||
rc.fileName = projectName();
|
||||
rc.path = path();
|
||||
return rc;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
@@ -0,0 +1,55 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (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 http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef SUBDIRSPROJECTWIZARDDIALOG_H
|
||||
#define SUBDIRSPROJECTWIZARDDIALOG_H
|
||||
|
||||
#include "qtwizard.h"
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
struct QtProjectParameters;
|
||||
|
||||
class SubdirsProjectWizardDialog : public BaseQt4ProjectWizardDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SubdirsProjectWizardDialog(const QString &templateName,
|
||||
const QIcon &icon,
|
||||
const QList<QWizardPage*> &extensionPages,
|
||||
QWidget *parent = 0);
|
||||
|
||||
QtProjectParameters parameters() const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
#endif // SUBDIRSPROJECTWIZARDDIALOG_H
|
||||
@@ -84,6 +84,8 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) :
|
||||
this, SLOT(handleDoubleClicks(QTreeWidgetItem*,int)));
|
||||
connect(m_ui->versionTree, SIGNAL(customContextMenuRequested(QPoint)),
|
||||
this, SLOT(contextMenuRequested(QPoint)));
|
||||
|
||||
setTitle(tr("Qt Versions"));
|
||||
}
|
||||
|
||||
void TargetSetupPage::initializePage()
|
||||
|
||||
Reference in New Issue
Block a user