summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkobus <jaroslaw.kobus@digia.com>2014-02-10 13:34:37 +0100
committerKai Koehne <kai.koehne@digia.com>2014-02-11 13:11:32 +0100
commit62117ee21f4ba301709af8d250841dd522ff0c7f (patch)
treedc71e311cd68d76a88658e4a426d87cf314f9f21
parentd602a942a9e1f7b55723e5e474e8522a55e99f86 (diff)
downloadqt-creator-62117ee21f4ba301709af8d250841dd522ff0c7f.tar.gz
Fix deployment for QtQuick templates
Task-number: QTCREATORBUG-11412 Change-Id: Iee117faaf85fcaa3e216091a8f7d95b4e12237cb Reviewed-by: Kai Koehne <kai.koehne@digia.com>
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_1/app.pro2
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_1/template.xml1
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_2/app.pro2
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_2/template.xml1
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro3
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml3
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro3
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_1/template.xml3
-rw-r--r--share/qtcreator/templates/shared/qrcdeployment.pri23
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp27
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/qtquickapp.h9
11 files changed, 70 insertions, 7 deletions
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_1/app.pro b/share/qtcreator/templates/qtquick/qtquick_2_1/app.pro
index f89227f8b1..fa61ce669e 100644
--- a/share/qtcreator/templates/qtquick/qtquick_2_1/app.pro
+++ b/share/qtcreator/templates/qtquick/qtquick_2_1/app.pro
@@ -10,3 +10,5 @@ RESOURCES += qml.qrc
# QML_IMPORT_PATH #
QML_IMPORT_PATH =
+# Default rules for deployment.
+include(../../shared/qrcdeployment.pri)
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_1/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_1/template.xml
index 360de04d51..d338b2b4df 100644
--- a/share/qtcreator/templates/qtquick/qtquick_2_1/template.xml
+++ b/share/qtcreator/templates/qtquick/qtquick_2_1/template.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="C"
featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2"
+ qrcdeployment="qrcdeployment.pri"
stubversionminor="5">
<displayname>Qt Quick 2.1</displayname>
<description>Creates a deployable Qt Quick 2 application using the QtQuick 2.1 import. Requires Qt 5.1 or newer.</description>
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_2/app.pro b/share/qtcreator/templates/qtquick/qtquick_2_2/app.pro
index f89227f8b1..fa61ce669e 100644
--- a/share/qtcreator/templates/qtquick/qtquick_2_2/app.pro
+++ b/share/qtcreator/templates/qtquick/qtquick_2_2/app.pro
@@ -10,3 +10,5 @@ RESOURCES += qml.qrc
# QML_IMPORT_PATH #
QML_IMPORT_PATH =
+# Default rules for deployment.
+include(../../shared/qrcdeployment.pri)
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_2/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_2/template.xml
index df31c91d87..66bc265241 100644
--- a/share/qtcreator/templates/qtquick/qtquick_2_2/template.xml
+++ b/share/qtcreator/templates/qtquick/qtquick_2_2/template.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="A"
featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2"
+ qrcdeployment="qrcdeployment.pri"
stubversionminor="5">
<displayname>Qt Quick 2.2</displayname>
<description>Creates a deployable Qt Quick 2 application using the QtQuick 2.2 import. Requires Qt 5.2 or newer.</description>
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro
index 370208fcee..1c260786ad 100644
--- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro
@@ -8,3 +8,6 @@ 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_0/template.xml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml
index b294c81d62..0d13329a2b 100644
--- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="D"
featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls"
- viewerdir="qtquick2controlsapplicationviewer"
- viewerclassname="QtQuick2ControlsApplicationViewer"
+ qrcdeployment="qrcdeployment.pri"
stubversionminor="1">
<displayname>Qt Quick Controls 1.0</displayname>
<description>Creates a deployable Qt Quick 2 application using Qt Quick Controls. Requires Qt 5.1 or newer.</description>
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro
index 370208fcee..1c260786ad 100644
--- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro
@@ -8,3 +8,6 @@ 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/template.xml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/template.xml
index a9e6f828bf..bc8dd5e86e 100644
--- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/template.xml
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/template.xml
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="B"
featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls"
- viewerdir="qtquick2controlsapplicationviewer"
- viewerclassname="QtQuick2ControlsApplicationViewer"
+ qrcdeployment="qrcdeployment.pri"
stubversionminor="1">
<displayname>Qt Quick Controls 1.1</displayname>
<description>Creates a deployable Qt Quick 2 application using Qt Quick Controls. Requires Qt 5.2 or newer.</description>
diff --git a/share/qtcreator/templates/shared/qrcdeployment.pri b/share/qtcreator/templates/shared/qrcdeployment.pri
new file mode 100644
index 0000000000..839b3b5cac
--- /dev/null
+++ b/share/qtcreator/templates/shared/qrcdeployment.pri
@@ -0,0 +1,23 @@
+android-no-sdk {
+ target.path = /data/user/qt
+ export(target.path)
+ INSTALLS += target
+} else:android {
+ x86 {
+ target.path = /libs/x86
+ } else: armeabi-v7a {
+ target.path = /libs/armeabi-v7a
+ } else {
+ target.path = /libs/armeabi
+ }
+ export(target.path)
+ INSTALLS += target
+} else:unix {
+ isEmpty(target.path) {
+ target.path = /opt/$${TARGET}/bin
+ export(target.path)
+ }
+ INSTALLS += target
+}
+
+export(INSTALLS)
diff --git a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp
index c8adf3ec35..3d8ba5d9a5 100644
--- a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp
@@ -44,9 +44,14 @@
namespace QmakeProjectManager {
namespace Internal {
+static QString sharedDirectory()
+{
+ return Core::ICore::resourcePath() + QLatin1String("/templates/shared/");
+}
+
static QString qtQuickApplicationViewerDirectory()
{
- return Core::ICore::resourcePath() + QLatin1String("/templates/shared/qtquickapplicationviewer/");
+ return sharedDirectory() + QLatin1String("qtquickapplicationviewer/");
}
static QString templateRootDirectory()
@@ -112,6 +117,7 @@ static bool parseTemplateXml(QXmlStreamReader &reader, TemplateInfo *info)
static const QLatin1String attribute_priority("priority");
static const QLatin1String attribute_viewerdir("viewerdir");
static const QLatin1String attribute_viewerclassname("viewerclassname");
+ static const QLatin1String attribute_qrcdeployment("qrcdeployment");
static const QLatin1String attribute_stubversionminor("stubversionminor");
while (!reader.atEnd() && !reader.hasError()) {
@@ -133,6 +139,9 @@ static bool parseTemplateXml(QXmlStreamReader &reader, TemplateInfo *info)
if (reader.attributes().hasAttribute(attribute_viewerclassname))
info->viewerClassName = reader.attributes().value(attribute_viewerclassname).toString();
+ if (reader.attributes().hasAttribute(attribute_qrcdeployment))
+ info->qrcDeployment = reader.attributes().value(attribute_qrcdeployment).toString();
+
if (reader.attributes().hasAttribute(attribute_stubversionminor))
info->stubVersionMinor = reader.attributes().value(attribute_stubversionminor).toString().toInt();
@@ -205,6 +214,8 @@ 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 qmlOriginDir = originsRoot() + QLatin1String("qml/");
const QString pathBase = outputPathBase();
@@ -215,6 +226,8 @@ QString QtQuickApp::pathExtended(int fileType) const
case MainQmlOrigin: return qmlOriginDir + mainQmlFile;
case MainQrc: return pathBase + mainQrcFile;
case MainQrcOrigin: return originsRoot() + mainQrcFile;
+ case QrcDeployment: return pathBase + qrcDeploymentFile;
+ case QrcDeploymentOrigin: return sharedDirectory() + qrcDeployment();
case AppViewerPri: return pathBase + appViewerTargetSubDir + fileName(AppViewerPri);
case AppViewerPriOrigin: return qtQuickApplicationViewerDirectory() + appViewerOriginSubDir() + fileName(AppViewerPri);
case AppViewerCpp: return pathBase + appViewerTargetSubDir + fileName(AppViewerCpp);
@@ -271,6 +284,9 @@ Core::GeneratedFiles QtQuickApp::generateFiles(QString *errorMessage) const
if (QFileInfo(path(MainQrcOrigin)).exists()) {
files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainQrcFile, errorMessage), path(MainQrc)));
}
+ if (!qrcDeployment().isEmpty()) {
+ files.append(file(generateFile(QtQuickAppGeneratedFileInfo::QrcDeploymentFile, errorMessage), path(QrcDeployment)));
+ }
if (!appViewerBaseName().isEmpty()) {
files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)));
files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)));
@@ -291,6 +307,11 @@ QString QtQuickApp::appViewerBaseName() const
return m_templateInfo.viewerDir;
}
+QString QtQuickApp::qrcDeployment() const
+{
+ return m_templateInfo.qrcDeployment;
+}
+
QString QtQuickApp::fileName(QtQuickApp::ExtendedFileType type) const
{
switch (type) {
@@ -310,6 +331,7 @@ QByteArray QtQuickApp::generateProFile(QString *errorMessage) const
{
QByteArray proFileContent = AbstractMobileApp::generateProFile(errorMessage);
proFileContent.replace("../../shared/qtquickapplicationviewer/", "");
+ proFileContent.replace("../../shared/qrc", ""); // fix a path to qrcdeployment.pri
return proFileContent;
}
@@ -324,6 +346,9 @@ QByteArray QtQuickApp::generateFileExtended(int fileType,
case QtQuickAppGeneratedFileInfo::MainQrcFile:
data = readBlob(path(MainQrcOrigin), errorMessage);
break;
+ case QtQuickAppGeneratedFileInfo::QrcDeploymentFile:
+ data = readBlob(path(QrcDeploymentOrigin), errorMessage);
+ break;
case QtQuickAppGeneratedFileInfo::AppViewerPriFile:
data = readBlob(path(AppViewerPriOrigin), errorMessage);
data.append(readBlob(path(DeploymentPriOrigin), errorMessage));
diff --git a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.h b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.h
index 0f1ebf3617..8dcdac021d 100644
--- a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.h
+++ b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.h
@@ -42,7 +42,8 @@ struct QtQuickAppGeneratedFileInfo : public AbstractGeneratedFileInfo
MainQrcFile,
AppViewerPriFile,
AppViewerCppFile,
- AppViewerHFile
+ AppViewerHFile,
+ QrcDeploymentFile
};
QtQuickAppGeneratedFileInfo() : AbstractGeneratedFileInfo() {}
@@ -61,6 +62,7 @@ public:
QString priority;
QString viewerClassName;
QString viewerDir;
+ QString qrcDeployment;
int stubVersionMinor;
};
@@ -79,7 +81,9 @@ public:
AppViewerCppOrigin,
AppViewerH,
AppViewerHOrigin,
- QmlDirProFileRelative
+ QmlDirProFileRelative,
+ QrcDeployment,
+ QrcDeploymentOrigin
};
QtQuickApp();
@@ -101,6 +105,7 @@ protected:
virtual QByteArray generateProFile(QString *errorMessage) const;
QString appViewerBaseName() const;
+ QString qrcDeployment() const;
QString fileName(ExtendedFileType type) const;
QString appViewerOriginSubDir() const;