OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / tests / manual / appwizards / main.cpp
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
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.
18 **
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.
22 **
23 ** Other Usage
24 **
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.
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 #include "qtquickapp.h"
34 #include "html5app.h"
35 #include <QtCore>
36
37 using namespace Qt4ProjectManager::Internal;
38
39 int main(int argc, char *argv[])
40 {
41     QString errorMessage;
42
43     const QString projectPath = QLatin1String("testprojects");
44
45     {
46         QtQuickApp sAppNew;
47         sAppNew.setProjectPath(projectPath);
48         sAppNew.setProjectName(QLatin1String("new_qml_app"));
49         if (!sAppNew.generateFiles(&errorMessage))
50            return 1;
51     }
52
53     {
54         QtQuickApp sAppImport01;
55         sAppImport01.setProjectPath(projectPath);
56         sAppImport01.setProjectName(QLatin1String("qml_imported_scenario_01"));
57         sAppImport01.setMainQml(QtQuickApp::ModeImport, QLatin1String("../appwizards/qmlimportscenario_01/myqmlapp.qml"));
58         if (!sAppImport01.generateFiles(&errorMessage))
59             return 1;
60     }
61
62     {
63         const QString rootPath = QLatin1String("../appwizards/qmlimportscenario_02/");
64         QtQuickApp sAppImport02;
65         sAppImport02.setProjectPath(projectPath);
66         sAppImport02.setProjectName(QLatin1String("qml_imported_scenario_02"));
67         sAppImport02.setMainQml(QtQuickApp::ModeImport, rootPath + QLatin1String("subfolder1/myqmlapp.qml"));
68         QStringList moduleNames;
69         moduleNames.append(QLatin1String("no.trolltech.QmlModule01"));
70         moduleNames.append(QLatin1String("com.nokia.QmlModule02"));
71         QStringList importPaths;
72         importPaths.append(rootPath + QLatin1String("subfolder2/"));
73         importPaths.append(rootPath + QLatin1String("subfolder3/"));
74         if (!sAppImport02.setExternalModules(moduleNames, importPaths)) {
75             qDebug() << sAppImport02.error();
76             return 2;
77         }
78         if (!sAppImport02.generateFiles(&errorMessage))
79             return 1;
80     }
81
82     {
83         Html5App sAppNew;
84         sAppNew.setProjectPath(projectPath);
85         sAppNew.setProjectName(QLatin1String("new_html5_app"));
86         qDebug() << sAppNew.path(Html5App::MainHtml);
87         if (!sAppNew.generateFiles(&errorMessage))
88            return 1;
89     }
90
91     {
92         Html5App sAppNew;
93         sAppNew.setProjectPath(projectPath);
94         sAppNew.setProjectName(QLatin1String("html5_imported_scenario_01"));
95         sAppNew.setMainHtml(Html5App::ModeImport, QLatin1String("../appwizards/htmlimportscenario_01/themainhtml.html"));
96         sAppNew.setTouchOptimizedNavigationEnabled(true);
97         qDebug() << sAppNew.path(Html5App::MainHtml);
98         if (!sAppNew.generateFiles(&errorMessage))
99            return 1;
100     }
101
102     {
103         Html5App sAppNew;
104         sAppNew.setProjectPath(projectPath);
105         sAppNew.setProjectName(QLatin1String("html5_url"));
106         sAppNew.setMainHtml(Html5App::ModeUrl, QLatin1String("http://www.jqtouch.com/preview/demos/main/"));
107         qDebug() << sAppNew.path(Html5App::MainHtml);
108         if (!sAppNew.generateFiles(&errorMessage))
109            return 1;
110     }
111
112     return 0;
113 }