1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #ifndef S60CREATEPACKAGESTEP_H
34 #define S60CREATEPACKAGESTEP_H
36 #include "ui_s60createpackagestep.h"
38 #include <projectexplorer/buildstep.h>
39 #include <qt4projectmanager/makestep.h>
41 #include <QtCore/QMutex>
42 #include <QtCore/QWaitCondition>
49 class CheckableMessageBox;
52 namespace Qt4ProjectManager {
55 class S60CreatePackageParser;
57 class S60CreatePackageStepFactory : public ProjectExplorer::IBuildStepFactory
61 explicit S60CreatePackageStepFactory(QObject *parent = 0);
62 ~S60CreatePackageStepFactory();
64 // used to show the list of possible additons to a target, returns a list of types
65 QStringList availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
66 // used to translate the types to names to display to the user
67 QString displayNameForId(const QString &id) const;
69 bool canCreate(ProjectExplorer::BuildStepList *parent, const QString &id) const;
70 ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, const QString &id);
71 // used to recreate the runConfigurations when restoring settings
72 bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
73 ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
74 bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const;
75 ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product);
79 class S60CreatePackageStep : public ProjectExplorer::BuildStep
82 friend class S60CreatePackageStepFactory;
91 explicit S60CreatePackageStep(ProjectExplorer::BuildStepList *bsl);
92 virtual ~S60CreatePackageStep();
95 virtual void run(QFutureInterface<bool> &fi);
96 virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
97 virtual bool immutable() const;
99 QVariantMap toMap() const;
101 SigningMode signingMode() const;
102 void setSigningMode(SigningMode mode);
103 QString customSignaturePath() const;
104 void setCustomSignaturePath(const QString &path);
105 QString customKeyPath() const;
106 void setCustomKeyPath(const QString &path);
107 QString passphrase() const ;
108 void setPassphrase(const QString &passphrase);
109 QString keyId() const;
110 void setKeyId(const QString &keyId);
111 bool createsSmartInstaller() const;
112 void setCreatesSmartInstaller(bool value);
114 void resetPassphrases();
117 void badPassphrase();
118 void warnAboutPatching();
121 S60CreatePackageStep(ProjectExplorer::BuildStepList *bsl, S60CreatePackageStep *bs);
122 S60CreatePackageStep(ProjectExplorer::BuildStepList *bsl, const QString &id);
123 bool fromMap(const QVariantMap &map);
125 Qt4BuildConfiguration *qt4BuildConfiguration() const;
128 void packageWarningDialogDone();
129 void packageDone(int, QProcess::ExitStatus);
130 void processReadyReadStdOutput();
131 void processReadyReadStdError();
132 void checkForCancel();
133 void definePassphrase();
135 void packageWasPatched(const QString &, const QStringList &);
136 void handleWarnAboutPatching();
139 void stdOutput(const QString &line);
140 void stdError(const QString &line);
142 void reportPackageStepIssue(const QString &message, bool isError );
144 bool createOnePackage();
145 bool validateCustomSigningResources(const QStringList &capabilitiesInPro);
147 QString generateKeyId(const QString &keyPath) const;
148 QString loadPassphraseForKey(const QString &keyId);
149 void savePassphraseForKey(const QString &keyId, const QString &passphrase);
150 QString elucidatePassphrase(QByteArray obfuscatedPassphrase, const QString &key) const;
151 QByteArray obfuscatePassphrase(const QString &passphrase, const QString &key) const;
153 QStringList m_workingDirectories;
156 Utils::Environment m_environment;
161 SigningMode m_signingMode;
162 QString m_customSignaturePath;
163 QString m_customKeyPath;
164 QString m_passphrase;
166 bool m_createSmartInstaller;
167 ProjectExplorer::IOutputParser *m_outputParserChain;
171 QEventLoop *m_eventLoop;
172 QFutureInterface<bool> *m_futureInterface;
174 QWaitCondition m_waitCondition;
179 QSettings *m_passphrases;
180 S60CreatePackageParser *m_parser;
181 QList<QPair<QString, QStringList> > m_packageChanges;
183 bool m_suppressPatchWarningDialog;
184 Utils::CheckableMessageBox *m_patchWarningDialog;
187 class S60CreatePackageStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
191 S60CreatePackageStepConfigWidget(S60CreatePackageStep *signStep);
192 QString displayName() const;
194 QString summaryText() const;
199 void resetPassphrases();
200 void signatureChanged(QString certFile);
201 void displayCertificateDetails();
204 S60CreatePackageStep *m_signStep;
206 Ui::S60CreatePackageStepWidget m_ui;
210 } // Qt4ProjectManager
212 #endif // S60CREATEPACKAGESTEP_H