1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #include "mobileappwizard.h"
36 #include "mobileappwizardpages.h"
37 #include "mobileapp.h"
38 #include "targetsetuppage.h"
40 #include "qt4projectmanagerconstants.h"
42 #include <projectexplorer/task.h>
44 #include <QtCore/QCoreApplication>
45 #include <QtGui/QIcon>
47 namespace Qt4ProjectManager {
50 const QString DisplayName
51 = QCoreApplication::translate("MobileAppWizard", "Mobile Qt Application");
52 const QString Description
53 = QCoreApplication::translate("MobileAppWizard",
54 "Creates a Qt application optimized for mobile devices "
55 "with a Qt Designer-based main window.\n\n"
56 "Preselects Qt for Simulator and mobile targets if available.");
59 class MobileAppWizardDialog : public AbstractMobileAppWizardDialog
63 explicit MobileAppWizardDialog(QWidget *parent = 0)
64 : AbstractMobileAppWizardDialog(parent, QtVersionNumber())
66 setWindowTitle(DisplayName);
67 setIntroDescription(Description);
71 class MobileAppWizardPrivate
73 class MobileApp *mobileApp;
74 class MobileAppWizardDialog *wizardDialog;
75 friend class MobileAppWizard;
78 MobileAppWizard::MobileAppWizard()
79 : AbstractMobileAppWizard(parameters())
80 , m_d(new MobileAppWizardPrivate)
82 m_d->mobileApp = new MobileApp;
83 m_d->wizardDialog = 0;
86 MobileAppWizard::~MobileAppWizard()
88 delete m_d->mobileApp;
92 Core::BaseFileWizardParameters MobileAppWizard::parameters()
94 Core::BaseFileWizardParameters parameters(ProjectWizard);
95 parameters.setIcon(QIcon(QLatin1String(Constants::ICON_QT_PROJECT)));
96 parameters.setDisplayName(DisplayName);
97 parameters.setId(QLatin1String("C.Qt4GuiMobile"));
98 parameters.setDescription(Description);
99 parameters.setCategory(QLatin1String(Constants::QT_APP_WIZARD_CATEGORY));
100 parameters.setDisplayCategory(QCoreApplication::translate(Constants::QT_APP_WIZARD_TR_SCOPE,
101 Constants::QT_APP_WIZARD_TR_CATEGORY));
105 AbstractMobileAppWizardDialog *MobileAppWizard::createWizardDialogInternal(QWidget *parent) const
107 m_d->wizardDialog = new MobileAppWizardDialog(parent);
108 m_d->wizardDialog->targetsPage()->setPreferMobile(true);
109 return m_d->wizardDialog;
112 void MobileAppWizard::projectPathChanged(const QString &path) const
114 m_d->wizardDialog->targetsPage()->setProFilePath(path);
117 void MobileAppWizard::prepareGenerateFiles(const QWizard *w,
118 QString *errorMessage) const
121 Q_UNUSED(errorMessage)
124 QString MobileAppWizard::fileToOpenPostGeneration() const
129 AbstractMobileApp *MobileAppWizard::app() const
131 return m_d->mobileApp;
134 AbstractMobileAppWizardDialog *MobileAppWizard::wizardDialog() const
136 return m_d->wizardDialog;
139 } // namespace Internal
140 } // namespace Qt4ProjectManager
142 #include "mobileappwizard.moc"