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 "customwidgetwizarddialog.h"
|
|
|
|
|
#include "customwidgetwidgetswizardpage.h"
|
|
|
|
|
#include "customwidgetpluginwizardpage.h"
|
2013-03-28 10:15:09 +01:00
|
|
|
#include "pluginoptions.h"
|
2012-05-14 18:55:30 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2009-06-29 14:47:04 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
class DesktopQtKitMatcher : public ProjectExplorer::KitMatcher
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2012-09-03 18:31:44 +02:00
|
|
|
bool matches(const ProjectExplorer::Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(k);
|
2012-08-03 15:24:33 +02:00
|
|
|
if (dev.isNull() || dev->id() != ProjectExplorer::Constants::DESKTOP_DEVICE_ID)
|
2012-04-24 15:49:09 +02:00
|
|
|
return false;
|
2012-09-03 18:31:44 +02:00
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
2012-11-26 15:09:56 +02:00
|
|
|
return version && version->type() == QLatin1String(QtSupport::Constants::DESKTOPQT);
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
namespace QmakeProjectManager {
|
2009-06-29 14:47:04 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2010-03-05 11:24:31 +01:00
|
|
|
enum { IntroPageId = 0};
|
2009-06-29 14:47:04 +02:00
|
|
|
|
|
|
|
|
CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName,
|
|
|
|
|
const QIcon &icon,
|
2012-02-03 18:00:08 +01:00
|
|
|
QWidget *parent,
|
|
|
|
|
const Core::WizardDialogParameters ¶meters) :
|
|
|
|
|
BaseQt4ProjectWizardDialog(false, parent, parameters),
|
2009-06-29 14:47:04 +02:00
|
|
|
m_widgetsPage(new CustomWidgetWidgetsWizardPage),
|
2010-03-05 11:24:31 +01:00
|
|
|
m_pluginPage(new CustomWidgetPluginWizardPage),
|
|
|
|
|
m_widgetPageId(-1), m_pluginPageId(-1)
|
2009-06-29 14:47:04 +02:00
|
|
|
{
|
|
|
|
|
setWindowIcon(icon);
|
|
|
|
|
setWindowTitle(templateName);
|
|
|
|
|
|
2012-11-06 13:45:14 +01:00
|
|
|
setIntroDescription(tr("This wizard generates a Qt Designer Custom Widget "
|
|
|
|
|
"or a Qt Designer Custom Widget Collection project."));
|
2012-05-14 18:55:30 +02:00
|
|
|
|
2012-11-26 15:09:56 +02:00
|
|
|
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
|
2012-05-14 18:55:30 +02:00
|
|
|
addTargetSetupPage();
|
2010-03-05 11:24:31 +01:00
|
|
|
m_widgetPageId = addPage(m_widgetsPage);
|
|
|
|
|
m_pluginPageId = addPage(m_pluginPage);
|
2010-03-31 14:48:08 +02:00
|
|
|
wizardProgress()->item(m_widgetPageId)->setTitle(tr("Custom Widgets"));
|
|
|
|
|
wizardProgress()->item(m_pluginPageId)->setTitle(tr("Plugin Details"));
|
2009-06-29 14:47:04 +02:00
|
|
|
|
2012-02-14 15:21:21 +01:00
|
|
|
addExtensionPages(parameters.extensionPages());
|
2009-06-29 14:47:04 +02:00
|
|
|
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FileNamingParameters CustomWidgetWizardDialog::fileNamingParameters() const
|
|
|
|
|
{
|
|
|
|
|
return m_widgetsPage->fileNamingParameters();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CustomWidgetWizardDialog::setFileNamingParameters(const FileNamingParameters &fnp)
|
|
|
|
|
{
|
|
|
|
|
m_widgetsPage->setFileNamingParameters(fnp);
|
|
|
|
|
m_pluginPage->setFileNamingParameters(fnp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CustomWidgetWizardDialog::slotCurrentIdChanged(int id)
|
|
|
|
|
{
|
2010-03-05 11:24:31 +01:00
|
|
|
if (id == m_pluginPageId)
|
2009-06-29 14:47:04 +02:00
|
|
|
m_pluginPage->init(m_widgetsPage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QSharedPointer<PluginOptions> CustomWidgetWizardDialog::pluginOptions() const
|
|
|
|
|
{
|
|
|
|
|
QSharedPointer<PluginOptions> rc = m_pluginPage->basicPluginOptions();
|
|
|
|
|
rc->widgetOptions = m_widgetsPage->widgetOptions();
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
2013-10-16 11:02:37 +02:00
|
|
|
} // namespace QmakeProjectManager
|