summaryrefslogtreecommitdiff
path: root/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.h
blob: f3ebd68eabb46ebcb9322fc6bea032bfe953cb29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** 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.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef S60PUBLISHEROVI_H
#define S60PUBLISHEROVI_H

#include <QtCore/QObject>
#include <QtGui/QColor>

QT_BEGIN_NAMESPACE
class QProcess;
QT_END_NAMESPACE

namespace QtSupport {
class ProFileReader;
}

namespace ProjectExplorer {
class Project;
}

namespace Qt4ProjectManager {
class Qt4BuildConfiguration;
class Qt4Project;
namespace Internal {
class Qt4SymbianTarget;
class S60PublishStep;

namespace Constants {
const char * const REJECTED_VENDOR_NAMES_VENDOR = "Vendor";
const char * const REJECTED_VENDOR_NAMES_VENDOR_EN = "Vendor-EN";
const char * const REJECTED_VENDOR_NAMES_NOKIA = "Nokia";
const char * const REJECTED_VENDOR_NAMES_EMPTY = "";

const char * const CERTIFIED_SIGNED_CAPABILITY_NETWORK_CONTROL = "NetworkControl";
const char * const CERTIFIED_SIGNED_CAPABILITY_MULTIMEDIA_DD = "MultimediaDD";
const char * const CERTIFIED_SIGNED_CAPABILITY_COMM_DD = "CommDD";
const char * const CERTIFIED_SIGNED_CAPABILITY_DISK_ADMIN = "DiskAdmin";
const char * const MANUFACTURER_APPROVED_CAPABILITY_ALL_FILES = "AllFiles";
const char * const MANUFACTURER_APPROVED_CAPABILITY_DRM = "DRM";
const char * const MANUFACTURER_APPROVED_CAPABILITY_TCB = "TCB";
}

class S60PublisherOvi : public QObject
{
    Q_OBJECT

public:
    enum UID3Ranges {
        //    Protected UID range:   0x00000000 - 0x7FFFFFFF
        //    Unprotected UID range: 0x80000000 - 0xFFFFFFFF
        //
        //    Specifically, there are two important unprotected UID ranges:
        //    UIDs from Symbian Signed:         0xA0000000 - 0xAFFFFFFF
        //    UIDs for test/development use:    0xE0000000 - 0xEFFFFFFF
        //
        //    And one important protected range:
        //    UIDs from Ovi Sign: 0x20000000 to 0x2FFFFFFF
        //    Warning: Some of these UIDs are assigned by Symbiansigned.
        //    Apps with such UIDs cannot be signed by Ovi.
        //    It is currently impossible to say which UIDs have been assigned by whome.

        AssignedRestrictedStart = 0x20000000,
        AssignedRestrictedEnd = 0x2FFFFFFF,
        SymbianSignedUnprotectedStart = 0xA0000000,
        SymbianSignedUnprotectedEnd = 0xAFFFFFFF,
        TestStart = 0xE0000000,
        TestEnd = 0xEFFFFFFF
    };

    enum CapabilityLevel {
        CertifiedSigned,
        ManufacturerApproved
    };

public:
    explicit S60PublisherOvi(QObject *parent = 0);
    ~S60PublisherOvi();

    void setBuildConfiguration(Qt4BuildConfiguration *qt4bc);
    void cleanUp();
    void completeCreation();

    QString displayName() const;
    QString globalVendorName() const;
    QString localisedVendorNames() const;
    bool isVendorNameValid(const QString &vendorName) const;

    QString nameFromTarget() const;
    QString qtVersion() const;

    QString uid3() const;
    bool isUID3Valid(const QString &uid3) const;
    bool isTestUID3(const QString &uid3) const;
    bool isKnownSymbianSignedUID3(const QString &uid3) const;

    QString capabilities() const;
    bool isCapabilityOneOf(const QString &capability, CapabilityLevel level) const;

    void updateProFile();
    void updateProFile(const QString &var, const QString &values);
    void buildSis();

    QString createdSisFileContainingFolder();
    QString createdSisFilePath();

    bool hasSucceeded();

    void setDisplayName(const QString &displayName);
    void setVendorName(const QString &vendorName);
    void setLocalVendorNames(const QString &localVendorNames);
    void setAppUid(const QString &appuid);

signals:
    void progressReport(const QString& status, QColor c);
    void succeeded();
    void finished();

public slots:
    void publishStepFinished(bool succeeded);
    void printMessage(QString message, bool error);

private:
    bool nextStep();
    bool runStep();

    bool sisExists(QString &sisFile);
    bool isDynamicLibrary(const Qt4Project &project) const;

private:
    QColor m_errorColor;
    QColor m_commandColor;
    QColor m_okColor;
    QColor m_normalColor;

    Qt4BuildConfiguration * m_qt4bc;
    const Qt4SymbianTarget * m_activeTargetOfProject;
    Qt4Project * m_qt4project;
    QtSupport::ProFileReader *m_reader;
    QStringList m_rejectedVendorNames;
    QStringList m_capabilitiesForCertifiedSigned;
    QStringList m_capabilitesForManufacturerApproved;
    QString m_vendorInfoVariable;
    QString m_vendorName;
    QString m_localVendorNames;
    QString m_appUid;
    QString m_displayName;

    QList<S60PublishStep *> m_publishSteps;

    bool m_finishedAndSuccessful;
};

class S60PublishStep : public QObject
{
    Q_OBJECT

public:
    explicit S60PublishStep(bool mandatory, QObject *parent = 0);
    virtual void start() = 0;

    virtual QString displayDescription() const = 0;
    bool succeeded() const;
    bool mandatory() const;

signals:
    void finished(bool succeeded);
    void output(QString output, bool error);

protected:
    void setSucceeded(bool succeeded);

private:
    bool m_succeeded;
    bool m_mandatory;
};

class S60CommandPublishStep : public S60PublishStep
{
    Q_OBJECT

public:
    explicit S60CommandPublishStep(const Qt4BuildConfiguration& bc,
                                   const QString &command,
                                   const QString &name,
                                   bool mandatory = true,
                                   QObject *parent = 0);

    virtual void start();
    virtual QString displayDescription() const;

private slots:
    void processFinished(int exitCode);

private:
    QProcess* m_proc;
    const QString m_command;
    const QString m_name;

};

} // namespace Internal
} // namespace Qt4ProjectManager

#endif // S60PUBLISHEROVI_H