mobileappwizard.cpp 4.72 KB
Newer Older
1
2
3
4
/**************************************************************************
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
8
9
10
11
**
**
** GNU Lesser General Public License Usage
**
hjk's avatar
hjk committed
12
13
14
15
16
17
** 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.
18
**
con's avatar
con committed
19
** In addition, as a special exception, Nokia gives you certain additional
hjk's avatar
hjk committed
20
** rights. These rights are described in the Nokia Qt LGPL Exception
con's avatar
con committed
21
22
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
23
24
25
26
27
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
con's avatar
con committed
28
** If you have questions regarding the use of this file, please contact
29
** Nokia at qt-info@nokia.com.
30
31
32
33
**
**************************************************************************/

#include "mobileappwizard.h"
34

35
36
#include "mobileappwizardpages.h"
#include "mobileapp.h"
37
#include "targetsetuppage.h"
38
39
#include "qt4projectmanagerconstants.h"

40
#include <projectexplorer/projectexplorerconstants.h>
41
42
#include <projectexplorer/task.h>

43
44
#include <qtsupport/qtsupportconstants.h>

45
#include <QtCore/QCoreApplication>
46
#include <QtGui/QIcon>
47
48
49
50
51
52
53
54
55
56
57
58
59

namespace Qt4ProjectManager {
namespace Internal {
namespace {
const QString DisplayName
    = QCoreApplication::translate("MobileAppWizard", "Mobile Qt Application");
const QString Description
    = QCoreApplication::translate("MobileAppWizard",
        "Creates a Qt application optimized for mobile devices "
        "with a Qt Designer-based main window.\n\n"
        "Preselects Qt for Simulator and mobile targets if available.");
}

60
class MobileAppWizardDialog : public AbstractMobileAppWizardDialog
61
62
63
{
    Q_OBJECT
public:
64
65
66
67
    explicit MobileAppWizardDialog(QWidget *parent, const Core::WizardDialogParameters &parameters)
        : AbstractMobileAppWizardDialog(parent,
                                        QtSupport::QtVersionNumber(),
                                        QtSupport::QtVersionNumber(4, INT_MAX, INT_MAX), parameters)
68
69
70
    {
        setWindowTitle(DisplayName);
        setIntroDescription(Description);
Feetu Nyrhinen's avatar
Feetu Nyrhinen committed
71
        addMobilePages();
72
    }
73
74
75
76
77
78
79
80
81
82
};

class MobileAppWizardPrivate
{
    class MobileApp *mobileApp;
    class MobileAppWizardDialog *wizardDialog;
    friend class MobileAppWizard;
};

MobileAppWizard::MobileAppWizard()
83
    : AbstractMobileAppWizard(parameters())
84
    , d(new MobileAppWizardPrivate)
85
{
86
87
    d->mobileApp = new MobileApp;
    d->wizardDialog = 0;
88
89
90
91
}

MobileAppWizard::~MobileAppWizard()
{
92
93
    delete d->mobileApp;
    delete d;
94
95
}

96
97
98
Core::FeatureSet MobileAppWizard::requiredFeatures() const
{
    return Core::Feature(QtSupport::Constants::FEATURE_GENERIC_CPP_ENTRY_POINT)
99
            | Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE)
100
101
102
            | Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS);
}

103
104
105
106
107
108
109
Core::BaseFileWizardParameters MobileAppWizard::parameters()
{
    Core::BaseFileWizardParameters parameters(ProjectWizard);
    parameters.setIcon(QIcon(QLatin1String(Constants::ICON_QT_PROJECT)));
    parameters.setDisplayName(DisplayName);
    parameters.setId(QLatin1String("C.Qt4GuiMobile"));
    parameters.setDescription(Description);
110
111
    parameters.setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
    parameters.setDisplayCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
112
113
114
    return parameters;
}

115
116
AbstractMobileAppWizardDialog *MobileAppWizard::createWizardDialogInternal(QWidget *parent,
                                                                           const Core::WizardDialogParameters &parameters) const
117
{
118
    d->wizardDialog = new MobileAppWizardDialog(parent, parameters);
119
    return d->wizardDialog;
120
121
}

122
123
void MobileAppWizard::projectPathChanged(const QString &path) const
{
124
    d->wizardDialog->targetsPage()->setProFilePath(path);
125
126
}

127
128
void MobileAppWizard::prepareGenerateFiles(const QWizard *w,
    QString *errorMessage) const
129
{
130
    Q_UNUSED(w);
131
132
133
    Q_UNUSED(errorMessage)
}

134
QString MobileAppWizard::fileToOpenPostGeneration() const
135
{
136
    return QString();
137
138
}

139
AbstractMobileApp *MobileAppWizard::app() const
140
{
141
    return d->mobileApp;
142
143
144
145
}

AbstractMobileAppWizardDialog *MobileAppWizard::wizardDialog() const
{
146
    return d->wizardDialog;
147
148
149
150
151
152
}

} // namespace Internal
} // namespace Qt4ProjectManager

#include "mobileappwizard.moc"