1
/****************************************************************************
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of Qt Creator.
8
** Commercial License Usage
9
** Licensees holding valid commercial Qt licenses may use this file in
10
** accordance with the commercial license agreement provided with the
11
** Software or, alternatively, in accordance with the terms contained in
12
** a written agreement between you and Digia. For licensing terms and
13
** conditions see http://qt.digia.com/licensing. For further information
14
** use the contact form at http://qt.digia.com/contact-us.
16
** GNU Lesser General Public License Usage
17
** Alternatively, this file may be used under the terms of the GNU Lesser
18
** General Public License version 2.1 as published by the Free Software
19
** Foundation and appearing in the file LICENSE.LGPL included in the
20
** packaging of this file. Please review the following information to
21
** ensure the GNU Lesser General Public License version 2.1 requirements
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
** In addition, as a special exception, Digia gives you certain additional
25
** rights. These rights are described in the Digia Qt LGPL Exception
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28
****************************************************************************/
30
#include "customwidgetwizarddialog.h"
31
#include "customwidgetwidgetswizardpage.h"
32
#include "customwidgetpluginwizardpage.h"
33
#include "pluginoptions.h"
34
#include <projectexplorer/projectexplorerconstants.h>
36
#include <qtsupport/qtkitinformation.h>
37
#include <qtsupport/qtsupportconstants.h>
41
class DesktopQtKitMatcher : public ProjectExplorer::KitMatcher
44
bool matches(const ProjectExplorer::Kit *k) const
46
ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(k);
47
if (dev.isNull() || dev->id() != ProjectExplorer::Constants::DESKTOP_DEVICE_ID)
49
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
50
return version && version->type() == QLatin1String(QtSupport::Constants::DESKTOPQT);
56
namespace QmakeProjectManager {
59
enum { IntroPageId = 0};
61
CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName,
64
const Core::WizardDialogParameters ¶meters) :
65
BaseQmakeProjectWizardDialog(false, parent, parameters),
66
m_widgetsPage(new CustomWidgetWidgetsWizardPage),
67
m_pluginPage(new CustomWidgetPluginWizardPage),
68
m_widgetPageId(-1), m_pluginPageId(-1)
71
setWindowTitle(templateName);
73
setIntroDescription(tr("This wizard generates a Qt Designer Custom Widget "
74
"or a Qt Designer Custom Widget Collection project."));
76
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
78
m_widgetPageId = addPage(m_widgetsPage);
79
m_pluginPageId = addPage(m_pluginPage);
80
wizardProgress()->item(m_widgetPageId)->setTitle(tr("Custom Widgets"));
81
wizardProgress()->item(m_pluginPageId)->setTitle(tr("Plugin Details"));
83
addExtensionPages(parameters.extensionPages());
84
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
87
FileNamingParameters CustomWidgetWizardDialog::fileNamingParameters() const
89
return m_widgetsPage->fileNamingParameters();
92
void CustomWidgetWizardDialog::setFileNamingParameters(const FileNamingParameters &fnp)
94
m_widgetsPage->setFileNamingParameters(fnp);
95
m_pluginPage->setFileNamingParameters(fnp);
98
void CustomWidgetWizardDialog::slotCurrentIdChanged(int id)
100
if (id == m_pluginPageId)
101
m_pluginPage->init(m_widgetsPage);
104
QSharedPointer<PluginOptions> CustomWidgetWizardDialog::pluginOptions() const
106
QSharedPointer<PluginOptions> rc = m_pluginPage->basicPluginOptions();
107
rc->widgetOptions = m_widgetsPage->widgetOptions();
111
} // namespace Internal
112
} // namespace QmakeProjectManager