1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
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
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
37 #include "abstractmobileapp.h"
39 #include <QtCore/QHash>
40 #include <QtCore/QStringList>
42 namespace Qt4ProjectManager {
50 // Example: Module "com.foo.bar" in "c:/modules/".
51 // "qmldir" file is in "c:/modules/com/foo/bar/".
52 // Application .pro file is "c:/app/app.pro".
53 Root, // "c:/modules/" (absolute)
54 ContentDir, // "../modules/com/foo/bar" (relative form .pro file)
55 ContentBase, // "com/foo/"
56 DeployedContentBase // "<qmlmodules>/com/foo" (on deploy target)
59 QmlModule(const QString &name, const QFileInfo &rootDir, const QFileInfo &qmldir,
60 bool isExternal, QtQuickApp *qtQuickApp);
61 QString path(Path path) const;
62 const QString uri; // "com.foo.bar"
63 const QFileInfo rootDir; // Location of "com/"
64 const QFileInfo qmldir; // 'qmldir' file.
65 const bool isExternal; // Either external or inside a source paths
66 const QtQuickApp *qtQuickApp;
67 QHash<QString, struct QmlCppPlugin*> cppPlugins; // Just as info. No ownership.
72 QmlCppPlugin(const QString &name, const QFileInfo &path,
73 const QmlModule *module, const QFileInfo &proFile);
74 const QString name; // Original name
75 const QFileInfo path; // Plugin path where qmldir points to
76 const QmlModule *module;
77 const QFileInfo proFile; // .pro file for the plugin
80 struct QtQuickAppGeneratedFileInfo : public AbstractGeneratedFileInfo
82 enum ExtendedFileType {
83 MainQmlFile = ExtendedFile,
89 QtQuickAppGeneratedFileInfo() : AbstractGeneratedFileInfo() {}
92 class QtQuickApp : public AbstractMobileApp
95 enum ExtendedFileType {
96 MainQml = ExtendedFile,
106 QmlDirProFileRelative,
116 virtual ~QtQuickApp();
118 void setMainQml(Mode mode, const QString &file = QString());
119 Mode mainQmlMode() const;
120 bool setExternalModules(const QStringList &uris, const QStringList &importPaths);
122 #ifndef CREATORLESSTEST
123 virtual Core::GeneratedFiles generateFiles(QString *errorMessage) const;
125 bool generateFiles(QString *errorMessage) const;
126 #endif // CREATORLESSTEST
127 bool useExistingMainQml() const;
128 const QList<QmlModule*> modules() const;
130 static const int StubVersion;
133 virtual QByteArray generateFileExtended(int fileType,
134 bool *versionAndCheckSum, QString *comment, QString *errorMessage) const;
135 virtual QString pathExtended(int fileType) const;
136 virtual QString originsRoot() const;
137 virtual QString mainWindowClassName() const;
138 virtual int stubVersionMinor() const;
139 virtual bool adaptCurrentMainCppTemplateLine(QString &line) const;
140 virtual void handleCurrentProFileTemplateLine(const QString &line,
141 QTextStream &proFileTemplate, QTextStream &proFile,
142 bool &commentOutNextLine) const;
143 QList<AbstractGeneratedFileInfo> updateableFiles(const QString &mainProFile) const;
144 QList<DeploymentFolder> deploymentFolders() const;
146 bool addExternalModule(const QString &uri, const QFileInfo &dir,
147 const QFileInfo &contentDir);
148 bool addCppPlugins(QmlModule *module);
149 bool addCppPlugin(const QString &qmldirLine, QmlModule *module);
150 void clearModulesAndPlugins();
152 QFileInfo m_mainQmlFile;
154 QStringList m_importPaths;
155 QList <QmlModule*> m_modules;
156 QList <QmlCppPlugin*> m_cppPlugins;
159 } // namespace Internal
160 } // namespace Qt4ProjectManager
162 #endif // QTQUICKAPP_H