From 66e6d660edabd9c89517b7d3e86ebad381c0c741 Mon Sep 17 00:00:00 2001 From: Lincoln Ramsay Date: Tue, 19 Jun 2012 16:59:47 +1000 Subject: Get all the examples building and running on Desktop. Build the required C++ stubs for each example and deploy all the files so that the examples are runnable. Change-Id: I03d23cb37e1c484110a58934a9b0aa550d6915a6 Reviewed-by: Lorn Potter --- examples/sensors/grue/console_app/console_app.pro | 2 ++ examples/sensors/grue/console_app/main.cpp | 2 +- examples/sensors/grue/grue.qml | 6 ++-- examples/sensors/grue/import/import.pro | 10 +----- examples/sensors/grue/lib/lib.pro | 11 ------ examples/sensors/grue/main.cpp | 42 +++++++++++++++++++++++ examples/sensors/grue/plugin/plugin.pro | 7 ---- examples/sensors/grue/qml.pro | 8 ++++- 8 files changed, 56 insertions(+), 32 deletions(-) create mode 100644 examples/sensors/grue/main.cpp (limited to 'examples/sensors/grue') diff --git a/examples/sensors/grue/console_app/console_app.pro b/examples/sensors/grue/console_app/console_app.pro index 33d43176..285fd892 100644 --- a/examples/sensors/grue/console_app/console_app.pro +++ b/examples/sensors/grue/console_app/console_app.pro @@ -4,3 +4,5 @@ CONFIG += console QT=core sensors SOURCES=main.cpp +target.path = $$[QT_INSTALL_EXAMPLES]/sensors/grue +INSTALLS += target diff --git a/examples/sensors/grue/console_app/main.cpp b/examples/sensors/grue/console_app/main.cpp index dc62e4de..1a112aee 100644 --- a/examples/sensors/grue/console_app/main.cpp +++ b/examples/sensors/grue/console_app/main.cpp @@ -53,7 +53,7 @@ public: bool filter(QSensorReading *reading) { - int percent = reading->property("chanceOfBeingEaten").value() * 100; + int percent = reading->property("chanceOfBeingEaten").value(); if (percent == 0) { qDebug() << "It is light. You are safe from Grues."; } else if (lastPercent == 0) { diff --git a/examples/sensors/grue/grue.qml b/examples/sensors/grue/grue.qml index 05d267c7..a913e605 100644 --- a/examples/sensors/grue/grue.qml +++ b/examples/sensors/grue/grue.qml @@ -43,8 +43,8 @@ import QtMobility.sensors 1.3 import Grue 1.0 Rectangle { - width: 240 - height: 320 + width: 320 + height: 480 color: "black" GrueSensor { @@ -76,7 +76,7 @@ Rectangle { Text { id: text anchors.top: parent.top - anchors.topMargin: 20 + anchors.topMargin: 0 anchors.left: parent.left anchors.right: parent.right text: "I can't tell if you're going to be eaten by a Grue or not. You're on your own!" diff --git a/examples/sensors/grue/import/import.pro b/examples/sensors/grue/import/import.pro index 753e1ef8..3f46103f 100644 --- a/examples/sensors/grue/import/import.pro +++ b/examples/sensors/grue/import/import.pro @@ -11,10 +11,7 @@ LIBS += -L$$OUT_PWD/../lib -lgruesensor SOURCES = main.cpp -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX):DESTPATH=$$EXAMPLES_PREFIX/com.nokia.mt.grue/imports/Grue -else:DESTPATH=$$[QT_INSTALL_IMPORTS]/Grue +DESTPATH=$$[QT_INSTALL_IMPORTS]/Grue target.path=$$DESTPATH INSTALLS += target @@ -26,8 +23,3 @@ INSTALLS += qmldir OTHER_FILES += \ plugin.json qmldir -!isEmpty(EXAMPLES_PREFIX) { - QMAKE_LFLAGS += -Wl,-rpath,$$EXAMPLES_PREFIX/com.nokia.mt.grue/lib - DEFINES += "BUNDLED_PLUGIN=\\\"$$EXAMPLES_PREFIX/com.nokia.mt.grue/plugins/sensors/libqtsensors_grue.so\\\"" -} - diff --git a/examples/sensors/grue/lib/lib.pro b/examples/sensors/grue/lib/lib.pro index e048e607..9185e294 100644 --- a/examples/sensors/grue/lib/lib.pro +++ b/examples/sensors/grue/lib/lib.pro @@ -14,14 +14,3 @@ SOURCES += gruesensor.cpp\ target.path=$$[QT_INSTALL_LIBS] INSTALLS += target - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - target.path = $$EXAMPLES_PREFIX/com.nokia.mt.grue/lib - remove_so.commands = "rm $(INSTALL_ROOT)$${target.path}/lib$${TARGET}.so" - remove_so.CONFIG = no_path - remove_so.depends = install_target - INSTALLS += remove_so -} - diff --git a/examples/sensors/grue/main.cpp b/examples/sensors/grue/main.cpp new file mode 100644 index 00000000..2e89d310 --- /dev/null +++ b/examples/sensors/grue/main.cpp @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../stub.h" +SENSORS_EXAMPLE_MAIN(grue) diff --git a/examples/sensors/grue/plugin/plugin.pro b/examples/sensors/grue/plugin/plugin.pro index 32e127f1..03e66851 100644 --- a/examples/sensors/grue/plugin/plugin.pro +++ b/examples/sensors/grue/plugin/plugin.pro @@ -18,10 +18,3 @@ INSTALLS += target OTHER_FILES += \ plugin.json - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - target.path = $$EXAMPLES_PREFIX/com.nokia.mt.grue/plugins/sensors -} - diff --git a/examples/sensors/grue/qml.pro b/examples/sensors/grue/qml.pro index 269b9221..3e1097b2 100644 --- a/examples/sensors/grue/qml.pro +++ b/examples/sensors/grue/qml.pro @@ -1,7 +1,13 @@ -TEMPLATE = aux +TEMPLATE = app +TARGET = grue +QT += quick +SOURCES = main.cpp app.files = \ icon.png \ $$files(*.qml) \ grue.png +target.path = $$[QT_INSTALL_EXAMPLES]/sensors/grue +app.path = $$[QT_INSTALL_EXAMPLES]/sensors/grue +INSTALLS += target app -- cgit v1.2.3