2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-06-29 14:47:04 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-06-29 14:47:04 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
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")));
|
2015-11-27 11:31:35 +01:00
|
|
|
setRequiredFeatures({ 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
|