From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: From: Josef Holzmayr Date: Fri, 4 Nov 2011 08:48:54 +0100 Message-Id: <1320392934-2943-2-git-send-email-holzmayr@rsi-elektrotechnik.de> In-Reply-To: <1320392934-2943-1-git-send-email-holzmayr@rsi-elektrotechnik.de> References: <1320392934-2943-1-git-send-email-holzmayr@rsi-elektrotechnik.de> Subject: [ptxdist] [PATCH] Add a simple QML demo application Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1294982932==" Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de, jbe@pengutronix.de --===============1294982932== Content-Type: text/plain Signed-off-by: Josef Holzmayr --- .../init/systemd/qmldemo.service | 10 ++ local_src/qml-demo-2011.11.0/init/sysv/startup | 12 ++ local_src/qml-demo-2011.11.0/qml-demo.pro | 15 +++ local_src/qml-demo-2011.11.0/qml/main.qml | 125 ++++++++++++++++++++ local_src/qml-demo-2011.11.0/src/main.cpp | 20 +++ rules/qml-demo.in | 31 +++++ rules/qml-demo.make | 95 +++++++++++++++ 7 files changed, 308 insertions(+), 0 deletions(-) create mode 100644 local_src/qml-demo-2011.11.0/init/systemd/qmldemo.service create mode 100644 local_src/qml-demo-2011.11.0/init/sysv/startup create mode 100644 local_src/qml-demo-2011.11.0/qml-demo.pro create mode 100644 local_src/qml-demo-2011.11.0/qml/main.qml create mode 100644 local_src/qml-demo-2011.11.0/src/main.cpp create mode 100644 rules/qml-demo.in create mode 100644 rules/qml-demo.make diff --git a/local_src/qml-demo-2011.11.0/init/systemd/qmldemo.service b/local_src/qml-demo-2011.11.0/init/systemd/qmldemo.service new file mode 100644 index 0000000..1d6d939 --- /dev/null +++ b/local_src/qml-demo-2011.11.0/init/systemd/qmldemo.service @@ -0,0 +1,10 @@ +[Unit] +Description=QML Demo Application +After=dev-input-event1.device + +[Service] +Environment=QWS_MOUSE_PROTO=Tslib:/dev/input/event1 +ExecStart=/usr/bin/qml-demo -qws + +[Install] +WantedBy=multi-user.target diff --git a/local_src/qml-demo-2011.11.0/init/sysv/startup b/local_src/qml-demo-2011.11.0/init/sysv/startup new file mode 100644 index 0000000..26ca4db --- /dev/null +++ b/local_src/qml-demo-2011.11.0/init/sysv/startup @@ -0,0 +1,12 @@ +#! /bin/sh + +# get important environment variables first +. /etc/profile.environment + +case $1 in + + start) + /usr/bin/qml-demo -qws & + ;; + +esac diff --git a/local_src/qml-demo-2011.11.0/qml-demo.pro b/local_src/qml-demo-2011.11.0/qml-demo.pro new file mode 100644 index 0000000..87b13a2 --- /dev/null +++ b/local_src/qml-demo-2011.11.0/qml-demo.pro @@ -0,0 +1,15 @@ +CONFIG += qt + +TARGET = qml-demo + +SOURCES = src/main.cpp +FORMS = +HEADERS = + +QT += declarative + +MOC_DIR = moc + +OTHER_FILES += \ + qml/main.qml + diff --git a/local_src/qml-demo-2011.11.0/qml/main.qml b/local_src/qml-demo-2011.11.0/qml/main.qml new file mode 100644 index 0000000..907e16e --- /dev/null +++ b/local_src/qml-demo-2011.11.0/qml/main.qml @@ -0,0 +1,125 @@ +import QtQuick 1.0 + +Rectangle { + id: page + color: "grey" + width: 320 + height: 240 + + Rectangle { + id: rectTL + x: 10 + y: 10 + width: 50 + height: 50 + color: "#00000000" + border.color: "#000000" + + MouseArea { + anchors.fill: parent + onClicked: page.state = 'TL' + } + } + Rectangle { + id: rectTR + x: 260 + y: 10 + width: 50 + height: 50 + color: "#00000000" + border.color: "#000000" + + MouseArea { + anchors.fill: parent + onClicked: page.state = 'TR' + } + } + Rectangle { + id: rectBL + x: 10 + y: 180 + width: 50 + height: 50 + color: "#00000000" + border.color: "#000000" + + MouseArea { + anchors.fill: parent + onClicked: page.state = 'BL' + } + } + Rectangle { + id: rectBR + x: 260 + y: 180 + width: 50 + height: 50 + color: "#00000000" + border.color: "#000000" + + MouseArea { + anchors.fill: parent + onClicked: page.state = 'BR' + } + } + + Rectangle { + id: marker + x: 145 + y: 105 + width: 30 + height: 30 + color: "#ff0000" + } + + Text { + id: text1 + x: 21 + y: 78 + text: qsTr("Touch the black squares to move the red marker.") + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + font.family: "Arial Black" + font.underline: true + font.pixelSize: 12 + } + states: [ + State { + name: "TL" + + PropertyChanges { + target: marker + x: 20 + y: 20 + } + }, + State { + name: "TR" + PropertyChanges { + target: marker + x: 270 + y: 20 + } + }, + State { + name: "BL" + PropertyChanges { + target: marker + x: 20 + y: 190 + } + }, + State { + name: "BR" + PropertyChanges { + target: marker + x: 270 + y: 190 + } + } + ] + + transitions: Transition { + NumberAnimation { properties: "x, y"; easing.type: Easing.InOutQuad; duration: 500 } + } +} diff --git a/local_src/qml-demo-2011.11.0/src/main.cpp b/local_src/qml-demo-2011.11.0/src/main.cpp new file mode 100644 index 0000000..bd1e60d --- /dev/null +++ b/local_src/qml-demo-2011.11.0/src/main.cpp @@ -0,0 +1,20 @@ +#include +#include +#include + +int main(int argc, char **argv) +{ + + QApplication app(argc, argv); + +/* Hide the mouse cursor. Guards are there to enable compileability on non-embedded qt systems*/ +#ifdef Q_WS_QWS + QWSServer::setCursorVisible( false ); +#endif + + QDeclarativeView *qdv = new QDeclarativeView; + qdv->setSource(QUrl::fromLocalFile("/usr/lib/qml-demo/main.qml")); + qdv->showFullScreen(); + + return app.exec();; +} diff --git a/rules/qml-demo.in b/rules/qml-demo.in new file mode 100644 index 0000000..c6abe79 --- /dev/null +++ b/rules/qml-demo.in @@ -0,0 +1,31 @@ +## SECTION=qt + +config QML_DEMO + tristate + prompt "qml-demo" + select QT4 + select QT4_MOUSE_TSLIB + select QT4_BUILD_DECLARATIVE + select RC_ONCE + help + Enable this entry to get a simple QML demo running on + your target. It can act as a simple example how to integrate + your own QML based application into this PTXdist project. + +if QML_DEMO + +config QML_DEMO_STARTUP_SCRIPT + bool + default y + depends on SYSTEMD + depends on !INITMETHOD_SYSTEMD + prompt "install a startup script for QML demo" + +config QML_DEMO_SYSTEMD_UNIT + bool + default y + depends on SYSTEMD + depends on INITMETHOD_SYSTEMD + prompt "install systemd unit files for QML demo" + +endif diff --git a/rules/qml-demo.make b/rules/qml-demo.make new file mode 100644 index 0000000..ba16c82 --- /dev/null +++ b/rules/qml-demo.make @@ -0,0 +1,95 @@ +# -*-makefile-*- +# +# Copyright (C) 2009 by Michael Olbrich +# Copyright (C) 2011 by Juergen Beisert +# Copyright (C) 2011 by Josef Holzmayr +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# We provide this package +# +PACKAGES-$(PTXCONF_QML_DEMO) += qml-demo + +# +# Paths and names +# +QML_DEMO_VERSION := 2011.11.0 +QML_DEMO := qml-demo-$(QML_DEMO_VERSION) +QML_DEMO_URL := file://$(PTXDIST_WORKSPACE)/local_src/$(QML_DEMO) +QML_DEMO_DIR := $(BUILDDIR)/$(QML_DEMO) +QML_DEMO_BUILD_OOT := YES +QML_DEMO_BUILDDIR := $(BUILDDIR)/$(QML_DEMO)-build + +# ---------------------------------------------------------------------------- +# Get +# ---------------------------------------------------------------------------- + +$(QML_DEMO_SOURCE): + @$(call targetinfo) + @$(call get, QML_DEMO) + +# ---------------------------------------------------------------------------- +# Target-Install +# ---------------------------------------------------------------------------- + +$(STATEDIR)/qml-demo.targetinstall: + @$(call targetinfo) + + @$(call install_init, qml-demo) + @$(call install_fixup, qml-demo,PACKAGE,qml-demo) + @$(call install_fixup, qml-demo,PRIORITY,optional) + @$(call install_fixup, qml-demo,VERSION,$(QML_DEMO_VERSION)) + @$(call install_fixup, qml-demo,SECTION,base) + @$(call install_fixup, qml-demo,AUTHOR,"Josef Holzmayr ") + @$(call install_fixup, qml-demo,DEPENDS,) + @$(call install_fixup, qml-demo,DESCRIPTION, "Simple QML Demo App") + +# install the essentials of this build to the target + @$(call install_copy, qml-demo, 0, 0, 0755, \ + $(QML_DEMO_BUILDDIR)/qml-demo, \ + /usr/bin/qml-demo) + +# copy the QML tree to the target as-is. + @$(call install_tree, qml-demo, 0, 0, $(QML_DEMO_DIR)/qml, \ + /usr/lib/qml-demo) + + @$(call install_alternative, qml-demo, 0, 0, 0755, \ + /etc/rc.once.d/tscalibrate) + +ifdef PTXCONF_INITMETHOD_SYSTEMD +ifdef PTXCONF_QML_DEMO_SYSTEMD_UNIT + @$(call install_copy, qml-demo, 0, 0, 0644, \ + $(QML_DEMO_DIR)/init/systemd/qmldemo.service, \ + /lib/systemd/system/qmldemo.service) + @$(call install_link, qml-demo, ../qmldemo.service, \ + /lib/systemd/system/multi-user.target.wants/qmldemo.service) +endif +endif +ifdef PTXCONF_INITMETHOD_BUSYBOX +ifdef PTXCONF_QML_DEMO_STARTUP_SCRIPT + @$(call install_copy, qml-demo, 0, 0, 0755, \ + $(QML_DEMO_DIR)/init/sysv/startup, \ + /etc/init.d/startup, n) + @$(call install_link, startup, ../init.d/startup, /etc/rc.d/S99startup) +endif +endif + + @$(call install_finish, qml-demo) + + @$(call touch) + +# ---------------------------------------------------------------------------- +# Clean +# ---------------------------------------------------------------------------- + +qml-demo_clean: + rm -rf $(STATEDIR)/qml-demo.* + rm -rf $(PKGDIR)/qml-demo_* + rm -rf $(QML_DEMO_DIR) + +# vim: syntax=make -- 1.7.4.1 -- _____________________________________________________________ R-S-I Elektrotechnik GmbH & Co. KG Woelkestrasse 11 D-85301 Schweitenkirchen Fon: +49 8444 9204-0 Fax: +49 8444 9204-50 www.rsi-elektrotechnik.de _____________________________________________________________ Amtsgericht Ingolstadt - GmbH: HRB 191328 - KG: HRA 170363 Gesch�ftsf�hrer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg USt-IdNr.: DE 128592548 --===============1294982932== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- ptxdist mailing list ptxdist@pengutronix.de --===============1294982932==--