2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-06-29 14:47:04 +02:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2009-06-29 14:47:04 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-06-29 14:47:04 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2009-06-29 14:47:04 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-06-29 14:47:04 +02:00
|
|
|
|
|
|
|
|
#include "customwidgetwizard.h"
|
|
|
|
|
#include "customwidgetwizarddialog.h"
|
|
|
|
|
#include "plugingenerator.h"
|
|
|
|
|
#include "filenamingparameters.h"
|
2013-03-28 10:15:09 +01:00
|
|
|
#include "pluginoptions.h"
|
2009-06-29 14:47:04 +02:00
|
|
|
|
2010-01-13 18:44:15 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2009-06-29 14:47:04 +02:00
|
|
|
|
2012-01-18 13:50:14 +01:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QIcon>
|
2010-03-18 10:59:06 +01:00
|
|
|
|
2009-06-29 14:47:04 +02:00
|
|
|
namespace Qt4ProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
CustomWidgetWizard::CustomWidgetWizard() :
|
2009-11-27 10:33:24 +01:00
|
|
|
QtWizard(QLatin1String("P.Qt4CustomWidget"),
|
2011-11-18 12:54:41 +01:00
|
|
|
QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY),
|
|
|
|
|
QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY),
|
2010-01-13 18:44:15 +01:00
|
|
|
tr("Qt Custom Designer Widget"),
|
|
|
|
|
tr("Creates a Qt Custom Designer Widget or a Custom Widget Collection."),
|
2009-11-27 10:33:24 +01:00
|
|
|
QIcon(QLatin1String(":/wizards/images/gui.png")))
|
2009-06-29 14:47:04 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-18 13:50:14 +01:00
|
|
|
Core::FeatureSet CustomWidgetWizard::requiredFeatures() const
|
|
|
|
|
{
|
|
|
|
|
return Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS);
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-29 14:47:04 +02:00
|
|
|
QWizard *CustomWidgetWizard::createWizardDialog(QWidget *parent,
|
2012-02-03 18:00:08 +01:00
|
|
|
const Core::WizardDialogParameters &wizardDialogParameters) const
|
2009-06-29 14:47:04 +02:00
|
|
|
{
|
2012-02-03 18:00:08 +01:00
|
|
|
CustomWidgetWizardDialog *rc = new CustomWidgetWizardDialog(displayName(),
|
|
|
|
|
icon(),
|
|
|
|
|
parent,
|
|
|
|
|
wizardDialogParameters);
|
|
|
|
|
rc->setProjectName(CustomWidgetWizardDialog::uniqueProjectName(wizardDialogParameters.defaultPath()));
|
2009-06-29 14:47:04 +02:00
|
|
|
rc->setFileNamingParameters(FileNamingParameters(headerSuffix(), sourceSuffix(), QtWizard::lowerCaseFiles()));
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Core::GeneratedFiles CustomWidgetWizard::generateFiles(const QWizard *w,
|
|
|
|
|
QString *errorMessage) const
|
|
|
|
|
{
|
|
|
|
|
const CustomWidgetWizardDialog *cw = qobject_cast<const CustomWidgetWizardDialog *>(w);
|
|
|
|
|
Q_ASSERT(w);
|
|
|
|
|
GenerationParameters p;
|
2010-01-07 18:17:24 +01:00
|
|
|
p.fileName = cw->projectName();
|
2009-06-29 14:47:04 +02:00
|
|
|
p.path = cw->path();
|
2009-06-30 17:11:35 +02:00
|
|
|
p.templatePath = QtWizard::templateDir();
|
|
|
|
|
p.templatePath += QLatin1String("/customwidgetwizard");
|
2009-06-29 14:47:04 +02:00
|
|
|
return PluginGenerator::generatePlugin(p, *(cw->pluginOptions()), errorMessage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qt4ProjectManager
|