| 
									
										
										
										
											2011-02-18 14:48:16 +01:00
										 |  |  | /**************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** This file is part of Qt Creator | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-01-26 18:33:46 +01:00
										 |  |  | ** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). | 
					
						
							| 
									
										
										
										
											2011-02-18 14:48:16 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-11-02 15:59:12 +01:00
										 |  |  | ** Contact: Nokia Corporation (qt-info@nokia.com) | 
					
						
							| 
									
										
										
										
											2011-02-18 14:48:16 +01:00
										 |  |  | ** | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** GNU Lesser General Public License Usage | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** 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.
 | 
					
						
							| 
									
										
										
										
											2011-02-18 14:48:16 +01:00
										 |  |  | ** | 
					
						
							|  |  |  | ** In addition, as a special exception, Nokia gives you certain additional | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** rights. These rights are described in the Nokia Qt LGPL Exception | 
					
						
							| 
									
										
										
										
											2011-02-18 14:48:16 +01:00
										 |  |  | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** 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. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-02-18 14:48:16 +01:00
										 |  |  | ** If you have questions regarding the use of this file, please contact | 
					
						
							| 
									
										
										
										
											2011-11-02 15:59:12 +01:00
										 |  |  | ** Nokia at qt-info@nokia.com. | 
					
						
							| 
									
										
										
										
											2011-02-18 14:48:16 +01:00
										 |  |  | ** | 
					
						
							|  |  |  | **************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-06 16:23:02 +01:00
										 |  |  | #include "qtquickapp.h"
 | 
					
						
							| 
									
										
										
										
											2011-02-05 23:08:59 +01:00
										 |  |  | #include "html5app.h"
 | 
					
						
							| 
									
										
										
										
											2010-11-15 22:14:14 +01:00
										 |  |  | #include <QtCore>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-15 13:34:44 +01:00
										 |  |  | using namespace Qt4ProjectManager; | 
					
						
							| 
									
										
										
										
											2010-11-15 22:14:14 +01:00
										 |  |  | using namespace Qt4ProjectManager::Internal; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static bool writeFile(const QByteArray &data, const QString &targetFile) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     const QFileInfo fileInfo(targetFile); | 
					
						
							|  |  |  |     QDir().mkpath(fileInfo.absolutePath()); | 
					
						
							|  |  |  |     QFile file(fileInfo.absoluteFilePath()); | 
					
						
							|  |  |  |     file.open(QIODevice::WriteOnly); | 
					
						
							|  |  |  |     Q_ASSERT(file.isOpen()); | 
					
						
							|  |  |  |     return file.write(data) != -1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-06 16:23:02 +01:00
										 |  |  | bool QtQuickApp::generateFiles(QString *errorMessage) const | 
					
						
							| 
									
										
										
										
											2010-11-15 22:14:14 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-02-06 16:23:02 +01:00
										 |  |  |     return     writeFile(generateFile(QtQuickAppGeneratedFileInfo::MainCppFile, errorMessage), path(MainCpp)) | 
					
						
							|  |  |  |             && writeFile(generateFile(QtQuickAppGeneratedFileInfo::AppProFile, errorMessage), path(AppPro)) | 
					
						
							| 
									
										
										
										
											2011-04-17 09:57:07 +02:00
										 |  |  |             && (m_mainQmlMode == ModeImport ? true : writeFile(generateFile(QtQuickAppGeneratedFileInfo::MainQmlFile, errorMessage), path(MainQml))) | 
					
						
							| 
									
										
										
										
											2011-02-06 16:23:02 +01:00
										 |  |  |             && writeFile(generateFile(QtQuickAppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)) | 
					
						
							|  |  |  |             && writeFile(generateFile(QtQuickAppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)) | 
					
						
							|  |  |  |             && writeFile(generateFile(QtQuickAppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH)) | 
					
						
							|  |  |  |             && writeFile(generateFile(QtQuickAppGeneratedFileInfo::SymbianSvgIconFile, errorMessage), path(SymbianSvgIcon)) | 
					
						
							| 
									
										
										
										
											2011-09-13 19:21:52 +02:00
										 |  |  |             && writeFile(generateFile(QtQuickAppGeneratedFileInfo::PngIcon64File, errorMessage), path(PngIcon64)) | 
					
						
							|  |  |  |             && writeFile(generateFile(QtQuickAppGeneratedFileInfo::PngIcon80File, errorMessage), path(PngIcon80)) | 
					
						
							|  |  |  |             && writeFile(generateFile(QtQuickAppGeneratedFileInfo::DesktopFremantleFile, errorMessage), path(DesktopFremantle)) | 
					
						
							|  |  |  |             && writeFile(generateFile(QtQuickAppGeneratedFileInfo::DesktopHarmattanFile, errorMessage), path(DesktopHarmattan)); | 
					
						
							| 
									
										
										
										
											2010-11-15 22:14:14 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-05 23:08:59 +01:00
										 |  |  | bool Html5App::generateFiles(QString *errorMessage) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return     writeFile(generateFile(Html5AppGeneratedFileInfo::MainCppFile, errorMessage), path(MainCpp)) | 
					
						
							|  |  |  |             && writeFile(generateFile(Html5AppGeneratedFileInfo::AppProFile, errorMessage), path(AppPro)) | 
					
						
							| 
									
										
										
										
											2011-02-09 16:23:35 +01:00
										 |  |  |             && (mainHtmlMode() != ModeGenerate ? true : writeFile(generateFile(Html5AppGeneratedFileInfo::MainHtmlFile, errorMessage), path(MainHtml))) | 
					
						
							| 
									
										
										
										
											2011-02-05 23:08:59 +01:00
										 |  |  |             && writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)) | 
					
						
							|  |  |  |             && writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)) | 
					
						
							|  |  |  |             && writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH)) | 
					
						
							|  |  |  |             && writeFile(generateFile(Html5AppGeneratedFileInfo::SymbianSvgIconFile, errorMessage), path(SymbianSvgIcon)) | 
					
						
							| 
									
										
										
										
											2011-09-13 19:21:52 +02:00
										 |  |  |             && writeFile(generateFile(Html5AppGeneratedFileInfo::PngIcon64File, errorMessage), path(PngIcon64)) | 
					
						
							|  |  |  |             && writeFile(generateFile(Html5AppGeneratedFileInfo::PngIcon80File, errorMessage), path(PngIcon80)) | 
					
						
							|  |  |  |             && writeFile(generateFile(Html5AppGeneratedFileInfo::DesktopFremantleFile, errorMessage), path(DesktopFremantle)) | 
					
						
							|  |  |  |             && writeFile(generateFile(Html5AppGeneratedFileInfo::DesktopHarmattanFile, errorMessage), path(DesktopHarmattan)); | 
					
						
							| 
									
										
										
										
											2011-02-05 23:08:59 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-15 22:14:14 +01:00
										 |  |  | QString AbstractMobileApp::templatesRoot() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QLatin1String("../../../share/qtcreator/templates/"); | 
					
						
							|  |  |  | } |