OSDN Git Service

8278fd20896cd00ded5a7ac8ada889ac08e630f7
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qt4projectmanager / wizards / mobileappwizard.cpp
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
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
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
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.
24 **
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.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #include "mobileappwizard.h"
35
36 #include "mobileappwizardpages.h"
37 #include "mobileapp.h"
38 #include "targetsetuppage.h"
39
40 #include "qt4projectmanagerconstants.h"
41
42 #include <projectexplorer/task.h>
43
44 #include <QtCore/QCoreApplication>
45 #include <QtGui/QIcon>
46
47 namespace Qt4ProjectManager {
48 namespace Internal {
49 namespace {
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.");
57 }
58
59 class MobileAppWizardDialog : public AbstractMobileAppWizardDialog
60 {
61     Q_OBJECT
62 public:
63     explicit MobileAppWizardDialog(QWidget *parent = 0)
64         : AbstractMobileAppWizardDialog(parent, QtVersionNumber())
65     {
66         setWindowTitle(DisplayName);
67         setIntroDescription(Description);
68     }
69 };
70
71 class MobileAppWizardPrivate
72 {
73     class MobileApp *mobileApp;
74     class MobileAppWizardDialog *wizardDialog;
75     friend class MobileAppWizard;
76 };
77
78 MobileAppWizard::MobileAppWizard()
79     : AbstractMobileAppWizard(parameters())
80     , m_d(new MobileAppWizardPrivate)
81 {
82     m_d->mobileApp = new MobileApp;
83     m_d->wizardDialog = 0;
84 }
85
86 MobileAppWizard::~MobileAppWizard()
87 {
88     delete m_d->mobileApp;
89     delete m_d;
90 }
91
92 Core::BaseFileWizardParameters MobileAppWizard::parameters()
93 {
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));
102     return parameters;
103 }
104
105 AbstractMobileAppWizardDialog *MobileAppWizard::createWizardDialogInternal(QWidget *parent) const
106 {
107     m_d->wizardDialog = new MobileAppWizardDialog(parent);
108     m_d->wizardDialog->targetsPage()->setPreferMobile(true);
109     return m_d->wizardDialog;
110 }
111
112 void MobileAppWizard::projectPathChanged(const QString &path) const
113 {
114     m_d->wizardDialog->targetsPage()->setProFilePath(path);
115 }
116
117 void MobileAppWizard::prepareGenerateFiles(const QWizard *w,
118     QString *errorMessage) const
119 {
120     Q_UNUSED(w);
121     Q_UNUSED(errorMessage)
122 }
123
124 QString MobileAppWizard::fileToOpenPostGeneration() const
125 {
126     return QString();
127 }
128
129 AbstractMobileApp *MobileAppWizard::app() const
130 {
131     return m_d->mobileApp;
132 }
133
134 AbstractMobileAppWizardDialog *MobileAppWizard::wizardDialog() const
135 {
136     return m_d->wizardDialog;
137 }
138
139 } // namespace Internal
140 } // namespace Qt4ProjectManager
141
142 #include "mobileappwizard.moc"