2009-06-29 14:47:04 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2009-06-29 14:47:04 +02:00
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
2009-06-29 14:47:04 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "customwidgetwizarddialog.h"
|
|
|
|
|
#include "customwidgetwidgetswizardpage.h"
|
|
|
|
|
#include "customwidgetpluginwizardpage.h"
|
|
|
|
|
#include "customwidgetwizard.h"
|
|
|
|
|
|
|
|
|
|
namespace Qt4ProjectManager {
|
|
|
|
|
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,
|
|
|
|
|
const QList<QWizardPage*> &extensionPages,
|
|
|
|
|
QWidget *parent) :
|
2010-03-05 11:24:31 +01:00
|
|
|
BaseQt4ProjectWizardDialog(false, parent),
|
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);
|
|
|
|
|
|
2009-11-26 18:03:16 +01:00
|
|
|
setIntroDescription(tr("This wizard generates a Qt4 Designer Custom Widget "
|
|
|
|
|
"or a Qt4 Designer Custom Widget Collection project."));
|
2009-06-29 14:47:04 +02:00
|
|
|
|
2010-03-29 17:57:18 +02:00
|
|
|
addTargetSetupPage(BaseQt4ProjectWizardDialog::desktopTarget());
|
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
|
|
|
|
|
|
|
|
foreach (QWizardPage *p, extensionPages)
|
2010-03-31 14:48:08 +02:00
|
|
|
Core::BaseFileWizard::applyExtensionPageShortTitle(this, addPage(p));
|
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
|
|
|
|
|
} // namespace Qt4ProjectManager
|