summaryrefslogtreecommitdiff
path: root/src/plugins/qt4projectmanager/wizards/abstractmobileapp.h
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@nokia.com>2010-09-16 14:11:15 +0200
committerChristian Kandeler <christian.kandeler@nokia.com>2010-09-16 14:12:25 +0200
commitee85384cc99279a312289fb1baa98677b588a4b7 (patch)
treed237bb39e1604802e732e56b47e66c04f9693097 /src/plugins/qt4projectmanager/wizards/abstractmobileapp.h
parent1b0487d50550b472f30d0e79b98c574214a3af09 (diff)
downloadqt-creator-ee85384cc99279a312289fb1baa98677b588a4b7.tar.gz
QML/Mobile wizard: Factor out common parts.
Reviewed-by: Alessandro Portale
Diffstat (limited to 'src/plugins/qt4projectmanager/wizards/abstractmobileapp.h')
-rw-r--r--src/plugins/qt4projectmanager/wizards/abstractmobileapp.h170
1 files changed, 170 insertions, 0 deletions
diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileapp.h b/src/plugins/qt4projectmanager/wizards/abstractmobileapp.h
new file mode 100644
index 0000000000..23af085b45
--- /dev/null
+++ b/src/plugins/qt4projectmanager/wizards/abstractmobileapp.h
@@ -0,0 +1,170 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef ABSTRACTMOBILEAPP_H
+#define ABSTRACTMOBILEAPP_H
+
+#include <QtCore/QFileInfo>
+
+#ifndef CREATORLESSTEST
+#include <coreplugin/basefilewizard.h>
+#endif // CREATORLESSTEST
+
+QT_FORWARD_DECLARE_CLASS(QTextStream);
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+struct AbstractGeneratedFileInfo
+{
+ enum FileType {
+ MainQmlFile,
+ MainCppFile,
+ AppProFile,
+ DeploymentPriFile,
+ SymbianSvgIconFile,
+ MaemoPngIconFile,
+ DesktopFile,
+ ExtendedFile
+ };
+
+ AbstractGeneratedFileInfo();
+
+ bool isUpToDate() const;
+ bool wasModified() const;
+ virtual bool isOutdated() const=0;
+
+ int fileType;
+ QFileInfo fileInfo;
+ int version;
+ quint16 dataChecksum;
+ quint16 statedChecksum;
+};
+
+class AbstractMobileApp : public QObject
+{
+public:
+ enum Orientation {
+ LockLandscape,
+ LockPortrait,
+ Auto
+ };
+
+ enum FileType {
+ MainCpp,
+ MainCppOrigin,
+ AppPro,
+ AppProOrigin,
+ AppProPath,
+ Desktop,
+ DesktopOrigin,
+ DeploymentPri,
+ DeploymentPriOrigin,
+ SymbianSvgIcon,
+ SymbianSvgIconOrigin,
+ MaemoPngIcon,
+ MaemoPngIconOrigin,
+ ExtendedFile
+ };
+
+ virtual ~AbstractMobileApp();
+
+ void setOrientation(Orientation orientation);
+ Orientation orientation() const;
+ void setProjectName(const QString &name);
+ QString projectName() const;
+ void setProjectPath(const QString &path);
+ void setSymbianSvgIcon(const QString &icon);
+ QString symbianSvgIcon() const;
+ void setMaemoPngIcon(const QString &icon);
+ QString maemoPngIcon() const;
+ void setSymbianTargetUid(const QString &uid);
+ QString symbianTargetUid() const;
+ void setNetworkEnabled(bool enabled);
+ bool networkEnabled() const;
+
+ static QString symbianUidForPath(const QString &path);
+ static int makeStubVersion(int minor);
+ QString path(int fileType) const;
+ QString error() const;
+
+ static const QString DeploymentPriFileName;
+protected:
+ AbstractMobileApp();
+
+ static QString templatesRoot();
+ static void insertParameter(QString &line, const QString &parameter);
+
+ QByteArray readBlob(const QString &filePath, QString *errorMsg) const;
+#ifndef CREATORLESSTEST
+ virtual Core::GeneratedFiles generateFiles(QString *errorMessage) const;
+ static Core::GeneratedFile file(const QByteArray &data,
+ const QString &targetFile);
+#else
+ bool generateFiles(QString *errorMessage) const;
+#endif // CREATORLESSTEST
+ QByteArray generateFile(int fileType, QString *errorMessage) const;
+ QString outputPathBase() const;
+
+ static const QString CFileComment;
+ static const QString ProFileComment;
+ static const QString FileChecksum;
+ static const QString FileStubVersion;
+ static const int StubVersion;
+
+ QString m_error;
+private:
+ QByteArray generateDesktopFile(QString *errorMessage) const;
+ QByteArray generateMainCpp(QString *errorMessage) const;
+ QByteArray generateProFile(QString *errorMessage) const;
+
+ virtual QByteArray generateFileExtended(int fileType,
+ bool *versionAndCheckSum, QString *comment, QString *errorMessage) const=0;
+ virtual QString pathExtended(int fileType) const=0;
+ virtual QString originsRoot() const=0;
+ virtual QString mainWindowClassName() const=0;
+ virtual int stubVersionMinor() const=0;
+ virtual bool adaptCurrentMainCppTemplateLine(QString &line) const=0;
+ virtual void handleCurrentProFileTemplateLine(const QString &line,
+ QTextStream &proFileTemplate, QTextStream &proFile,
+ bool &uncommentNextLine) const=0;
+
+ QString m_projectName;
+ QFileInfo m_projectPath;
+ QString m_symbianSvgIcon;
+ QString m_maemoPngIcon;
+ QString m_symbianTargetUid;
+ Orientation m_orientation;
+ bool m_networkEnabled;
+};
+
+} // end of namespace Internal
+} // end of namespace Qt4ProjectManager
+
+#endif // ABSTRACTMOBILEAPP_H