Commit 9d04cffe authored by Christian Kandeler's avatar Christian Kandeler
Browse files

QML + Mobile wizard: Share deployment rules.

Reviewed-by: Alessandro Portale
parent f4b2a70e
# This file should not be edited.
# Following versions of Qt Creator might offer new version.
INCLUDEPATH += $$PWD
defineTest(qtcAddDeployment) {
symbian {
TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -leiksrv -lcone
contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices
} else:unix {
maemo5 {
installPrefix = /opt/usr
desktopfile.path = /usr/share/applications/hildon
} else {
installPrefix = /usr/local
desktopfile.path = /usr/share/applications
}
icon.files = $${TARGET}.png
icon.path = /usr/share/icons/hicolor/64x64/apps
desktopfile.files = $${TARGET}.desktop
target.path = $${installPrefix}/bin
export(icon.files)
export(icon.path)
export(desktopfile.files)
export(desktopfile.path)
export(target.path)
INSTALLS += desktopfile icon target
}
export (INSTALLS)
export (TARGET.EPOCHEAPSIZE)
export (TARGET.CAPABILITY)
export (LIBS)
}
# Add files and directories to ship with the application
# by adapting the examples below.
# file1.source = myfile
# dir1.source = mydir
DEPLOYMENTFOLDERS = # file1 dir1
# Avoid auto screen rotation
# ORIENTATIONLOCK #
DEFINES += ORIENTATIONLOCK
......@@ -15,6 +21,6 @@ SOURCES += main.cpp mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
include(app.pri)
include(../shared/deployment.pri)
qtcAddDeployment(DEPLOYMENTFOLDERS)
qtcAddDeployment()
......@@ -25,5 +25,6 @@ symbian:ICON = symbianicon.svg
SOURCES += main.cpp
include(qmlapplicationviewer/qmlapplicationviewer.pri)
include(../shared/deployment.pri)
qtcAddDeployment(DEPLOYMENTFOLDERS)
qtcAddDeployment()
......@@ -19,91 +19,3 @@ contains(DEFINES, QMLINSPECTOR) {
DEFINES -= QMLINSPECTOR
}
}
defineTest(qtcAddDeployment) {
for(deploymentfolder, DEPLOYMENTFOLDERS) {
item = item$${deploymentfolder}
itemsources = $${item}.sources
$$itemsources = $$eval($${deploymentfolder}.source)
itempath = $${item}.path
$$itempath= $$eval($${deploymentfolder}.target)
export($$itemsources)
export($$itempath)
DEPLOYMENT += $$item
}
MAINPROFILEPWD = $$PWD
symbian {
TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -leiksrv -lcone
contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices
} else:win32 {
!isEqual(PWD,$$OUT_PWD) {
copyCommand = @echo Copying application data...
for(deploymentfolder, DEPLOYMENTFOLDERS) {
source = $$eval($${deploymentfolder}.source)
pathSegments = $$split(source, /)
sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments)
copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\)
}
copydeploymentfolders.commands = $$copyCommand
first.depends = $(first) copydeploymentfolders
export(first.depends)
export(copydeploymentfolders.commands)
QMAKE_EXTRA_TARGETS += first copydeploymentfolders
}
} else:unix {
maemo5 {
installPrefix = /opt/usr
desktopfile.path = /usr/share/applications/hildon
} else {
installPrefix = /usr/local
desktopfile.path = /usr/share/applications
!isEqual(PWD,$$OUT_PWD) {
copyCommand = @echo Copying application data...
for(deploymentfolder, DEPLOYMENTFOLDERS) {
macx {
target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
} else {
target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
}
copyCommand += && $(MKDIR) $$target
copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target
}
copydeploymentfolders.commands = $$copyCommand
first.depends = $(first) copydeploymentfolders
export(first.depends)
export(copydeploymentfolders.commands)
QMAKE_EXTRA_TARGETS += first copydeploymentfolders
}
}
for(deploymentfolder, DEPLOYMENTFOLDERS) {
item = item$${deploymentfolder}
itemfiles = $${item}.files
$$itemfiles = $$eval($${deploymentfolder}.source)
itempath = $${item}.path
$$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target)
export($$itemfiles)
export($$itempath)
INSTALLS += $$item
}
icon.files = $${TARGET}.png
icon.path = /usr/share/icons/hicolor/64x64/apps
desktopfile.files = $${TARGET}.desktop
target.path = $${installPrefix}/bin
export(icon.files)
export(icon.path)
export(desktopfile.files)
export(desktopfile.path)
export(target.path)
INSTALLS += desktopfile icon target
}
export (INSTALLS)
export (DEPLOYMENT)
export (TARGET.EPOCHEAPSIZE)
export (TARGET.CAPABILITY)
export (LIBS)
export (QMAKE_EXTRA_TARGETS)
}
# This file should not be edited.
# Following versions of Qt Creator might offer new version.
defineTest(qtcAddDeployment) {
for(deploymentfolder, DEPLOYMENTFOLDERS) {
item = item$${deploymentfolder}
itemsources = $${item}.sources
$$itemsources = $$eval($${deploymentfolder}.source)
itempath = $${item}.path
$$itempath= $$eval($${deploymentfolder}.target)
export($$itemsources)
export($$itempath)
DEPLOYMENT += $$item
}
MAINPROFILEPWD = $$PWD
symbian {
TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -leiksrv -lcone
contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices
} else:win32 {
!isEqual(PWD,$$OUT_PWD) {
copyCommand = @echo Copying application data...
for(deploymentfolder, DEPLOYMENTFOLDERS) {
source = $$eval($${deploymentfolder}.source)
pathSegments = $$split(source, /)
sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments)
copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\)
}
copydeploymentfolders.commands = $$copyCommand
first.depends = $(first) copydeploymentfolders
export(first.depends)
export(copydeploymentfolders.commands)
QMAKE_EXTRA_TARGETS += first copydeploymentfolders
}
} else:unix {
maemo5 {
installPrefix = /opt/usr
desktopfile.path = /usr/share/applications/hildon
} else {
installPrefix = /usr/local
desktopfile.path = /usr/share/applications
!isEqual(PWD,$$OUT_PWD) {
copyCommand = @echo Copying application data...
for(deploymentfolder, DEPLOYMENTFOLDERS) {
macx {
target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
} else {
target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
}
copyCommand += && $(MKDIR) $$target
copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target
}
copydeploymentfolders.commands = $$copyCommand
first.depends = $(first) copydeploymentfolders
export(first.depends)
export(copydeploymentfolders.commands)
QMAKE_EXTRA_TARGETS += first copydeploymentfolders
}
}
for(deploymentfolder, DEPLOYMENTFOLDERS) {
item = item$${deploymentfolder}
itemfiles = $${item}.files
$$itemfiles = $$eval($${deploymentfolder}.source)
itempath = $${item}.path
$$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target)
export($$itemfiles)
export($$itempath)
INSTALLS += $$item
}
icon.files = $${TARGET}.png
icon.path = /usr/share/icons/hicolor/64x64/apps
desktopfile.files = $${TARGET}.desktop
target.path = $${installPrefix}/bin
export(icon.files)
export(icon.path)
export(desktopfile.files)
export(desktopfile.path)
export(target.path)
INSTALLS += desktopfile icon target
}
export (INSTALLS)
export (DEPLOYMENT)
export (TARGET.EPOCHEAPSIZE)
export (TARGET.CAPABILITY)
export (LIBS)
export (QMAKE_EXTRA_TARGETS)
}
......@@ -41,6 +41,8 @@ namespace Internal {
const QString mainWindowBaseName(QLatin1String("mainwindow"));
const QString deploymentPriFileName(QLatin1String("deployment.pri"));
const QString deploymentPriOrigRelFilePath(QLatin1String("../shared/") + deploymentPriFileName);
const QString mainWindowCppFileName(mainWindowBaseName + QLatin1String(".cpp"));
const QString mainWindowHFileName(mainWindowBaseName + QLatin1String(".h"));
const QString mainWindowUiFileName(mainWindowBaseName + QLatin1String(".ui"));
......@@ -172,8 +174,8 @@ QString MobileApp::path(Path path) const
case AppPro: return pathBase + m_projectName + QLatin1String(".pro");
case AppProOrigin: return originsRootMobileApp + QLatin1String("app.pro");
case AppProPath: return pathBase;
case AppPri: return pathBase + m_projectName + QLatin1String(".pri");
case AppPriOrigin: return originsRootMobileApp + QLatin1String("app.pri");
case DeploymentPri: return pathBase + deploymentPriFileName;
case DeploymentPriOrigin: return originsRootMobileApp + deploymentPriOrigRelFilePath;
case Desktop: return pathBase + m_projectName + QLatin1String(".desktop");
case DesktopOrigin: return originsRootShared + QLatin1String("app.desktop");
case MainWindowCpp: return pathBase + mainWindowCppFileName;
......@@ -283,8 +285,8 @@ QByteArray MobileApp::generateProFile(const QString *errorMessage) const
out << line << endl;
};
return proFileContent.replace("include(app.pri)", "include("
+ m_projectName.toLocal8Bit() + ".pri)");
return proFileContent.replace(deploymentPriOrigRelFilePath.toAscii(),
deploymentPriFileName.toAscii());
}
QByteArray MobileApp::generateDesktopFile(const QString *errorMessage) const
......@@ -322,7 +324,7 @@ Core::GeneratedFiles MobileApp::generateFiles(QString *errorMessage) const
files.append(file(generateFile(MobileAppGeneratedFileInfo::SymbianSvgIconFile, errorMessage), path(SymbianSvgIcon)));
files.append(file(generateFile(MobileAppGeneratedFileInfo::MaemoPngIconFile, errorMessage), path(MaemoPngIcon)));
files.append(file(generateFile(MobileAppGeneratedFileInfo::DesktopFile, errorMessage), path(Desktop)));
files.append(file(generateFile(MobileAppGeneratedFileInfo::AppPriFile, errorMessage), path(AppPri)));
files.append(file(generateFile(MobileAppGeneratedFileInfo::DeploymentPriFile, errorMessage), path(DeploymentPri)));
files.append(file(generateFile(MobileAppGeneratedFileInfo::MainWindowCppFile, errorMessage), path(MainWindowCpp)));
files.append(file(generateFile(MobileAppGeneratedFileInfo::MainWindowHFile, errorMessage), path(MainWindowH)));
files.append(file(generateFile(MobileAppGeneratedFileInfo::MainWindowUiFile, errorMessage), path(MainWindowUi)));
......@@ -369,8 +371,8 @@ QByteArray MobileApp::generateFile(MobileAppGeneratedFileInfo::File file,
data = generateProFile(errorMessage);
comment = proFileComment;
break;
case MobileAppGeneratedFileInfo::AppPriFile:
data = readBlob(path(AppPriOrigin));
case MobileAppGeneratedFileInfo::DeploymentPriFile:
data = readBlob(path(DeploymentPriOrigin));
comment = proFileComment;
versionAndChecksum = true;
break;
......
......@@ -44,7 +44,7 @@ struct MobileAppGeneratedFileInfo
enum File {
MainCppFile,
AppProFile,
AppPriFile,
DeploymentPriFile,
MainWindowCppFile,
MainWindowHFile,
MainWindowUiFile,
......@@ -83,8 +83,8 @@ public:
AppProPath,
Desktop,
DesktopOrigin,
AppPri,
AppPriOrigin,
DeploymentPri,
DeploymentPriOrigin,
MainWindowCpp,
MainWindowCppOrigin,
MainWindowH,
......
......@@ -48,6 +48,8 @@ const QString appViewerBaseName(QLatin1String("qmlapplicationviewer"));
const QString appViewerPriFileName(appViewerBaseName + QLatin1String(".pri"));
const QString appViewerCppFileName(appViewerBaseName + QLatin1String(".cpp"));
const QString appViewerHFileName(appViewerBaseName + QLatin1String(".h"));
const QString deploymentPriFileName(QLatin1String("deployment.pri"));
const QString deploymentPriOrigRelFilePath(QLatin1String("../shared/") + deploymentPriFileName);
const QString appViewerOriginsSubDir(appViewerBaseName + QLatin1Char('/'));
const QString fileChecksum(QLatin1String("checksum"));
const QString fileStubVersion(QLatin1String("version"));
......@@ -298,6 +300,8 @@ QString QmlStandaloneApp::path(Path path) const
case DesktopOrigin: return originsRootShared + QLatin1String("app.desktop");
case AppViewerPri: return pathBase + appViewerTargetSubDir + appViewerPriFileName;
case AppViewerPriOrigin: return originsRootQmlApp + appViewerOriginsSubDir + appViewerPriFileName;
case DeploymentPri: return pathBase + deploymentPriFileName;
case DeploymentPriOrigin: return originsRootQmlApp + deploymentPriOrigRelFilePath;
case AppViewerCpp: return pathBase + appViewerTargetSubDir + appViewerCppFileName;
case AppViewerCppOrigin: return originsRootQmlApp + appViewerOriginsSubDir + appViewerCppFileName;
case AppViewerH: return pathBase + appViewerTargetSubDir + appViewerHFileName;
......@@ -442,6 +446,9 @@ QByteArray QmlStandaloneApp::generateProFile(const QString *errorMessage) const
out << line << endl;
};
proFileContent.replace(deploymentPriOrigRelFilePath.toAscii(),
deploymentPriFileName.toAscii());
return proFileContent;
}
......@@ -567,6 +574,7 @@ Core::GeneratedFiles QmlStandaloneApp::generateFiles(QString *errorMessage) cons
files.append(file(generateFile(QmlAppGeneratedFileInfo::DesktopFile, errorMessage), path(Desktop)));
files.append(file(generateFile(QmlAppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)));
files.append(file(generateFile(QmlAppGeneratedFileInfo::DeploymentPriFile, errorMessage), path(DeploymentPri)));
files.append(file(generateFile(QmlAppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)));
files.append(file(generateFile(QmlAppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH)));
......@@ -630,6 +638,11 @@ QByteArray QmlStandaloneApp::generateFile(QmlAppGeneratedFileInfo::File file,
comment = proFileComment;
versionAndChecksum = true;
break;
case QmlAppGeneratedFileInfo::DeploymentPriFile:
data = readBlob(path(DeploymentPriOrigin));
comment = proFileComment;
versionAndChecksum = true;
break;
case QmlAppGeneratedFileInfo::AppViewerCppFile:
data = readBlob(path(AppViewerCppOrigin));
versionAndChecksum = true;
......@@ -657,7 +670,7 @@ QByteArray QmlStandaloneApp::generateFile(QmlAppGeneratedFileInfo::File file,
int QmlStandaloneApp::stubVersion()
{
return 4;
return 5;
}
static QList<QmlAppGeneratedFileInfo> updateableFiles(const QString &mainProFile)
......@@ -669,7 +682,9 @@ static QList<QmlAppGeneratedFileInfo> updateableFiles(const QString &mainProFile
} files[] = {
{QmlAppGeneratedFileInfo::AppViewerPriFile, appViewerPriFileName},
{QmlAppGeneratedFileInfo::AppViewerHFile, appViewerHFileName},
{QmlAppGeneratedFileInfo::AppViewerCppFile, appViewerCppFileName}
{QmlAppGeneratedFileInfo::AppViewerCppFile, appViewerCppFileName},
{QmlAppGeneratedFileInfo::DeploymentPriFile,
QLatin1String("../") + deploymentPriFileName}
};
const QFileInfo mainProFileInfo(mainProFile);
const int size = sizeof(files) / sizeof(files[0]);
......
......@@ -83,6 +83,7 @@ struct QmlAppGeneratedFileInfo
MainCppFile,
AppProFile,
AppViewerPriFile,
DeploymentPriFile,
AppViewerCppFile,
AppViewerHFile,
SymbianSvgIconFile,
......@@ -125,6 +126,8 @@ public:
DesktopOrigin,
AppViewerPri,
AppViewerPriOrigin,
DeploymentPri,
DeploymentPriOrigin,
AppViewerCpp,
AppViewerCppOrigin,
AppViewerH,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment