summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorSarah Smith <sarah.j.smith@nokia.com>2012-02-29 10:15:01 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-23 06:10:59 +0100
commit907b9b08026838bd59643a748231aca2069cf930 (patch)
tree8e060ff73cd741f8f8a093e7ab79370686acbd3e /demos
parentef7aa31629b1455a479fc6e3b28d89a9da60ef8f (diff)
Refactor packaging and deployment.
Updating Qt3D's packaging and deployment: remove some platform specific packaging references. These can be hidden away in the build scripts for those platforms and do no need to be in the generic package logic. To support this approach begin fixing qmlres and the main.cpp's. Fix and streamline the pkg.pri file, and add some much needed comments. Note that this change *will* break current packaging scripts - those can need to be fixed in seperate commits. Change-Id: I05c2081f61b91bc91673668f6e423a206ac026d5 Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
Diffstat (limited to 'demos')
-rw-r--r--demos/quick3d/flickr3d/flickr3d.pro6
-rw-r--r--demos/quick3d/flickr3d/main.cpp7
-rw-r--r--demos/quick3d/qmlres.h150
-rw-r--r--demos/quick3d/robo_bounce/main.cpp7
-rw-r--r--demos/quick3d/robo_bounce/robo_bounce.pro10
-rw-r--r--demos/quick3d/robo_bounce/robo_bounce.qrc35
-rw-r--r--demos/quick3d/tea_service/main.cpp7
-rw-r--r--demos/quick3d/tea_service/tea_service.pro5
8 files changed, 20 insertions, 207 deletions
diff --git a/demos/quick3d/flickr3d/flickr3d.pro b/demos/quick3d/flickr3d/flickr3d.pro
index ddecd9b30..15348a2e2 100644
--- a/demos/quick3d/flickr3d/flickr3d.pro
+++ b/demos/quick3d/flickr3d/flickr3d.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = flickr3d
-QT += qml quick
+QT += qml quick 3dquick
CONFIG += qt warn_on
SOURCES += main.cpp
@@ -23,10 +23,8 @@ QML_INFRA_FILES = \
CATEGORY = demos
include(../../../pkg.pri)
-INSTALL_DIRS = qml
-mt: INSTALL_FILES = mt.qml
-
OTHER_FILES += \
+ mt.qml \
flickr3d.rc \
$$QML_INFRA_FILES
diff --git a/demos/quick3d/flickr3d/main.cpp b/demos/quick3d/flickr3d/main.cpp
index 85fb4e0e7..c6cd39892 100644
--- a/demos/quick3d/flickr3d/main.cpp
+++ b/demos/quick3d/flickr3d/main.cpp
@@ -39,6 +39,9 @@
**
****************************************************************************/
-#include "../qmlres.h"
+#include <qmlres.h>
-QUICK3D_MAIN("qml/desktop.qml")
+int main(int argc, char *argv[])
+{
+ return q_quick3d_main("qml/desktop.qml", "demos", argc, argv);
+}
diff --git a/demos/quick3d/qmlres.h b/demos/quick3d/qmlres.h
deleted file mode 100644
index 7d9ca3c0b..000000000
--- a/demos/quick3d/qmlres.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMLRES_H
-#define QMLRES_H
-
-#include <QtCore/qdir.h>
-#include <QtGui/QGuiApplication>
-#include <QtQuick/QQuickView>
-
-#include <QtCore/qdebug.h>
-
-#define internal_xstr(s) internal_str(s)
-#define internal_str(s) #s
-
-/*!
- \internal
- Returns a string with the path to qml resources, including qml sources,
- 3D assets and textures. The path depends on the platform, and (for
- some platforms) whether it was installed from a package or is being run
- in a development setting.
-*/
-static QString q_get_qmldir(const QString &name)
-{
- QString qml = name;
- // try for a Linux package install first
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
-#ifdef QT3D_USE_OPT
- QDir pkgdir(QLatin1String("/opt/mt/applications/" internal_xstr(QT3D_USE_OPT)));
-#else
- QDir pkgdir(QLatin1String("/usr/share/qt5/quick3d/demos"));
-#endif
-#else
- QDir pkgdir(QLatin1String("/usr/share/qt4/quick3d/demos"));
-#endif
- QString app = QCoreApplication::applicationFilePath();
- app = app.section(QDir::separator(), -1);
- if (pkgdir.cd(app) && pkgdir.exists())
- {
- qml = pkgdir.filePath(qml);
- }
- else
- {
- // failing that try Mac (pkg & dev) next
- QDir dir(QCoreApplication::applicationDirPath());
- if (dir.path().endsWith(QLatin1String("MacOS")))
- {
- if (dir.cdUp() && dir.cd(QLatin1String("Resources"))
- && dir.exists())
- {
- qml = dir.filePath(qml);
- }
- else
- {
- qWarning("Expected app bundle with QML resources!");
- }
- }
- else
- {
- // for Windows (pkg & dev), and for Linux dev expect to find it
- // in a "resources" directory next to the binary
- if (dir.cd(QLatin1String("resources")) && dir.exists())
- {
- QString app = QCoreApplication::applicationFilePath();
- app = QDir::toNativeSeparators(app);
- //For windows platforms the "app" filepath should have the .exe extension removed.
- const QString winExtension = ".exe";
- if (app.right(winExtension.length()) == winExtension) {
- app = app.left(app.length() - winExtension.length());
- }
-
- //Grab just the app name itself.
- app = app.section(QDir::separator(), -1);
-
- if (dir.cd(QLatin1String("demos")) && dir.cd(app) && dir.exists())
- {
- qml = dir.filePath(qml);
- }
- else
- {
- QString msg = QLatin1String("demos");
- msg += QDir::separator();
- msg += app;
- qWarning("Expected %s directry with qml resources!", qPrintable(msg));
- }
- }
- }
- }
- return qml;
-}
-
-#define QUICK3D_MAIN(file) \
-int main(int argc, char *argv[]) \
-{ \
- QGuiApplication app(argc, argv); \
- QSurfaceFormat f; \
- f.setSamples(16); \
- QQuickView view; \
- view.setFormat(f); \
- QString qml = q_get_qmldir(QLatin1String(file)); \
- view.setSource(QUrl::fromLocalFile(qml)); \
- if (QGuiApplication::arguments().contains(QLatin1String("-maximize"))) \
- view.showMaximized(); \
- else if (QGuiApplication::arguments().contains(QLatin1String("-fullscreen"))) \
- view.showFullScreen(); \
- else \
- view.show(); \
- return app.exec(); \
-} \
-
-
-#endif // QMLRES_H
diff --git a/demos/quick3d/robo_bounce/main.cpp b/demos/quick3d/robo_bounce/main.cpp
index 85fb4e0e7..c6cd39892 100644
--- a/demos/quick3d/robo_bounce/main.cpp
+++ b/demos/quick3d/robo_bounce/main.cpp
@@ -39,6 +39,9 @@
**
****************************************************************************/
-#include "../qmlres.h"
+#include <qmlres.h>
-QUICK3D_MAIN("qml/desktop.qml")
+int main(int argc, char *argv[])
+{
+ return q_quick3d_main("qml/desktop.qml", "demos", argc, argv);
+}
diff --git a/demos/quick3d/robo_bounce/robo_bounce.pro b/demos/quick3d/robo_bounce/robo_bounce.pro
index 88cf954d1..c1ebfedea 100644
--- a/demos/quick3d/robo_bounce/robo_bounce.pro
+++ b/demos/quick3d/robo_bounce/robo_bounce.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = robo_bounce
-QT += qml quick
+QT += qml quick 3dquick
SOURCES += main.cpp
ICON_FILE = ../icon.png
@@ -46,16 +46,10 @@ QML_MESHES_FILES = \
CATEGORY = demos
include(../../../pkg.pri)
-INSTALL_DIRS = qml
-mt: INSTALL_FILES = mt.qml
-
RC_FILE = robo_bounce.rc
OTHER_FILES += \
+ mt.qml \
robo_bounce.rc \
$$QML_INFRA_FILES \
$$RC_FILE
-
-RESOURCES += \
- robo_bounce.qrc
-
diff --git a/demos/quick3d/robo_bounce/robo_bounce.qrc b/demos/quick3d/robo_bounce/robo_bounce.qrc
deleted file mode 100644
index 4c0b9a2c9..000000000
--- a/demos/quick3d/robo_bounce/robo_bounce.qrc
+++ /dev/null
@@ -1,35 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>qml/Button.qml</file>
- <file>qml/calculator.js</file>
- <file>qml/Calculator.qml</file>
- <file>qml/desktop.qml</file>
- <file>qml/Display.qml</file>
- <file>qml/PushButton.qml</file>
- <file>qml/qmldir</file>
- <file>qml/QMLPanels.qml</file>
- <file>qml/RoboBounce.qml</file>
- <file>qml/Robot.qml</file>
- <file>qml/TronCube.qml</file>
- <file>qml/meshes/button-.png</file>
- <file>qml/meshes/button-blue.png</file>
- <file>qml/meshes/button-green.png</file>
- <file>qml/meshes/button-purple.png</file>
- <file>qml/meshes/button-red.png</file>
- <file>qml/meshes/button.png</file>
- <file>qml/meshes/calculatorSign.png</file>
- <file>qml/meshes/cubeButton.png</file>
- <file>qml/meshes/display.png</file>
- <file>qml/meshes/hazard.png</file>
- <file>qml/meshes/infobutton.png</file>
- <file>qml/meshes/QML3DSign.png</file>
- <file>qml/meshes/qtlogo.png</file>
- <file>qml/meshes/roboInfo.png</file>
- <file>qml/meshes/roboticArms.3ds</file>
- <file>qml/meshes/roboticBody.3ds</file>
- <file>qml/meshes/roboticHead.3ds</file>
- <file>qml/meshes/rotateButton2.png</file>
- <file>qml/meshes/sQt3D_logo.png</file>
- <file>qml/meshes/tronscape.png</file>
- </qresource>
-</RCC>
diff --git a/demos/quick3d/tea_service/main.cpp b/demos/quick3d/tea_service/main.cpp
index 85fb4e0e7..c6cd39892 100644
--- a/demos/quick3d/tea_service/main.cpp
+++ b/demos/quick3d/tea_service/main.cpp
@@ -39,6 +39,9 @@
**
****************************************************************************/
-#include "../qmlres.h"
+#include <qmlres.h>
-QUICK3D_MAIN("qml/desktop.qml")
+int main(int argc, char *argv[])
+{
+ return q_quick3d_main("qml/desktop.qml", "demos", argc, argv);
+}
diff --git a/demos/quick3d/tea_service/tea_service.pro b/demos/quick3d/tea_service/tea_service.pro
index 103adbb8f..d3ef30fa1 100644
--- a/demos/quick3d/tea_service/tea_service.pro
+++ b/demos/quick3d/tea_service/tea_service.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = tea_service
-QT += qml quick
+QT += qml quick 3dquick
CONFIG += qt warn_on
SOURCES += main.cpp
@@ -28,7 +28,4 @@ OTHER_FILES += \
$$QML_INFRA_FILES \
tea_service.rc
-INSTALL_DIRS = qml
-mt: INSTALL_FILES = mt.qml
-
RC_FILE = tea_service.rc