OSDN Git Service

f49442dcbf961ce1eec4880b503443da7a0c79bf
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qt4projectmanager / qt-maemo / maemopackagecreationstep.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of Qt Creator.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
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 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file.  Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23 **
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef MAEMOPACKAGECREATIONSTEP_H
43 #define MAEMOPACKAGECREATIONSTEP_H
44
45 #include <projectexplorer/buildstep.h>
46
47 QT_BEGIN_NAMESPACE
48 class QDateTime;
49 class QFile;
50 class QProcess;
51 QT_END_NAMESPACE
52
53 namespace Qt4ProjectManager {
54 class Qt4BuildConfiguration;
55
56 namespace Internal {
57 class MaemoDeployStep;
58 class MaemoDeployableListModel;
59 class AbstractQt4MaemoTarget;
60 class AbstractDebBasedQt4MaemoTarget;
61 class AbstractRpmBasedQt4MaemoTarget;
62
63 class MaemoPackageCreationStep : public ProjectExplorer::BuildStep
64 {
65     Q_OBJECT
66     friend class MaemoPackageCreationFactory;
67 public:
68     MaemoPackageCreationStep(ProjectExplorer::BuildStepList *bsl);
69     ~MaemoPackageCreationStep();
70
71     QString packageFilePath() const;
72     bool isPackagingEnabled() const;
73     void setPackagingEnabled(bool enabled) { m_packagingEnabled = enabled; }
74
75     QString versionString(QString *error) const;
76     bool setVersionString(const QString &version, QString *error);
77
78     static void preparePackagingProcess(QProcess *proc,
79         const Qt4BuildConfiguration *bc, const QString &workingDir);
80     static QString packagingCommand(const Qt4BuildConfiguration *bc,
81         const QString &commandName);
82     static void ensureShlibdeps(QByteArray &rulesContent);
83
84     QString projectName() const;
85     const Qt4BuildConfiguration *qt4BuildConfiguration() const;
86     AbstractQt4MaemoTarget *maemoTarget() const;
87     AbstractDebBasedQt4MaemoTarget *debBasedMaemoTarget() const;
88     AbstractRpmBasedQt4MaemoTarget *rpmBasedMaemoTarget() const;
89
90     static const QLatin1String DefaultVersionNumber;
91
92 signals:
93     void packageFilePathChanged();
94     void qtVersionChanged();
95
96 private slots:
97     void handleBuildOutput();
98     void handleBuildConfigChanged();
99
100 private:
101     MaemoPackageCreationStep(ProjectExplorer::BuildStepList *buildConfig,
102                              MaemoPackageCreationStep *other);
103
104     void ctor();
105     virtual bool init();
106     virtual void run(QFutureInterface<bool> &fi);
107     virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
108     virtual bool immutable() const { return true; }
109     virtual QVariantMap toMap() const;
110     virtual bool fromMap(const QVariantMap &map);
111
112     bool createPackage(QProcess *buildProc);
113     bool copyDebianFiles(bool inSourceBuild);
114     static QString nativePath(const QFile &file);
115     bool packagingNeeded() const;
116     bool isFileNewerThan(const QString &filePath,
117         const QDateTime &timeStamp) const;
118     void raiseError(const QString &shortMsg,
119                     const QString &detailedMsg = QString());
120     QString buildDirectory() const;
121     MaemoDeployStep * deployStep() const;
122     void checkProjectName();
123     void adaptRulesFile(const QString &rulesFilePath);
124     void addWorkaroundForHarmattanBug(QByteArray &rulesFileContent,
125         int &insertPos, const MaemoDeployableListModel *model,
126         const QString &desktopFileDir);
127     void addSedCmdToRulesFile(QByteArray &rulesFileContent, int &insertPos,
128         const QString &desktopFilePath, const QByteArray &oldString,
129         const QByteArray &newString);
130     static QString replaceDots(const QString &name);
131     static QString rpmBuildDir(const Qt4BuildConfiguration *bc);
132
133     static const QLatin1String CreatePackageId;
134
135     bool m_packagingEnabled;
136     const Qt4BuildConfiguration *m_lastBuildConfig;
137 };
138
139 } // namespace Internal
140 } // namespace Qt4ProjectManager
141
142 #endif // MAEMOPACKAGECREATIONSTEP_H