mobileappwizard.cpp 4.77 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
2
**
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
7
**
hjk's avatar
hjk committed
8
9
10
11
12
13
14
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
15
16
**
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17
18
19
20
21
22
23
24
25
** 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.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
con's avatar
con committed
26
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
29
30

#include "mobileappwizard.h"
31

32
#include "mobileapp.h"
33
#include "targetsetuppage.h"
34

35
#include <projectexplorer/projectexplorerconstants.h>
36
#include <qtsupport/qtsupportconstants.h>
37
#include <qtsupport/baseqtversion.h>
38

39
40
#include <QCoreApplication>
#include <QIcon>
41
42
43
44
45
46
47
48
49
50
51
52
53

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.");
}

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

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

MobileAppWizard::MobileAppWizard()
77
    : AbstractMobileAppWizard(parameters())
78
    , d(new MobileAppWizardPrivate)
79
{
80
81
    d->mobileApp = new MobileApp;
    d->wizardDialog = 0;
82
83
84
85
}

MobileAppWizard::~MobileAppWizard()
{
86
87
    delete d->mobileApp;
    delete d;
88
89
}

90
91
Core::FeatureSet MobileAppWizard::requiredFeatures() const
{
92
    return Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE)
93
94
95
            | Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS);
}

96
97
98
Core::BaseFileWizardParameters MobileAppWizard::parameters()
{
    Core::BaseFileWizardParameters parameters(ProjectWizard);
99
    parameters.setIcon(QIcon(QLatin1String(QtSupport::Constants::ICON_QT_PROJECT)));
100
101
102
    parameters.setDisplayName(DisplayName);
    parameters.setId(QLatin1String("C.Qt4GuiMobile"));
    parameters.setDescription(Description);
103
104
    parameters.setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
    parameters.setDisplayCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
105
106
107
    return parameters;
}

108
109
AbstractMobileAppWizardDialog *MobileAppWizard::createWizardDialogInternal(QWidget *parent,
                                                                           const Core::WizardDialogParameters &parameters) const
110
{
111
    d->wizardDialog = new MobileAppWizardDialog(parent, parameters);
112
    return d->wizardDialog;
113
114
}

115
116
void MobileAppWizard::projectPathChanged(const QString &path) const
{
117
118
    if (d->wizardDialog->targetsPage())
        d->wizardDialog->targetsPage()->setProFilePath(path);
119
120
}

121
122
void MobileAppWizard::prepareGenerateFiles(const QWizard *w,
    QString *errorMessage) const
123
{
124
    Q_UNUSED(w);
125
126
127
    Q_UNUSED(errorMessage)
}

128
QString MobileAppWizard::fileToOpenPostGeneration() const
129
{
130
    return QString();
131
132
}

133
AbstractMobileApp *MobileAppWizard::app() const
134
{
135
    return d->mobileApp;
136
137
138
139
}

AbstractMobileAppWizardDialog *MobileAppWizard::wizardDialog() const
{
140
    return d->wizardDialog;
141
142
143
144
145
146
}

} // namespace Internal
} // namespace Qt4ProjectManager

#include "mobileappwizard.moc"