Commit a6f12b35 authored by Jarek Kobus's avatar Jarek Kobus

Replace qtquick 1.1's deployment with qrc file.

Don't generate Qt icons for Qt Quick App projects anymore.

Change-Id: Ic0fc43235a5b8da6696d5eb8d4a765d49b03dfd1
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@digia.com>
Reviewed-by: default avatarJarek Kobus <jaroslaw.kobus@digia.com>
parent d59f5c19
# Add more folders to ship with the application, here
# DEPLOYMENTFOLDERS #
folder_01.source = qml
folder_01.target =
DEPLOYMENTFOLDERS = folder_01
# DEPLOYMENTFOLDERS_END #
# Additional import path used to resolve QML modules in Creator's code model
# QML_IMPORT_PATH #
QML_IMPORT_PATH =
......@@ -12,11 +5,13 @@ QML_IMPORT_PATH =
# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp
RESOURCES += qml.qrc
# Installation path
# target.path =
# Please do not modify the following two lines. Required for deployment.
include(../../shared/qtquickapplicationviewer/qtquick1applicationviewer/qtquick1applicationviewer.pri)
# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qtquick1applicationviewer.pri, instead) #
include(../../shared/deployment.pri)
qtcAddDeployment()
# Default rules for deployment.
include(../../shared/qrcdeployment.pri)
......@@ -8,7 +8,7 @@ int main(int argc, char *argv[])
QtQuick1ApplicationViewer viewer;
viewer.addImportPath(QLatin1String("modules")); // ADDIMPORTPATH
viewer.setOrientation(QtQuick1ApplicationViewer::ScreenOrientationAuto); // ORIENTATION
viewer.setMainQmlFile(QLatin1String("qml/main.qml")); // MAINQML
viewer.setMainQmlFile(QLatin1String("qrc:///qml/main.qml")); // MAINQML
viewer.showExpanded();
return app.exec();
......
<RCC>
<qresource prefix="/">
<file>qml/main.qml</file>
</qresource>
</RCC>
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="E"
featuresRequired="QtSupport.Wizards.FeatureQtQuick.1.1"
qrcdeployment="qrcdeployment.pri"
viewerdir="qtquick1applicationviewer"
viewerclassname="QtQuick1ApplicationViewer"
stubversionminor="24">
......
......@@ -9,53 +9,13 @@
#include "qtquick1applicationviewer.h"
#include <QDir>
#include <QFileInfo>
#include <QApplication>
#include <QDeclarativeComponent>
#include <QDeclarativeEngine>
#include <QDeclarativeContext>
#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
class QtQuick1ApplicationViewerPrivate
{
QString mainQmlFile;
friend class QtQuick1ApplicationViewer;
static QString adjustPath(const QString &path);
};
QString QtQuick1ApplicationViewerPrivate::adjustPath(const QString &path)
{
#if defined(Q_OS_IOS)
if (!QDir::isAbsolutePath(path))
return QString::fromLatin1("%1/%2")
.arg(QCoreApplication::applicationDirPath(), path);
#elif defined(Q_OS_MAC)
if (!QDir::isAbsolutePath(path))
return QString::fromLatin1("%1/../Resources/%2")
.arg(QCoreApplication::applicationDirPath(), path);
#elif defined(Q_OS_BLACKBERRY)
if (!QDir::isAbsolutePath(path))
return QString::fromLatin1("app/native/%1").arg(path);
#elif !defined(Q_OS_ANDROID)
QString pathInInstallDir =
QString::fromLatin1("%1/../%2").arg(
QCoreApplication::applicationDirPath(), path);
if (QFileInfo(pathInInstallDir).exists())
return pathInInstallDir;
pathInInstallDir =
QString::fromLatin1("%1/%2").arg(
QCoreApplication::applicationDirPath(), path);
if (QFileInfo(pathInInstallDir).exists())
return pathInInstallDir;
#endif
return path;
}
QtQuick1ApplicationViewer::QtQuick1ApplicationViewer(QWidget *parent)
: QDeclarativeView(parent)
, d(new QtQuick1ApplicationViewerPrivate())
{
connect(engine(), SIGNAL(quit()), SLOT(close()));
setResizeMode(QDeclarativeView::SizeRootObjectToView);
......@@ -63,7 +23,6 @@ QtQuick1ApplicationViewer::QtQuick1ApplicationViewer(QWidget *parent)
QtQuick1ApplicationViewer::~QtQuick1ApplicationViewer()
{
delete d;
}
QtQuick1ApplicationViewer *QtQuick1ApplicationViewer::create()
......@@ -73,17 +32,12 @@ QtQuick1ApplicationViewer *QtQuick1ApplicationViewer::create()
void QtQuick1ApplicationViewer::setMainQmlFile(const QString &file)
{
d->mainQmlFile = QtQuick1ApplicationViewerPrivate::adjustPath(file);
#ifdef Q_OS_ANDROID
setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
#else
setSource(QUrl::fromLocalFile(d->mainQmlFile));
#endif
setSource(file);
}
void QtQuick1ApplicationViewer::addImportPath(const QString &path)
{
engine()->addImportPath(QtQuick1ApplicationViewerPrivate::adjustPath(path));
engine()->addImportPath(path);
}
void QtQuick1ApplicationViewer::setOrientation(ScreenOrientation orientation)
......
......@@ -35,9 +35,6 @@ public:
void setOrientation(ScreenOrientation orientation);
void showExpanded();
private:
class QtQuick1ApplicationViewerPrivate *d;
};
#endif // QTQUICK1APPLICATIONVIEWER_H
......@@ -80,26 +80,6 @@ void AbstractMobileApp::setProjectPath(const QString &path)
m_projectPath.setFile(path);
}
void AbstractMobileApp::setPngIcon64(const QString &icon)
{
m_pngIcon64 = icon;
}
QString AbstractMobileApp::pngIcon64() const
{
return path(PngIconOrigin64);
}
void AbstractMobileApp::setPngIcon80(const QString &icon)
{
m_pngIcon80 = icon;
}
QString AbstractMobileApp::pngIcon80() const
{
return path(PngIconOrigin80);
}
QString AbstractMobileApp::path(int fileType) const
{
const QString originsRootApp = originsRoot();
......@@ -114,12 +94,6 @@ QString AbstractMobileApp::path(int fileType) const
case DesktopOrigin: return originsRootShared + QLatin1String("app.desktop");
case DeploymentPri: return outputPathBase() + DeploymentPriFileName;
case DeploymentPriOrigin: return originsRootShared + DeploymentPriFileName;
case PngIcon64: return outputPathBase() + m_projectName + QLatin1String("64.png");
case PngIconOrigin64: return !m_pngIcon64.isEmpty() ? m_pngIcon64
: originsRootShared + QLatin1String("icon64.png");
case PngIcon80: return outputPathBase() + m_projectName + QLatin1String("80.png");
case PngIconOrigin80: return !m_pngIcon80.isEmpty() ? m_pngIcon80
: originsRootShared + QLatin1String("icon80.png");
default: return pathExtended(fileType);
}
return QString();
......@@ -307,8 +281,6 @@ Core::GeneratedFiles AbstractMobileApp::generateFiles(QString *errorMessage) con
files << file(generateFile(AbstractGeneratedFileInfo::AppProFile, errorMessage), path(AppPro));
files.last().setAttributes(Core::GeneratedFile::OpenProjectAttribute);
files << file(generateFile(AbstractGeneratedFileInfo::MainCppFile, errorMessage), path(MainCpp));
files << file(generateFile(AbstractGeneratedFileInfo::PngIcon64File, errorMessage), path(PngIcon64));
files << file(generateFile(AbstractGeneratedFileInfo::PngIcon80File, errorMessage), path(PngIcon80));
return files;
}
#endif // CREATORLESSTEST
......@@ -341,12 +313,6 @@ QByteArray AbstractMobileApp::generateFile(int fileType,
data = generateProFile(errorMessage);
comment = ProFileComment;
break;
case AbstractGeneratedFileInfo::PngIcon64File:
data = readBlob(path(PngIconOrigin64), errorMessage);
break;
case AbstractGeneratedFileInfo::PngIcon80File:
data = readBlob(path(PngIconOrigin80), errorMessage);
break;
case AbstractGeneratedFileInfo::DeploymentPriFile:
data = readBlob(path(DeploymentPriOrigin), errorMessage);
comment = ProFileComment;
......
......@@ -53,8 +53,6 @@ struct
MainCppFile,
AppProFile,
DeploymentPriFile,
PngIcon64File,
PngIcon80File,
ExtendedFile
};
......@@ -89,10 +87,6 @@ public:
DesktopOrigin,
DeploymentPri,
DeploymentPriOrigin,
PngIcon64,
PngIconOrigin64,
PngIcon80,
PngIconOrigin80,
ExtendedFile
};
......@@ -101,10 +95,6 @@ public:
void setProjectName(const QString &name);
QString projectName() const;
void setProjectPath(const QString &path);
void setPngIcon64(const QString &icon);
QString pngIcon64() const;
void setPngIcon80(const QString &icon);
QString pngIcon80() const;
QString path(int fileType) const;
QString error() const;
......
......@@ -216,14 +216,11 @@ QString QtQuickApp::pathExtended(int fileType) const
const QString qrcDeploymentFile = QLatin1String("deployment.pri");
const QString qmlOriginDir = originsRoot() + QLatin1String("qml/");
const QString pathBase = outputPathBase();
switch (fileType) {
case MainQml: return pathBase + qmlSubDir + mainQmlFile;
case MainQmlDeployed: return qmlSubDir + mainQmlFile;
case MainQmlOrigin: return qmlOriginDir + mainQmlFile;
case MainQmlOrigin: return originsRoot() + qmlSubDir + mainQmlFile;
case MainQrc: return pathBase + mainQrcFile;
case MainQrcOrigin: return originsRoot() + mainQrcFile;
case QrcDeployment: return pathBase + qrcDeploymentFile;
......@@ -234,7 +231,6 @@ QString QtQuickApp::pathExtended(int fileType) const
case AppViewerCppOrigin: return qtQuickApplicationViewerDirectory() + appViewerOriginSubDir() + fileName(AppViewerCpp);
case AppViewerH: return pathBase + appViewerTargetSubDir + fileName(AppViewerH);
case AppViewerHOrigin: return qtQuickApplicationViewerDirectory() + appViewerOriginSubDir() + fileName(AppViewerH);
case QmlDirProFileRelative: return QString(qmlSubDir).remove(qmlSubDir.length() - 1, 1);
default: qFatal("QtQuickApp::pathExtended() needs more work");
}
return QString();
......@@ -252,11 +248,7 @@ QString QtQuickApp::mainWindowClassName() const
bool QtQuickApp::adaptCurrentMainCppTemplateLine(QString &line) const
{
const QLatin1Char quote('"');
if (line.contains(QLatin1String("// MAINQML")))
insertParameter(line, quote + path(MainQmlDeployed) + quote);
Q_UNUSED(line)
return true;
}
......@@ -351,7 +343,6 @@ QByteArray QtQuickApp::generateFileExtended(int fileType,
break;
case QtQuickAppGeneratedFileInfo::AppViewerPriFile:
data = readBlob(path(AppViewerPriOrigin), errorMessage);
data.append(readBlob(path(DeploymentPriOrigin), errorMessage));
*comment = ProFileComment;
*versionAndCheckSum = true;
break;
......@@ -404,9 +395,7 @@ QList<AbstractGeneratedFileInfo> QtQuickApp::updateableFiles(const QString &main
QList<DeploymentFolder> QtQuickApp::deploymentFolders() const
{
QList<DeploymentFolder> result;
result.append(DeploymentFolder(path(QmlDirProFileRelative), QLatin1String("")));
return result;
return QList<DeploymentFolder>();
}
} // namespace Internal
......
......@@ -71,7 +71,6 @@ class QtQuickApp : public AbstractMobileApp
public:
enum ExtendedFileType {
MainQml = ExtendedFile,
MainQmlDeployed,
MainQmlOrigin,
MainQrc,
MainQrcOrigin,
......@@ -81,7 +80,6 @@ public:
AppViewerCppOrigin,
AppViewerH,
AppViewerHOrigin,
QmlDirProFileRelative,
QrcDeployment,
QrcDeploymentOrigin
};
......
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