From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: From: Josef Holzmayr Date: Thu, 3 Nov 2011 14:13:02 +0100 Message-Id: <1320325983-5124-1-git-send-email-holzmayr@rsi-elektrotechnik.de> Subject: [ptxdist] [PATCH 1/2] 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="===============2147148561==" Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: jbe@pengutronix.de, ptxdist@pengutronix.de --===============2147148561== Content-Type: text/plain Signed-off-by: Josef Holzmayr --- local_src/qml-demo-2011.11.0/main.cpp | 20 +++++ local_src/qml-demo-2011.11.0/qml-demo.pro | 15 ++++ local_src/qml-demo-2011.11.0/qml/main.qml | 125 +++++++++++++++++++++++++++++ projectroot/etc/init.d/startup | 6 +- rules/qml-demo.in | 15 ++++ rules/qml-demo.make | 78 ++++++++++++++++++ 6 files changed, 258 insertions(+), 1 deletions(-) create mode 100644 local_src/qml-demo-2011.11.0/main.cpp 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 rules/qml-demo.in create mode 100644 rules/qml-demo.make diff --git a/local_src/qml-demo-2011.11.0/main.cpp b/local_src/qml-demo-2011.11.0/main.cpp new file mode 100644 index 0000000..bd1e60d --- /dev/null +++ b/local_src/qml-demo-2011.11.0/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/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..8587a4f --- /dev/null +++ b/local_src/qml-demo-2011.11.0/qml-demo.pro @@ -0,0 +1,15 @@ +CONFIG += qt + +TARGET = qml-demo + +SOURCES = 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/projectroot/etc/init.d/startup b/projectroot/etc/init.d/startup index 3b27a32..d698944 100644 --- a/projectroot/etc/init.d/startup +++ b/projectroot/etc/init.d/startup @@ -6,7 +6,11 @@ case $1 in start) - /usr/bin/qt4-demo -qws & + if [ -x /usr/bin/qt4-demo ]; then + /usr/bin/qt4-demo -qws & + elif [ -x /usr/bin/qml-demo ]; then + /usr/bin/qml-demo -qws & + fi ;; esac diff --git a/rules/qml-demo.in b/rules/qml-demo.in new file mode 100644 index 0000000..0e7531e --- /dev/null +++ b/rules/qml-demo.in @@ -0,0 +1,15 @@ +## SECTION=qt + +config QML_DEMO + tristate + prompt "qml-demo" + select QT4 + select QT4_MOUSE_TSLIB + select STARTUP + select RC_ONCE + help + Enable this entry to get a simple QML demo running at startup on + your target. It can act as a simple example how to integrate your + own QML based application into this PTXdist project. + Part of this entry is the installation of a start script that runs + this QML application when the system starts. diff --git a/rules/qml-demo.make b/rules/qml-demo.make new file mode 100644 index 0000000..881692d --- /dev/null +++ b/rules/qml-demo.make @@ -0,0 +1,78 @@ +# -*-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 basically all QML file, though there's only one in this demo. + @for i in $(shell cd $(QML_DEMO_DIR)/qml && find . -iname *.qml); do \ + $(call install_copy, qml-demo, 0, 0, 0755, $(QML_DEMO_DIR)/qml/$$i, /usr/lib/qml-demo/$$i); \ + done + + @$(call install_alternative, qml-demo, 0, 0, 0755, \ + /etc/rc.once.d/tscalibrate) + + @$(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 --===============2147148561== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- ptxdist mailing list ptxdist@pengutronix.de --===============2147148561==--