diff --git a/share/qtcreator/templates/qtquick/qtquick_2_1/app.pro b/share/qtcreator/templates/qtquick/qtquick_2_1/app.pro deleted file mode 100644 index fa61ce669e3..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_1/app.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app - -QT += qml quick - -SOURCES += main.cpp - -RESOURCES += qml.qrc - -# Additional import path used to resolve QML modules in Qt Creator's code model -# QML_IMPORT_PATH # -QML_IMPORT_PATH = - -# Default rules for deployment. -include(../../shared/qrcdeployment.pri) diff --git a/share/qtcreator/templates/qtquick/qtquick_2_1/main.cpp b/share/qtcreator/templates/qtquick/qtquick_2_1/main.cpp deleted file mode 100644 index d76049d67eb..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_1/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/share/qtcreator/templates/qtquick/qtquick_2_1/main.qml b/share/qtcreator/templates/qtquick/qtquick_2_1/main.qml deleted file mode 100644 index e3c67118eae..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_1/main.qml +++ /dev/null @@ -1,20 +0,0 @@ -import QtQuick 2.1 -import QtQuick.Window 2.0 - -Window { - visible: true - width: 360 - height: 360 - - MouseArea { - anchors.fill: parent - onClicked: { - Qt.quit(); - } - } - - Text { - text: qsTr("Hello World") - anchors.centerIn: parent - } -} diff --git a/share/qtcreator/templates/qtquick/qtquick_2_1/qml.qrc b/share/qtcreator/templates/qtquick/qtquick_2_1/qml.qrc deleted file mode 100644 index 5f6483ac33f..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_1/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/share/qtcreator/templates/qtquick/qtquick_2_1/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_1/template.xml deleted file mode 100644 index 831f3157a66..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_1/template.xml +++ /dev/null @@ -1,7 +0,0 @@ - - diff --git a/share/qtcreator/templates/qtquick/qtquick_2_2/app.pro b/share/qtcreator/templates/qtquick/qtquick_2_2/app.pro deleted file mode 100644 index fa61ce669e3..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_2/app.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app - -QT += qml quick - -SOURCES += main.cpp - -RESOURCES += qml.qrc - -# Additional import path used to resolve QML modules in Qt Creator's code model -# QML_IMPORT_PATH # -QML_IMPORT_PATH = - -# Default rules for deployment. -include(../../shared/qrcdeployment.pri) diff --git a/share/qtcreator/templates/qtquick/qtquick_2_2/main.qml b/share/qtcreator/templates/qtquick/qtquick_2_2/main.qml deleted file mode 100644 index f09ac334069..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_2/main.qml +++ /dev/null @@ -1,20 +0,0 @@ -import QtQuick 2.2 -import QtQuick.Window 2.1 - -Window { - visible: true - width: 360 - height: 360 - - MouseArea { - anchors.fill: parent - onClicked: { - Qt.quit(); - } - } - - Text { - text: qsTr("Hello World") - anchors.centerIn: parent - } -} diff --git a/share/qtcreator/templates/qtquick/qtquick_2_2/qml.qrc b/share/qtcreator/templates/qtquick/qtquick_2_2/qml.qrc deleted file mode 100644 index 5f6483ac33f..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_2/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/share/qtcreator/templates/qtquick/qtquick_2_2/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_2/template.xml deleted file mode 100644 index 98f7f7f7e29..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_2/template.xml +++ /dev/null @@ -1,7 +0,0 @@ - - diff --git a/share/qtcreator/templates/qtquick/qtquick_2_3/app.pro b/share/qtcreator/templates/qtquick/qtquick_2_3/app.pro deleted file mode 100644 index fa61ce669e3..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_3/app.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app - -QT += qml quick - -SOURCES += main.cpp - -RESOURCES += qml.qrc - -# Additional import path used to resolve QML modules in Qt Creator's code model -# QML_IMPORT_PATH # -QML_IMPORT_PATH = - -# Default rules for deployment. -include(../../shared/qrcdeployment.pri) diff --git a/share/qtcreator/templates/qtquick/qtquick_2_3/main.cpp b/share/qtcreator/templates/qtquick/qtquick_2_3/main.cpp deleted file mode 100644 index d76049d67eb..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_3/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/share/qtcreator/templates/qtquick/qtquick_2_3/main.qml b/share/qtcreator/templates/qtquick/qtquick_2_3/main.qml deleted file mode 100644 index af32f2eff97..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_3/main.qml +++ /dev/null @@ -1,20 +0,0 @@ -import QtQuick 2.3 -import QtQuick.Window 2.2 - -Window { - visible: true - width: 360 - height: 360 - - MouseArea { - anchors.fill: parent - onClicked: { - Qt.quit(); - } - } - - Text { - text: qsTr("Hello World") - anchors.centerIn: parent - } -} diff --git a/share/qtcreator/templates/qtquick/qtquick_2_3/qml.qrc b/share/qtcreator/templates/qtquick/qtquick_2_3/qml.qrc deleted file mode 100644 index 5f6483ac33f..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_3/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/share/qtcreator/templates/qtquick/qtquick_2_3/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_3/template.xml deleted file mode 100644 index b74ec0d2bef..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_3/template.xml +++ /dev/null @@ -1,7 +0,0 @@ - - diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/main.cpp b/share/qtcreator/templates/qtquick/qtquick_2_4/main.cpp deleted file mode 100644 index d76049d67eb..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/main.qml b/share/qtcreator/templates/qtquick/qtquick_2_4/main.qml deleted file mode 100644 index cc82a9271cb..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/main.qml +++ /dev/null @@ -1,13 +0,0 @@ -import QtQuick 2.4 -import QtQuick.Window 2.2 - -Window { - visible: true - MainForm { - anchors.fill: parent - mouseArea.onClicked: { - Qt.quit(); - } - - } -} diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_4/template.xml deleted file mode 100644 index f8fed165a9a..00000000000 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/template.xml +++ /dev/null @@ -1,7 +0,0 @@ - - diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/main.qml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/main.qml deleted file mode 100644 index 3498b9459c3..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/main.qml +++ /dev/null @@ -1,28 +0,0 @@ -import QtQuick 2.1 -import QtQuick.Controls 1.0 - -ApplicationWindow { - visible: true - width: 640 - height: 480 - title: qsTr("Hello World") - - menuBar: MenuBar { - Menu { - title: qsTr("File") - MenuItem { - text: qsTr("&Open") - onTriggered: console.log("Open action triggered"); - } - MenuItem { - text: qsTr("Exit") - onTriggered: Qt.quit(); - } - } - } - - Label { - text: qsTr("Hello World") - anchors.centerIn: parent - } -} diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qml.qrc b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qml.qrc deleted file mode 100644 index 5f6483ac33f..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml deleted file mode 100644 index 4a55e77a867..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml +++ /dev/null @@ -1,7 +0,0 @@ - - diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro deleted file mode 100644 index 5a1721702fd..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app - -QT += qml quick widgets -CONFIG += c++11 - -SOURCES += main.cpp - -RESOURCES += qml.qrc - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -# Default rules for deployment. -include(../../shared/qrcdeployment.pri) diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/main.cpp b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/main.cpp deleted file mode 100644 index 1e5bf587b39..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/main.qml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/main.qml deleted file mode 100644 index 57bd8901efa..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/main.qml +++ /dev/null @@ -1,28 +0,0 @@ -import QtQuick 2.2 -import QtQuick.Controls 1.1 - -ApplicationWindow { - visible: true - width: 640 - height: 480 - title: qsTr("Hello World") - - menuBar: MenuBar { - Menu { - title: qsTr("File") - MenuItem { - text: qsTr("&Open") - onTriggered: console.log("Open action triggered"); - } - MenuItem { - text: qsTr("Exit") - onTriggered: Qt.quit(); - } - } - } - - Label { - text: qsTr("Hello World") - anchors.centerIn: parent - } -} diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/qml.qrc b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/qml.qrc deleted file mode 100644 index 5f6483ac33f..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/template.xml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/template.xml deleted file mode 100644 index cf7b24110c4..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/template.xml +++ /dev/null @@ -1,7 +0,0 @@ - - diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/app.pro b/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/app.pro deleted file mode 100644 index 5a1721702fd..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/app.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app - -QT += qml quick widgets -CONFIG += c++11 - -SOURCES += main.cpp - -RESOURCES += qml.qrc - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -# Default rules for deployment. -include(../../shared/qrcdeployment.pri) diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/main.cpp b/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/main.cpp deleted file mode 100644 index 1e5bf587b39..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/main.qml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/main.qml deleted file mode 100644 index 5c7e2a73924..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/main.qml +++ /dev/null @@ -1,28 +0,0 @@ -import QtQuick 2.3 -import QtQuick.Controls 1.2 - -ApplicationWindow { - visible: true - width: 640 - height: 480 - title: qsTr("Hello World") - - menuBar: MenuBar { - Menu { - title: qsTr("File") - MenuItem { - text: qsTr("&Open") - onTriggered: console.log("Open action triggered"); - } - MenuItem { - text: qsTr("Exit") - onTriggered: Qt.quit(); - } - } - } - - Label { - text: qsTr("Hello World") - anchors.centerIn: parent - } -} diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/qml.qrc b/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/qml.qrc deleted file mode 100644 index 5f6483ac33f..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/template.xml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/template.xml deleted file mode 100644 index 4f7e618489e..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_2/template.xml +++ /dev/null @@ -1,7 +0,0 @@ - - diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/app.pro b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/app.pro deleted file mode 100644 index 5a1721702fd..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/app.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app - -QT += qml quick widgets -CONFIG += c++11 - -SOURCES += main.cpp - -RESOURCES += qml.qrc - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -# Default rules for deployment. -include(../../shared/qrcdeployment.pri) diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.cpp b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.cpp deleted file mode 100644 index 1e5bf587b39..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/template.xml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/template.xml deleted file mode 100644 index 1a4c7ff8a58..00000000000 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/template.xml +++ /dev/null @@ -1,7 +0,0 @@ - - diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/MainForm.ui.qml b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/MainForm.ui.qml similarity index 87% rename from share/qtcreator/templates/qtquick/qtquick_2_4/MainForm.ui.qml rename to share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/MainForm.ui.qml index 2443b996e2d..5718eeef36d 100644 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/MainForm.ui.qml +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/MainForm.ui.qml @@ -1,4 +1,4 @@ -import QtQuick 2.4 +import QtQuick %{QtQuickVersion} Rectangle { property alias mouseArea: mouseArea diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/app.pro b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/app.pro similarity index 71% rename from share/qtcreator/templates/qtquick/qtquick_2_4/app.pro rename to share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/app.pro index 138b6c4ded4..e7f80007633 100644 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/app.pro +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/app.pro @@ -3,13 +3,12 @@ TEMPLATE = app QT += qml quick CONFIG += c++11 -SOURCES += main.cpp +SOURCES += %{MainCppFileName} RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model -# QML_IMPORT_PATH # QML_IMPORT_PATH = # Default rules for deployment. -include(../../shared/qrcdeployment.pri) +include(deployment.pri) diff --git a/share/qtcreator/templates/qtquick/qtquick_2_2/main.cpp b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/main.cpp similarity index 62% rename from share/qtcreator/templates/qtquick/qtquick_2_2/main.cpp rename to share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/main.cpp index d76049d67eb..4e5502760e4 100644 --- a/share/qtcreator/templates/qtquick/qtquick_2_2/main.cpp +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/main.cpp @@ -1,6 +1,5 @@ -#include -#include - +%{Cpp:LicenseTemplate}\ +%{JS: QtSupport.qtIncludes([], ["QGui/QGuiApplication", "QQml/QQmlApplicationEngine"])} int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/main.qml b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/main.qml new file mode 100644 index 00000000000..5ab93ecb205 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/main.qml @@ -0,0 +1,27 @@ +import QtQuick %{QtQuickVersion} +import QtQuick.Window %{QtQuickWindowVersion} + +Window { + visible: true + +@if %{QmlUISplit} + MainForm { + anchors.fill: parent + mouseArea.onClicked: { + Qt.quit(); + } + } +@else + MouseArea { + anchors.fill: parent + onClicked: { + Qt.quit(); + } + } + + Text { + text: qsTr("Hello World") + anchors.centerIn: parent + } +@endif +} diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/qml.qrc b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/qml.qrc similarity index 83% rename from share/qtcreator/templates/qtquick/qtquickcontrols_1_3/qml.qrc rename to share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/qml.qrc index 7684346a52b..068979cb030 100644 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/qml.qrc +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/qml.qrc @@ -1,6 +1,8 @@ main.qml +@if %{QmlUISplit} MainForm.ui.qml +@endif diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json new file mode 100644 index 00000000000..0eccd4c5785 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json @@ -0,0 +1,132 @@ +{ + "version": 1, + "kind": "project", + "id": "U.QtQuickApplication", + "category": "F.Application", + "trDescription": "Creates a deployable Qt Quick 2 application.", + "trDisplayName": "Qt Quick Application", + "trDisplayCategory": "Application", + "icon": "../../../global/guiapplication.png", + "featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.2.4", "Plugin.QmakeProjectManager", "QtSupport.Wizards.FeatureQt" ], + + "options": + [ + { "key": "ProFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, + { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, + { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.qtQuickVersion}" }, + { "key": "QtQuickWindowVersion", "value": "%{JS: %{QtVersion}.qtQuickWindowVersion}" } + ], + + "pages": + [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project", + "data": { "trDescription": "Creates a deployable Qt Quick 2 application." } + }, + { + "trDisplayName": "Define Project Details", + "trShortTitle": "Details", + "typeId": "Fields", + "data": + [ + { + "name": "QtVersion", + "trDisplayName": "Minimal required Qt version:", + "type": "ComboBox", + "data": + { + "items": + [ + { + "trKey": "Qt 5.5", + "value": + "{ + 'qtQuickVersion': '2.5', + 'qtQuickWindowVersion': '2.2' + }" + }, + { + "trKey": "Qt 5.4", + "value": + "{ + 'qtQuickVersion': '2.4', + 'qtQuickWindowVersion': '2.2' + }" + }, + { + "trKey": "Qt 5.3", + "value": + "{ + 'qtQuickVersion': '2.3', + 'qtQuickWindowVersion': '2.2' + }" + } + ] + } + }, + { + "name": "QmlUISplit", + "trDisplayName": "With ui.qml file", + "type": "CheckBox", + "data": + { + "checkedValue": true, + "uncheckedValue": false, + "checked": false + } + } + ] + }, + { + "trDisplayName": "Kit Selection", + "trShortTitle": "Kits", + "typeId": "Kits", + "data": { "projectFilePath": "%{ProFileName}" } + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "app.pro", + "target": "%{ProFileName}", + "openAsProject": true + }, + { + "source": "main.cpp", + "target": "%{MainCppFileName}" + }, + { + "source": "main.qml", + "openInEditor": true + }, + { + "source": "MainForm.ui.qml", + "condition": "%{QmlUISplit}" + }, + { + "source": "qml.qrc" + }, + { + "source": "../../../../shared/qrcdeployment.pri", + "target": "%{ProjectDirectory}/deployment.pri" + }, + { + "source": "../git.ignore", + "target": "%{ProjectDirectory}/.gitignore", + "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + } + ] + } + ] +} diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/MainForm.ui.qml b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/MainForm.ui.qml similarity index 63% rename from share/qtcreator/templates/qtquick/qtquickcontrols_1_3/MainForm.ui.qml rename to share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/MainForm.ui.qml index e557debb83b..b862987816a 100644 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/MainForm.ui.qml +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/MainForm.ui.qml @@ -1,14 +1,13 @@ -import QtQuick 2.4 -import QtQuick.Controls 1.3 -import QtQuick.Layouts 1.1 +import QtQuick %{QtQuickVersion} +import QtQuick.Controls %{QtQuickControlsVersion} +import QtQuick.Layouts %{QtQuickLayoutsVersion} Item { width: 640 height: 480 - property alias button3: button3 - property alias button2: button2 property alias button1: button1 + property alias button2: button2 RowLayout { anchors.centerIn: parent @@ -22,10 +21,5 @@ Item { id: button2 text: qsTr("Press Me 2") } - - Button { - id: button3 - text: qsTr("Press Me 3") - } } } diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/app.pro similarity index 76% rename from share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro rename to share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/app.pro index 1c260786ad7..25c9afc27e7 100644 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/app.pro @@ -2,7 +2,7 @@ TEMPLATE = app QT += qml quick widgets -SOURCES += main.cpp +SOURCES += %{MainCppFileName} RESOURCES += qml.qrc @@ -10,4 +10,4 @@ RESOURCES += qml.qrc QML_IMPORT_PATH = # Default rules for deployment. -include(../../shared/qrcdeployment.pri) +include(deployment.pri) diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/main.cpp b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/main.cpp similarity index 62% rename from share/qtcreator/templates/qtquick/qtquickcontrols_1_0/main.cpp rename to share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/main.cpp index 1e5bf587b39..6ea3921b635 100644 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/main.cpp +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/main.cpp @@ -1,6 +1,5 @@ -#include -#include - +%{Cpp:LicenseTemplate}\ +%{JS: QtSupport.qtIncludes([], ["QWidgets/QApplication", "QQml/QQmlApplicationEngine"])} int main(int argc, char *argv[]) { QApplication app(argc, argv); diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.qml b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/main.qml similarity index 64% rename from share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.qml rename to share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/main.qml index e09bc3d47c7..f581c7c226c 100644 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.qml +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/main.qml @@ -1,33 +1,34 @@ -import QtQuick 2.4 -import QtQuick.Controls 1.3 -import QtQuick.Window 2.2 -import QtQuick.Dialogs 1.2 +import QtQuick %{QtQuickVersion} +import QtQuick.Controls %{QtQuickControlsVersion} +@if %{QmlUISplit} +import QtQuick.Dialogs %{QtQuickDialogsVersion} +@endif ApplicationWindow { - title: qsTr("Hello World") + visible: true width: 640 height: 480 - visible: true + title: qsTr("Hello World") menuBar: MenuBar { Menu { - title: qsTr("&File") + title: qsTr("File") MenuItem { text: qsTr("&Open") - onTriggered: messageDialog.show(qsTr("Open action triggered")); + onTriggered: console.log("Open action triggered"); } MenuItem { - text: qsTr("E&xit") + text: qsTr("Exit") onTriggered: Qt.quit(); } } } +@if %{QmlUISplit} MainForm { anchors.fill: parent button1.onClicked: messageDialog.show(qsTr("Button 1 pressed")) button2.onClicked: messageDialog.show(qsTr("Button 2 pressed")) - button3.onClicked: messageDialog.show(qsTr("Button 3 pressed")) } MessageDialog { @@ -39,4 +40,10 @@ ApplicationWindow { messageDialog.open(); } } +@else + Label { + text: qsTr("Hello World") + anchors.centerIn: parent + } +@endif } diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/qml.qrc b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/qml.qrc similarity index 83% rename from share/qtcreator/templates/qtquick/qtquick_2_4/qml.qrc rename to share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/qml.qrc index 7684346a52b..068979cb030 100644 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/qml.qrc +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/qml.qrc @@ -1,6 +1,8 @@ main.qml +@if %{QmlUISplit} MainForm.ui.qml +@endif diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/wizard.json new file mode 100644 index 00000000000..f50e5e80b93 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/wizard.json @@ -0,0 +1,140 @@ +{ + "version": 1, + "kind": "project", + "id": "U.QtQuickControlsApplication", + "category": "F.Application", + "trDescription": "Creates a deployable Qt Quick 2 application using Qt Quick Controls.", + "trDisplayName": "Qt Quick Controls Application", + "trDisplayCategory": "Application", + "icon": "../../../global/guiapplication.png", + "featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.Controls.1.3", "Plugin.QmakeProjectManager", "QtSupport.Wizards.FeatureQt" ], + + "options": + [ + { "key": "ProFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, + { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, + { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.qtQuickVersion}" }, + { "key": "QtQuickControlsVersion", "value": "%{JS: %{QtVersion}.qtQuickControlsVersion}" }, + { "key": "QtQuickDialogsVersion", "value": "%{JS: %{QtVersion}.qtQuickDialogsVersion}" }, + { "key": "QtQuickLayoutsVersion", "value": "%{JS: %{QtVersion}.qtQuickLayoutsVersion}" } + ], + + "pages": + [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project", + "data": { "trDescription": "Creates a deployable Qt Quick 2 application using Qt Quick Controls." } + }, + { + "trDisplayName": "Define Project Details", + "trShortTitle": "Details", + "typeId": "Fields", + "data": + [ + { + "name": "QtVersion", + "trDisplayName": "Minimal required Qt version:", + "type": "ComboBox", + "data": + { + "items": + [ + { + "trKey": "Qt 5.5", + "value": + "{ + 'qtQuickVersion': '2.5', + 'qtQuickControlsVersion': '1.3', + 'qtQuickDialogsVersion': '1.2', + 'qtQuickLayoutsVersion': '1.2' + }" + }, + { + "trKey": "Qt 5.4", + "value": + "{ + 'qtQuickVersion': '2.4', + 'qtQuickControlsVersion': '1.2', + 'qtQuickDialogsVersion': '1.2', + 'qtQuickLayoutsVersion': '1.1' + }" + }, + { + "trKey": "Qt 5.3", + "value": + "{ + 'qtQuickVersion': '2.3', + 'qtQuickControlsVersion': '1.2', + 'qtQuickDialogsVersion': '1.2', + 'qtQuickLayoutsVersion': '1.1' + }" + } + ] + } + }, + { + "name": "QmlUISplit", + "trDisplayName": "With ui.qml file", + "type": "CheckBox", + "data": + { + "checkedValue": true, + "uncheckedValue": false, + "checked": true + } + } + ] + }, + { + "trDisplayName": "Kit Selection", + "trShortTitle": "Kits", + "typeId": "Kits", + "data": { "projectFilePath": "%{ProFileName}" } + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "app.pro", + "target": "%{ProFileName}", + "openAsProject": true + }, + { + "source": "main.cpp", + "target": "%{MainCppFileName}" + }, + { + "source": "main.qml", + "openInEditor": true + }, + { + "source": "MainForm.ui.qml", + "condition": "%{QmlUISplit}" + }, + { + "source": "qml.qrc" + }, + { + "source": "../../../../shared/qrcdeployment.pri", + "target": "%{ProjectDirectory}/deployment.pri" + }, + { + "source": "../git.ignore", + "target": "%{ProjectDirectory}/.gitignore", + "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + } + ] + } + ] +} diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 005437266fb..3a979591f3f 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -38,8 +38,6 @@ #include "qmakeprojectmanagerconstants.h" #include "qmakebuildconfiguration.h" #include "findqmakeprofiles.h" -#include "wizards/abstractmobileapp.h" -#include "wizards/qtquickapp.h" #include #include diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp index d7f762e10b2..d8614bf7c8c 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp @@ -38,7 +38,6 @@ #include "qmakestep.h" #include "qmakebuildconfiguration.h" #include "addlibrarywizard.h" -#include "wizards/qtquickapp.h" #include #include diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro index 204ea2adf4e..d8199278657 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro @@ -31,11 +31,6 @@ HEADERS += \ wizards/modulespage.h \ wizards/filespage.h \ wizards/qtwizard.h \ - wizards/qtquickapp.h \ - wizards/qtquickappwizard.h \ - wizards/qtquickappwizardpages.h \ - wizards/abstractmobileapp.h \ - wizards/abstractmobileappwizard.h \ wizards/subdirsprojectwizard.h \ wizards/subdirsprojectwizarddialog.h \ qmakeprojectmanagerconstants.h \ @@ -80,11 +75,6 @@ SOURCES += \ wizards/modulespage.cpp \ wizards/filespage.cpp \ wizards/qtwizard.cpp \ - wizards/qtquickapp.cpp \ - wizards/qtquickappwizard.cpp \ - wizards/qtquickappwizardpages.cpp \ - wizards/abstractmobileapp.cpp \ - wizards/abstractmobileappwizard.cpp \ wizards/subdirsprojectwizard.cpp \ wizards/subdirsprojectwizarddialog.cpp \ makestep.cpp \ diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs index 24e1d9f158e..7a7b0fe8ab5 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs @@ -85,8 +85,6 @@ QtcPlugin { name: "Wizards" prefix: "wizards/" files: [ - "abstractmobileapp.cpp", "abstractmobileapp.h", - "abstractmobileappwizard.cpp", "abstractmobileappwizard.h", "consoleappwizard.cpp", "consoleappwizard.h", "consoleappwizarddialog.cpp", "consoleappwizarddialog.h", "filespage.cpp", "filespage.h", @@ -97,9 +95,6 @@ QtcPlugin { "librarywizarddialog.cpp", "librarywizarddialog.h", "modulespage.cpp", "modulespage.h", "qtprojectparameters.cpp", "qtprojectparameters.h", - "qtquickapp.cpp", "qtquickapp.h", - "qtquickappwizard.cpp", "qtquickappwizard.h", - "qtquickappwizardpages.cpp", "qtquickappwizardpages.h", "qtwizard.cpp", "qtwizard.h", "subdirsprojectwizard.cpp", "subdirsprojectwizard.h", "subdirsprojectwizarddialog.cpp", "subdirsprojectwizarddialog.h", diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index c91a99b7aff..4bed7d8df48 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -42,7 +42,6 @@ #include "wizards/librarywizard.h" #include "wizards/testwizard.h" #include "wizards/subdirsprojectwizard.h" -#include "wizards/qtquickappwizard.h" #include "customwidgetwizard/customwidgetwizard.h" #include "qmakeprojectmanagerconstants.h" #include "qmakeproject.h" @@ -110,7 +109,6 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString addAutoReleasedObject(new SubdirsProjectWizard); addAutoReleasedObject(new GuiAppWizard); addAutoReleasedObject(new ConsoleAppWizard); - addAutoReleasedObject(new QtQuickAppWizard); addAutoReleasedObject(new LibraryWizard); addAutoReleasedObject(new TestWizard); addAutoReleasedObject(new CustomWidgetWizard); diff --git a/src/plugins/qmakeprojectmanager/wizards/abstractmobileapp.cpp b/src/plugins/qmakeprojectmanager/wizards/abstractmobileapp.cpp deleted file mode 100644 index 503dddff7d2..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/abstractmobileapp.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "abstractmobileapp.h" - -#include -#include -#include - -#ifndef CREATORLESSTEST -#include -#endif // CREATORLESSTEST - -#include -#include - -namespace QmakeProjectManager { - -AbstractGeneratedFileInfo::AbstractGeneratedFileInfo() - : fileType(ExtendedFile) - , currentVersion(-1) - , version(-1) - , dataChecksum(0) - , statedChecksum(0) -{ -} - -const QString AbstractMobileApp::CFileComment(QLatin1String("//")); -const QString AbstractMobileApp::ProFileComment(QLatin1Char('#')); - -AbstractMobileApp::AbstractMobileApp() - : QObject() -{ -} - -AbstractMobileApp::~AbstractMobileApp() { } - -void AbstractMobileApp::setProjectName(const QString &name) -{ - m_projectName = name; -} - -QString AbstractMobileApp::projectName() const -{ - return m_projectName; -} - -void AbstractMobileApp::setProjectPath(const QString &path) -{ - m_projectPath.setFile(path); -} - -QString AbstractMobileApp::path(int fileType) const -{ - const QString originsRootApp = originsRoot(); - const QString mainCppFileName = QLatin1String("main.cpp"); - switch (fileType) { - case MainCpp: return outputPathBase() + mainCppFileName; - case MainCppOrigin: return originsRootApp + mainCppFileName; - case AppPro: return outputPathBase() + m_projectName + QLatin1String(".pro"); - case AppProOrigin: return originsRootApp + QLatin1String("app.pro"); - case AppProPath: return outputPathBase(); - default: return pathExtended(fileType); - } - return QString(); -} - -bool AbstractMobileApp::readTemplate(int fileType, QByteArray *data, QString *errorMessage) const -{ - Utils::FileReader reader; - if (!reader.fetch(path(fileType), errorMessage)) - return false; - *data = reader.data(); - return true; -} - -QByteArray AbstractMobileApp::generateMainCpp(QString *errorMessage) const -{ - QByteArray mainCppInput; - if (!readTemplate(MainCppOrigin, &mainCppInput, errorMessage)) - return QByteArray(); - QTextStream in(&mainCppInput); - - QByteArray mainCppContent; - QTextStream out(&mainCppContent, QIODevice::WriteOnly | QIODevice::Text); - - QString line; - while (!(line = in.readLine()).isNull()) { - bool adaptLine = true; - if (line.contains(QLatin1String("// DELETE_LINE"))) - continue; // omit this line in the output - else - adaptLine = adaptCurrentMainCppTemplateLine(line); - if (adaptLine) { - const int commentIndex = line.indexOf(QLatin1String(" //")); - if (commentIndex != -1) - line.truncate(commentIndex); - out << line << endl; - } - } - - return mainCppContent; -} - -QByteArray AbstractMobileApp::generateProFile(QString *errorMessage) const -{ - const QChar comment = QLatin1Char('#'); - QByteArray proFileInput; - if (!readTemplate(AppProOrigin, &proFileInput, errorMessage)) - return QByteArray(); - QTextStream in(&proFileInput); - - QByteArray proFileContent; - QTextStream out(&proFileContent, QIODevice::WriteOnly | QIODevice::Text); - - QString valueOnNextLine; - bool commentOutNextLine = false; - QString line; - while (!(line = in.readLine()).isNull()) { - if (line.contains(QLatin1String("# REMOVE_NEXT_LINE"))) { - in.readLine(); // eats the following line - } else { - handleCurrentProFileTemplateLine(line, in, out, commentOutNextLine); - } - - // Remove all marker comments - if (line.trimmed().startsWith(comment) - && line.trimmed().endsWith(comment)) - continue; - - if (!valueOnNextLine.isEmpty()) { - out << line.left(line.indexOf(QLatin1Char('=')) + 2) - << QDir::fromNativeSeparators(valueOnNextLine) << endl; - valueOnNextLine.clear(); - continue; - } - - if (commentOutNextLine) { - out << comment << line << endl; - commentOutNextLine = false; - continue; - } - out << line << endl; - }; - - return proFileContent; -} - - -#ifndef CREATORLESSTEST -// The definition of QtQuickApp::templatesRoot() for -// CREATORLESSTEST is in tests/manual/appwizards/helpers.cpp -QString AbstractMobileApp::templatesRoot() -{ - return Core::ICore::resourcePath() - + QLatin1String("/templates/"); -} - -Core::GeneratedFile AbstractMobileApp::file(const QByteArray &data, - const QString &targetFile) -{ - Core::GeneratedFile generatedFile(targetFile); - generatedFile.setBinary(true); - generatedFile.setBinaryContents(data); - return generatedFile; -} - -Core::GeneratedFiles AbstractMobileApp::generateFiles(QString *errorMessage) const -{ - Core::GeneratedFiles files; - files << file(generateFile(AbstractGeneratedFileInfo::AppProFile, errorMessage), path(AppPro)); - files.last().setAttributes(Core::GeneratedFile::OpenProjectAttribute); - files << file(generateFile(AbstractGeneratedFileInfo::MainCppFile, errorMessage), path(MainCpp)); - return files; -} -#endif // CREATORLESSTEST - -QString AbstractMobileApp::error() const -{ - return m_error; -} - -QByteArray AbstractMobileApp::readBlob(const QString &filePath, - QString *errorMsg) const -{ - Utils::FileReader reader; - if (!reader.fetch(filePath, errorMsg)) - return QByteArray(); - return reader.data(); -} - -QByteArray AbstractMobileApp::generateFile(int fileType, - QString *errorMessage) const -{ - QByteArray data; - QString comment = CFileComment; - switch (fileType) { - case AbstractGeneratedFileInfo::MainCppFile: - data = generateMainCpp(errorMessage); - break; - case AbstractGeneratedFileInfo::AppProFile: - data = generateProFile(errorMessage); - comment = ProFileComment; - break; - default: - data = generateFileExtended(fileType, errorMessage); - } - return data; -} - -QString AbstractMobileApp::outputPathBase() const -{ - QString path = m_projectPath.absoluteFilePath(); - if (!path.endsWith(QLatin1Char('/'))) - path.append(QLatin1Char('/')); - return path + projectName() + QLatin1Char('/'); -} - -void AbstractMobileApp::insertParameter(QString &line, const QString ¶meter) -{ - line.replace(QRegExp(QLatin1String("\\([^()]+\\)")), - QLatin1Char('(') + parameter + QLatin1Char(')')); -} - -} // namespace QmakeProjectManager diff --git a/src/plugins/qmakeprojectmanager/wizards/abstractmobileapp.h b/src/plugins/qmakeprojectmanager/wizards/abstractmobileapp.h deleted file mode 100644 index 45e761e3bc7..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/abstractmobileapp.h +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef ABSTRACTMOBILEAPP_H -#define ABSTRACTMOBILEAPP_H - -#include "../qmakeprojectmanager_global.h" -#include -#include - -#ifndef CREATORLESSTEST -# include -#endif // CREATORLESSTEST - -QT_FORWARD_DECLARE_CLASS(QTextStream) - -namespace QmakeProjectManager { - -/// \internal -struct -#ifndef CREATORLESSTEST - QMAKEPROJECTMANAGER_EXPORT -#endif // CREATORLESSTEST - AbstractGeneratedFileInfo -{ - enum FileType { - MainCppFile, - AppProFile, - DeploymentPriFile, - ExtendedFile - }; - - AbstractGeneratedFileInfo(); - - int fileType; - QFileInfo fileInfo; - int currentVersion; // Current version of the template file in Creator - int version; // The version in the file header - quint16 dataChecksum; // The calculated checksum - quint16 statedChecksum; // The checksum in the file header -}; - -typedef QPair DeploymentFolder; // QPair<.source, .target> - -/// \internal -class -#ifndef CREATORLESSTEST - QMAKEPROJECTMANAGER_EXPORT -#endif // CREATORLESSTEST - AbstractMobileApp : public QObject -{ - Q_OBJECT - -public: - enum FileType { - MainCpp, - MainCppOrigin, - AppPro, - AppProOrigin, - AppProPath, - ExtendedFile - }; - - virtual ~AbstractMobileApp(); - - void setProjectName(const QString &name); - QString projectName() const; - void setProjectPath(const QString &path); - QString path(int fileType) const; - QString error() const; - -#ifndef CREATORLESSTEST - virtual Core::GeneratedFiles generateFiles(QString *errorMessage) const; -#else - bool generateFiles(QString *errorMessage) const; -#endif // CREATORLESSTEST - -protected: - AbstractMobileApp(); - virtual QByteArray generateProFile(QString *errorMessage) const; - - static QString templatesRoot(); - static void insertParameter(QString &line, const QString ¶meter); - - QByteArray readBlob(const QString &filePath, QString *errorMsg) const; - bool readTemplate(int fileType, QByteArray *data, QString *errorMessage) const; - QByteArray generateFile(int fileType, QString *errorMessage) const; - QString outputPathBase() const; - -#ifndef CREATORLESSTEST - static Core::GeneratedFile file(const QByteArray &data, - const QString &targetFile); -#endif // CREATORLESSTEST - - static const QString CFileComment; - static const QString ProFileComment; - - QString m_error; - -private: - QByteArray generateMainCpp(QString *errorMessage) const; - - virtual QByteArray generateFileExtended(int fileType, QString *errorMessage) const = 0; - virtual QString pathExtended(int fileType) const = 0; - virtual QString originsRoot() const = 0; - virtual bool adaptCurrentMainCppTemplateLine(QString &line) const = 0; - virtual void handleCurrentProFileTemplateLine(const QString &line, - QTextStream &proFileTemplate, QTextStream &proFile, - bool &commentOutNextLine) const = 0; - - QString m_projectName; - QFileInfo m_projectPath; -}; - -} // namespace QmakeProjectManager - -#endif // ABSTRACTMOBILEAPP_H diff --git a/src/plugins/qmakeprojectmanager/wizards/abstractmobileappwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/abstractmobileappwizard.cpp deleted file mode 100644 index 7efb103b153..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/abstractmobileappwizard.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "abstractmobileappwizard.h" -#include "abstractmobileapp.h" - -#include "../qmakeprojectimporter.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace Core; -using namespace ProjectExplorer; -using namespace QtSupport; - -namespace QmakeProjectManager { - -AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent, - const QtSupport::QtVersionNumber &minimumQtVersionNumber, - const QtSupport::QtVersionNumber &maximumQtVersionNumber, - const Core::WizardDialogParameters ¶meters) - : ProjectExplorer::BaseProjectWizardDialog(parent, parameters) - , m_kitsPage(0) - , m_minimumQtVersionNumber(minimumQtVersionNumber) - , m_maximumQtVersionNumber(maximumQtVersionNumber) -{ - if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))) { - m_kitsPage = new ProjectExplorer::TargetSetupPage; - updateKitsPage(); - resize(900, 450); - } -} - -void AbstractMobileAppWizardDialog::addKitsPage() -{ - if (m_kitsPage) - addPage(m_kitsPage); -} - -void AbstractMobileAppWizardDialog::updateKitsPage() -{ - if (m_kitsPage) { - QString platform = selectedPlatform(); - if (platform.isEmpty()) { - m_kitsPage->setPreferredKitMatcher( - QtKitInformation::qtVersionMatcher(FeatureSet(QtSupport::Constants::FEATURE_MOBILE))); - } else { - m_kitsPage->setPreferredKitMatcher(QtKitInformation::platformMatcher(platform)); - } - m_kitsPage->setRequiredKitMatcher(QtKitInformation::qtVersionMatcher(requiredFeatures(), - m_minimumQtVersionNumber, - m_maximumQtVersionNumber)); - } -} - -ProjectExplorer::TargetSetupPage *AbstractMobileAppWizardDialog::kitsPage() const -{ - return m_kitsPage; -} - -Core::BaseFileWizard *AbstractMobileAppWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const -{ - AbstractMobileAppWizardDialog * const wdlg = createInternal(parent, parameters); - wdlg->setProjectName(ProjectExplorer::BaseProjectWizardDialog::uniqueProjectName(parameters.defaultPath())); - connect(wdlg, SIGNAL(projectParametersChanged(QString,QString)), - SLOT(useProjectPath(QString,QString))); - wdlg->addExtensionPages(parameters.extensionPages()); - - return wdlg; -} - -Core::GeneratedFiles AbstractMobileAppWizard::generateFiles(const QWizard *wizard, - QString *errorMessage) const -{ - prepareGenerateFiles(wizard, errorMessage); - return app()->generateFiles(errorMessage); -} - -bool AbstractMobileAppWizard::postGenerateFiles(const QWizard *w, - const Core::GeneratedFiles &l, QString *errorMessage) -{ - Q_UNUSED(w) - Q_UNUSED(l) - Q_UNUSED(errorMessage) - QmakeManager * const manager - = ExtensionSystem::PluginManager::getObject(); - Q_ASSERT(manager); - QmakeProject project(manager, app()->path(AbstractMobileApp::AppPro)); - bool success = true; - if (wizardDialog()->kitsPage()) { - success = wizardDialog()->kitsPage()->setupProject(&project); - if (success) { - project.saveSettings(); - success = ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage); - } - } - if (success) { - const QString fileToOpen = fileToOpenPostGeneration(); - if (!fileToOpen.isEmpty()) - EditorManager::openEditor(fileToOpen); - } - return success; -} - -void AbstractMobileAppWizard::useProjectPath(const QString &projectName, - const QString &projectPath) -{ - app()->setProjectName(projectName); - app()->setProjectPath(projectPath); - if (wizardDialog()->kitsPage()) - wizardDialog()->kitsPage()->setProjectPath(app()->path(AbstractMobileApp::AppPro)); - projectPathChanged(app()->path(AbstractMobileApp::AppPro)); -} - -} // namespace QmakeProjectManager diff --git a/src/plugins/qmakeprojectmanager/wizards/abstractmobileappwizard.h b/src/plugins/qmakeprojectmanager/wizards/abstractmobileappwizard.h deleted file mode 100644 index 60a7a814d2f..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/abstractmobileappwizard.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef ABSTRACTMOBILEAPPWIZARD_H -#define ABSTRACTMOBILEAPPWIZARD_H - -#include -#include -#include - -namespace ProjectExplorer { class TargetSetupPage; } - -namespace QtSupport { class QtVersionNumber; } - -namespace QmakeProjectManager { - -class AbstractMobileApp; - -/// \internal -class QMAKEPROJECTMANAGER_EXPORT AbstractMobileAppWizardDialog : public ProjectExplorer::BaseProjectWizardDialog -{ - Q_OBJECT - -protected: - explicit AbstractMobileAppWizardDialog(QWidget *parent, const QtSupport::QtVersionNumber &minimumQtVersionNumber, - const QtSupport::QtVersionNumber &maximumQtVersionNumber, - const Core::WizardDialogParameters ¶meters); -public: - ProjectExplorer::TargetSetupPage *kitsPage() const; - -protected: - void addKitsPage(); - void updateKitsPage(); - -private: - ProjectExplorer::TargetSetupPage *m_kitsPage; - const QtSupport::QtVersionNumber m_minimumQtVersionNumber; - const QtSupport::QtVersionNumber m_maximumQtVersionNumber; -}; - -/// \internal -class QMAKEPROJECTMANAGER_EXPORT AbstractMobileAppWizard : public Core::BaseFileWizardFactory -{ - Q_OBJECT - -private slots: - void useProjectPath(const QString &projectName, const QString &projectPath); - -protected: - virtual QString fileToOpenPostGeneration() const = 0; - -private: - Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const; - Core::GeneratedFiles generateFiles(const QWizard *wizard, QString *errorMessage) const; - bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage); - - virtual AbstractMobileApp *app() const = 0; - virtual AbstractMobileAppWizardDialog *wizardDialog() const = 0; - virtual AbstractMobileAppWizardDialog *createInternal(QWidget *parent, - const Core::WizardDialogParameters ¶meters) const = 0; - virtual void projectPathChanged(const QString &path) const = 0; - virtual void prepareGenerateFiles(const QWizard *wizard, QString *errorMessage) const = 0; -}; - -} // namespace QmakeProjectManager - -#endif // ABSTRACTMOBILEAPPWIZARD_H diff --git a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp deleted file mode 100644 index 83f32dd7368..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp +++ /dev/null @@ -1,343 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "qtquickapp.h" - -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifndef CREATORLESSTEST -#include -#endif // CREATORLESSTEST - -namespace QmakeProjectManager { -namespace Internal { - -static QString sharedDirectory() -{ - return Core::ICore::resourcePath() + QLatin1String("/templates/shared/"); -} - -static QString templateRootDirectory() -{ - return Core::ICore::resourcePath() + QLatin1String("/templates/qtquick/"); -} - -static QStringList templateNames() -{ - QStringList templateNameList; - const QDir templateRoot(templateRootDirectory()); - - foreach (const QFileInfo &subDirectory, - templateRoot.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) - templateNameList.append(subDirectory.fileName()); - - return templateNameList; -} - -// Return locale language attribute "de_UTF8" -> "de", empty string for "C" -static QString languageSetting() -{ -#ifdef QT_CREATOR - QString name = Core::ICore::userInterfaceLanguage(); - const int underScorePos = name.indexOf(QLatin1Char('_')); - if (underScorePos != -1) - name.truncate(underScorePos); - if (name.compare(QLatin1String("C"), Qt::CaseInsensitive) == 0) - name.clear(); - return name; -#else - return QLocale::system().name(); -#endif -} - -static inline bool assignLanguageElementText(QXmlStreamReader &reader, - const QString &desiredLanguage, - QString *target) -{ - const QStringRef elementLanguage = reader.attributes().value(QLatin1String("xml:lang")); - if (elementLanguage.isEmpty()) { - // Try to find a translation for our Wizards - *target = QCoreApplication::translate("QmakeProjectManager::QtQuickAppWizard", - reader.readElementText().toLatin1().constData()); - return true; - } - if (elementLanguage == desiredLanguage) { - *target = reader.readElementText(); - return true; - } - return false; -} - -static bool parseTemplateXml(QXmlStreamReader &reader, TemplateInfo *info) -{ - const QString locale = languageSetting(); - - static const QLatin1String tag_template("template"); - static const QLatin1String tag_displayName("displayname"); - static const QLatin1String tag_description("description"); - static const QLatin1String attribute_featuresRequired("featuresRequired"); - static const QLatin1String attribute_openEditor("openeditor"); - static const QLatin1String attribute_priority("priority"); - static const QLatin1String attribute_qrcdeployment("qrcdeployment"); - static const QLatin1String attribute_requiredPlugins("requiredPlugins"); - - while (!reader.atEnd() && !reader.hasError()) { - reader.readNext(); - if (reader.tokenType() != QXmlStreamReader::StartElement) - continue; - - if (reader.name() == tag_template) { - info->openFile = reader.attributes().value(attribute_openEditor).toString(); - if (reader.attributes().hasAttribute(attribute_priority)) - info->priority = reader.attributes().value(attribute_priority).toString(); - - if (reader.attributes().hasAttribute(attribute_featuresRequired)) - info->featuresRequired = reader.attributes().value(attribute_featuresRequired).toString(); - - if (reader.attributes().hasAttribute(attribute_qrcdeployment)) - info->qrcDeployment = reader.attributes().value(attribute_qrcdeployment).toString(); - - // This attribute is currently used in enterprise addons to filter out templates when the enterprise - // addon is not installed. This applies to the Boot To Qt addon for example. - if (reader.attributes().hasAttribute(attribute_requiredPlugins)) - info->requiredPlugins = reader.attributes().value(attribute_requiredPlugins).toString() - .split(QLatin1Char(','), QString::SkipEmptyParts); - - } else if (reader.name() == tag_displayName) { - if (!assignLanguageElementText(reader, locale, &info->displayName)) - continue; - } else if (reader.name() == tag_description) { - if (!assignLanguageElementText(reader, locale, &info->description)) - continue; - } - } - if (reader.hasError()) { - qWarning() << reader.errorString(); - return false; - } - - return true; -} - -class TemplateInfoList -{ -public: - TemplateInfoList() - { - QSet availablePlugins; - foreach (ExtensionSystem::PluginSpec *s, ExtensionSystem::PluginManager::plugins()) { - if (s->state() == ExtensionSystem::PluginSpec::Running && !s->hasError()) - availablePlugins += s->name(); - } - - QMultiMap multiMap; - foreach (const QString &templateName, templateNames()) { - const QString templatePath = templateRootDirectory() + templateName; - QFile xmlFile(templatePath + QLatin1String("/template.xml")); - if (!xmlFile.open(QIODevice::ReadOnly)) { - qWarning().nospace() << QString::fromLatin1("Cannot open %1").arg(QDir::toNativeSeparators(QFileInfo(xmlFile.fileName()).absoluteFilePath())); - continue; - } - TemplateInfo info; - info.templateName = templateName; - info.templatePath = templatePath; - QXmlStreamReader reader(&xmlFile); - if (!parseTemplateXml(reader, &info)) - continue; - - bool ok = true; - foreach (const QString &neededPlugin, info.requiredPlugins) { - if (!availablePlugins.contains(neededPlugin)) { - ok = false; - break; - } - } - if (ok) - multiMap.insert(info.priority, info); - } - m_templateInfoList = multiMap.values(); - } - QList templateInfoList() const { return m_templateInfoList; } - -private: - QList m_templateInfoList; -}; - -Q_GLOBAL_STATIC(TemplateInfoList, templateInfoList) - -QList QtQuickApp::templateInfos() -{ - return templateInfoList()->templateInfoList(); -} - -QtQuickApp::QtQuickApp() - : AbstractMobileApp() -{ -} - -void QtQuickApp::setTemplateInfo(const TemplateInfo &templateInfo) -{ - m_templateInfo = templateInfo; -} - -QString QtQuickApp::pathExtended(int fileType) const -{ - const QString mainQmlFile = QLatin1String("main.qml"); - const QString mainQrcFile = QLatin1String("qml.qrc"); - - const QString qrcDeploymentFile = QLatin1String("deployment.pri"); - - const QString pathBase = outputPathBase(); - - switch (fileType) { - case MainQml: return pathBase + mainQmlFile; - case MainQmlOrigin: return originsRoot() + mainQmlFile; - case MainQrc: return pathBase + mainQrcFile; - case MainQrcOrigin: return originsRoot() + mainQrcFile; - case QrcDeployment: return pathBase + qrcDeploymentFile; - case QrcDeploymentOrigin: return sharedDirectory() + qrcDeployment(); - default: qFatal("QtQuickApp::pathExtended() needs more work"); - } - return QString(); -} - -QString QtQuickApp::originsRoot() const -{ - return m_templateInfo.templatePath + QLatin1Char('/'); -} - -bool QtQuickApp::adaptCurrentMainCppTemplateLine(QString &line) const -{ - Q_UNUSED(line) - return true; -} - -void QtQuickApp::handleCurrentProFileTemplateLine(const QString &line, - QTextStream &proFileTemplate, QTextStream &proFile, - bool &commentOutNextLine) const -{ - Q_UNUSED(commentOutNextLine) - if (line.contains(QLatin1String("# QML_IMPORT_PATH"))) { - QString nextLine = proFileTemplate.readLine(); // eats 'QML_IMPORT_PATH =' - if (!nextLine.startsWith(QLatin1String("QML_IMPORT_PATH ="))) - return; - proFile << nextLine << endl; - } -} - -#ifndef CREATORLESSTEST - -static QFileInfoList allFilesRecursive(const QString &path) -{ - const QDir currentDirectory(path); - - QFileInfoList allFiles = currentDirectory.entryInfoList(QDir::Files); - - foreach (const QFileInfo &subDirectory, currentDirectory.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) - allFiles.append(allFilesRecursive(subDirectory.absoluteFilePath())); - - return allFiles; -} - -Core::GeneratedFiles QtQuickApp::generateFiles(QString *errorMessage) const -{ - Core::GeneratedFiles files = AbstractMobileApp::generateFiles(errorMessage); - - const QFileInfoList templateFiles = allFilesRecursive(originsRoot()); - - //Deploy additional .qml files - foreach (const QFileInfo &templateFile, templateFiles) { - QString targetFileName = templateFile.fileName(); - if (templateFile.suffix() == QLatin1String("qml") - && targetFileName != QLatin1String("main.qml")) - files.append(file(readBlob(templateFile.absoluteFilePath(), errorMessage), outputPathBase() + targetFileName)); - } - - if (!useExistingMainQml()) { - files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainQmlFile, errorMessage), path(MainQml))); - files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute); - } - if (QFileInfo::exists(path(MainQrcOrigin))) { - files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainQrcFile, errorMessage), path(MainQrc))); - } - if (!qrcDeployment().isEmpty()) { - files.append(file(generateFile(QtQuickAppGeneratedFileInfo::QrcDeploymentFile, errorMessage), path(QrcDeployment))); - } - - return files; -} -#endif // CREATORLESSTEST - -bool QtQuickApp::useExistingMainQml() const -{ - return !m_mainQmlFile.filePath().isEmpty(); -} - -QString QtQuickApp::qrcDeployment() const -{ - return m_templateInfo.qrcDeployment; -} - -QByteArray QtQuickApp::generateProFile(QString *errorMessage) const -{ - QByteArray proFileContent = AbstractMobileApp::generateProFile(errorMessage); - proFileContent.replace("../../shared/qrc", ""); // fix a path to qrcdeployment.pri - return proFileContent; -} - -QByteArray QtQuickApp::generateFileExtended(int fileType, QString *errorMessage) const -{ - QByteArray data; - switch (fileType) { - case QtQuickAppGeneratedFileInfo::MainQmlFile: - data = readBlob(path(MainQmlOrigin), errorMessage); - break; - case QtQuickAppGeneratedFileInfo::MainQrcFile: - data = readBlob(path(MainQrcOrigin), errorMessage); - break; - case QtQuickAppGeneratedFileInfo::QrcDeploymentFile: - data = readBlob(path(QrcDeploymentOrigin), errorMessage); - break; - default: - break; - } - return data; -} - -} // namespace Internal -} // namespace QmakeProjectManager diff --git a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.h b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.h deleted file mode 100644 index 0c9f3ba6131..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.h +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QTQUICKAPP_H -#define QTQUICKAPP_H - -#include "abstractmobileapp.h" - -#include - -namespace QmakeProjectManager { -namespace Internal { - -struct QtQuickAppGeneratedFileInfo : public AbstractGeneratedFileInfo -{ - enum ExtendedFileType { - MainQmlFile = ExtendedFile, - MainQrcFile, - AppViewerPriFile, - AppViewerCppFile, - AppViewerHFile, - QrcDeploymentFile - }; - - QtQuickAppGeneratedFileInfo() : AbstractGeneratedFileInfo() {} -}; - -class TemplateInfo -{ -public: - QString templateName; - QString templatePath; - QString displayName; - QString description; - QString openFile; - QString featuresRequired; - QString priority; - QString qrcDeployment; - QStringList requiredPlugins; -}; - -class QtQuickApp : public AbstractMobileApp -{ -public: - enum ExtendedFileType { - MainQml = ExtendedFile, - MainQmlOrigin, - MainQrc, - MainQrcOrigin, - QrcDeployment, - QrcDeploymentOrigin - }; - - QtQuickApp(); - - static QList templateInfos(); - - void setTemplateInfo(const TemplateInfo &templateInfo); - -#ifndef CREATORLESSTEST - virtual Core::GeneratedFiles generateFiles(QString *errorMessage) const; -#else - bool generateFiles(QString *errorMessage) const; -#endif // CREATORLESSTEST - bool useExistingMainQml() const; - - static const int StubVersion; - -protected: - virtual QByteArray generateProFile(QString *errorMessage) const; - - QString qrcDeployment() const; - -private: - virtual QByteArray generateFileExtended(int fileType, QString *errorMessage) const; - virtual QString pathExtended(int fileType) const; - virtual QString originsRoot() const; - virtual bool adaptCurrentMainCppTemplateLine(QString &line) const; - virtual void handleCurrentProFileTemplateLine(const QString &line, - QTextStream &proFileTemplate, QTextStream &proFile, - bool &commentOutNextLine) const; - - QFileInfo m_mainQmlFile; - TemplateInfo m_templateInfo; -}; - -} // namespace Internal -} // namespace QmakeProjectManager - -#endif // QTQUICKAPP_H diff --git a/src/plugins/qmakeprojectmanager/wizards/qtquickappwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/qtquickappwizard.cpp deleted file mode 100644 index df155bd145c..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/qtquickappwizard.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "qtquickappwizard.h" - -#include "qtquickapp.h" -#include "qtquickappwizardpages.h" -#include "../qmakeprojectmanagerconstants.h" - -#include -#include -#include -#include - -#include - -namespace QmakeProjectManager { -namespace Internal { - -class QtQuickAppWizardDialog : public AbstractMobileAppWizardDialog -{ - Q_OBJECT - -public: - explicit QtQuickAppWizardDialog(QWidget *parent, const Core::WizardDialogParameters ¶meters); - TemplateInfo templateInfo() const; - -protected: - void initializePage(int id); - -private: - QtQuickComponentSetPage *m_componentSetPage; -}; - -QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent, - const Core::WizardDialogParameters ¶meters) - : AbstractMobileAppWizardDialog(parent, - QtSupport::QtVersionNumber(4, 7, 0), - QtSupport::QtVersionNumber(5, INT_MAX, INT_MAX), parameters) -{ - setWindowTitle(tr("New Qt Quick Application")); - setIntroDescription(tr("This wizard generates a Qt Quick Application project.")); - - m_componentSetPage = new Internal::QtQuickComponentSetPage; - addPage(m_componentSetPage); - - addKitsPage(); - - setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK)); -} - -void QtQuickAppWizardDialog::initializePage(int id) -{ - if (page(id) == kitsPage()) { - QStringList stringList = - templateInfo().featuresRequired.split(QLatin1Char(','), QString::SkipEmptyParts); - Core::FeatureSet features; - foreach (const QString &string, stringList) { - Core::Feature feature(Core::Id::fromString(string.trimmed())); - features |= feature; - } - - setRequiredFeatures(features); - updateKitsPage(); - } - AbstractMobileAppWizardDialog::initializePage(id); -} - -TemplateInfo QtQuickAppWizardDialog::templateInfo() const -{ - return m_componentSetPage->templateInfo(); -} - - -class QtQuickAppWizardPrivate -{ - class QtQuickApp *app; - class QtQuickAppWizardDialog *wizardDialog; - friend class QtQuickAppWizard; -}; - -QtQuickAppWizard::QtQuickAppWizard() - : d(new QtQuickAppWizardPrivate) -{ - setWizardKind(ProjectWizard); - setIcon(QIcon(QLatin1String(QmakeProjectManager::Constants::ICON_QTQUICK_APP))); - setId(QLatin1String("D.QMLA Application")); - setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY)); - setDisplayCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY)); - setDisplayName(tr("Qt Quick Application")); - setDescription(tr("Creates a Qt Quick application project that can contain both QML and C++ code.")); - setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK)); - - d->app = new QtQuickApp; - d->wizardDialog = 0; -} - -QtQuickAppWizard::~QtQuickAppWizard() -{ - delete d->app; - delete d; -} - -AbstractMobileAppWizardDialog *QtQuickAppWizard::createInternal(QWidget *parent, - const Core::WizardDialogParameters ¶meters) const -{ - d->wizardDialog = new QtQuickAppWizardDialog(parent, parameters); - return d->wizardDialog; -} - -void QtQuickAppWizard::projectPathChanged(const QString &path) const -{ - if (d->wizardDialog->kitsPage()) - d->wizardDialog->kitsPage()->setProjectPath(path); -} - -void QtQuickAppWizard::prepareGenerateFiles(const QWizard *w, - QString *errorMessage) const -{ - Q_UNUSED(errorMessage) - const QtQuickAppWizardDialog *wizard = qobject_cast(w); - d->app->setTemplateInfo(wizard->templateInfo()); -} - -QString QtQuickAppWizard::fileToOpenPostGeneration() const -{ - return d->app->path(QtQuickApp::MainQml); -} - -AbstractMobileApp *QtQuickAppWizard::app() const -{ - return d->app; -} - -AbstractMobileAppWizardDialog *QtQuickAppWizard::wizardDialog() const -{ - return d->wizardDialog; -} - -} // namespace Internal -} // namespace QmakeProjectManager - -#include "qtquickappwizard.moc" diff --git a/src/plugins/qmakeprojectmanager/wizards/qtquickappwizard.h b/src/plugins/qmakeprojectmanager/wizards/qtquickappwizard.h deleted file mode 100644 index 40a890730e0..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/qtquickappwizard.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QTQUICKAPPWIZARD_H -#define QTQUICKAPPWIZARD_H - -#include "abstractmobileappwizard.h" - -namespace QmakeProjectManager { -namespace Internal { - -class QtQuickAppWizard : public AbstractMobileAppWizard -{ - Q_OBJECT - -public: - QtQuickAppWizard(); - ~QtQuickAppWizard(); - -protected: - QString fileToOpenPostGeneration() const; - -private: - AbstractMobileApp *app() const; - AbstractMobileAppWizardDialog *wizardDialog() const; - AbstractMobileAppWizardDialog *createInternal(QWidget *parent, - const Core::WizardDialogParameters ¶meters) const; - void projectPathChanged(const QString &path) const; - void prepareGenerateFiles(const QWizard *wizard, QString *errorMessage) const; - - class QtQuickAppWizardPrivate *d; -}; - -} // namespace Internal -} // namespace QmakeProjectManager - -#endif // QTQUICKAPPWIZARD_H diff --git a/src/plugins/qmakeprojectmanager/wizards/qtquickappwizardpages.cpp b/src/plugins/qmakeprojectmanager/wizards/qtquickappwizardpages.cpp deleted file mode 100644 index 25e1980b86f..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/qtquickappwizardpages.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "qtquickappwizardpages.h" - -#include - -#include -#include -#include - -namespace QmakeProjectManager { -namespace Internal { - -class QtQuickComponentSetPagePrivate -{ -public: - QComboBox *m_versionComboBox; - QLabel *m_descriptionLabel; -}; - -QtQuickComponentSetPage::QtQuickComponentSetPage(QWidget *parent) - : QWizardPage(parent) - , d(new QtQuickComponentSetPagePrivate) -{ - setTitle(tr("Select Qt Quick Component Set")); - QVBoxLayout *mainLayout = new QVBoxLayout(this); - QHBoxLayout *l = new QHBoxLayout(); - - QLabel *label = new QLabel(tr("Qt Quick component set:"), this); - d->m_versionComboBox = new QComboBox(this); - - foreach (const TemplateInfo &templateInfo, QtQuickApp::templateInfos()) - d->m_versionComboBox->addItem(templateInfo.displayName); - - l->addWidget(label); - l->addWidget(d->m_versionComboBox); - - d->m_descriptionLabel = new QLabel(this); - d->m_descriptionLabel->setWordWrap(true); - d->m_descriptionLabel->setTextFormat(Qt::RichText); - connect(d->m_versionComboBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(updateDescription(int))); - updateDescription(d->m_versionComboBox->currentIndex()); - - mainLayout->addLayout(l); - mainLayout->addWidget(d->m_descriptionLabel); - - setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Component Set")); -} - -QtQuickComponentSetPage::~QtQuickComponentSetPage() -{ - delete d; -} - -TemplateInfo QtQuickComponentSetPage::templateInfo() const -{ - if (QtQuickApp::templateInfos().isEmpty()) - return TemplateInfo(); - return QtQuickApp::templateInfos().at(d->m_versionComboBox->currentIndex()); -} - -void QtQuickComponentSetPage::updateDescription(int index) -{ - if (QtQuickApp::templateInfos().isEmpty()) - return; - - const TemplateInfo templateInfo = QtQuickApp::templateInfos().at(index); - d->m_descriptionLabel->setText(templateInfo.description); -} - -} // namespace Internal -} // namespace QmakeProjectManager diff --git a/src/plugins/qmakeprojectmanager/wizards/qtquickappwizardpages.h b/src/plugins/qmakeprojectmanager/wizards/qtquickappwizardpages.h deleted file mode 100644 index 92ae1a1c454..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/qtquickappwizardpages.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QTQUICKAPPWIZARDPAGES_H -#define QTQUICKAPPWIZARDPAGES_H - -#include -#include "qtquickapp.h" - -namespace QmakeProjectManager { -namespace Internal { - -class QtQuickComponentSetPage : public QWizardPage -{ - Q_OBJECT - -public: - explicit QtQuickComponentSetPage(QWidget *parent = 0); - virtual ~QtQuickComponentSetPage(); - - TemplateInfo templateInfo() const; - -private slots: - void updateDescription(int index); - -private: - class QtQuickComponentSetPagePrivate *d; -}; - -} // namespace Internal -} // namespace QmakeProjectManager - -#endif // QTQUICKAPPWIZARDPAGES_H