2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-06-29 14:47:04 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/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
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company 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>
|
|
|
|
|
|
2013-09-20 15:12:44 +02:00
|
|
|
#include <QCoreApplication>
|
2010-03-18 10:59:06 +01:00
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
namespace QmakeProjectManager {
|
2009-06-29 14:47:04 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2013-09-20 15:12:44 +02:00
|
|
|
CustomWidgetWizard::CustomWidgetWizard()
|
2009-06-29 14:47:04 +02:00
|
|
|
{
|
2015-05-18 17:45:04 +02:00
|
|
|
setId("P.Qt4CustomWidget");
|
2013-09-20 15:12:44 +02:00
|
|
|
setCategory(QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY));
|
|
|
|
|
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
|
|
|
|
|
ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY));
|
|
|
|
|
setDisplayName(tr("Qt Custom Designer Widget"));
|
|
|
|
|
setDescription(tr("Creates a Qt Custom Designer Widget or a Custom Widget Collection."));
|
|
|
|
|
setIcon(QIcon(QLatin1String(":/wizards/images/gui.png")));
|
|
|
|
|
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS));
|
2012-01-18 13:50:14 +01:00
|
|
|
}
|
|
|
|
|
|
2014-05-27 13:18:05 +02:00
|
|
|
Core::BaseFileWizard *CustomWidgetWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
2009-06-29 14:47:04 +02:00
|
|
|
{
|
2015-05-29 17:25:40 +02:00
|
|
|
CustomWidgetWizardDialog *rc = new CustomWidgetWizardDialog(this, displayName(),
|
|
|
|
|
icon(), parent, parameters);
|
2014-05-27 12:23:38 +02:00
|
|
|
rc->setProjectName(CustomWidgetWizardDialog::uniqueProjectName(parameters.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
|
2013-10-16 11:02:37 +02:00
|
|
|
} // namespace QmakeProjectManager
|