From e8866954c0561d00f0235c4a192cde7088ee425f Mon Sep 17 00:00:00 2001 From: "pls.153" Date: Sat, 26 Oct 2024 12:58:15 +0200 Subject: [PATCH] revisions --- .../Qt6/advanced-qml-auto-reload/qml/main.qml | 4 +- examples/app-template/app.pro | 34 ++++++++++-- .../app-template/build-android/install-run.sh | 3 ++ examples/cl-repl/app.pro | 34 ++++++++++-- examples/tilt-sensor/lisp/main.lisp | 53 ++++++++++--------- examples/tilt-sensor/lisp/maze.lisp | 12 +++-- platforms/sailfish/qt5.15-installation.md | 7 ++- readme-sailfish.md | 15 ++++++ snippets/busy-simple/qml/main.qml | 2 +- 9 files changed, 120 insertions(+), 44 deletions(-) diff --git a/examples/Qt6/advanced-qml-auto-reload/qml/main.qml b/examples/Qt6/advanced-qml-auto-reload/qml/main.qml index 601c1c2..d464c64 100644 --- a/examples/Qt6/advanced-qml-auto-reload/qml/main.qml +++ b/examples/Qt6/advanced-qml-auto-reload/qml/main.qml @@ -1,8 +1,8 @@ import QtQuick import QtQuick.Controls import QtQuick.Controls.Basic -import ".ext/" as Ext // for single file auto reload (development) -//import "ext/" as Ext // release version +import ".ext/" as Ext // for single file auto reload (development) +//import "ext/" as Ext // release version Rectangle { id: main diff --git a/examples/app-template/app.pro b/examples/app-template/app.pro index 10ea04b..0eaacb9 100644 --- a/examples/app-template/app.pro +++ b/examples/app-template/app.pro @@ -47,12 +47,18 @@ win32 { } android { - QT += androidextras DEFINES -= DESKTOP_APP INCLUDEPATH = $$ECL/include LIBS = -L$$ECL/lib -lecl LIBS += -L../../../platforms/android/lib + equals(QT_MAJOR_VERSION, 6) { + QT += core-private + } + lessThan(QT_MAJOR_VERSION, 6) { + QT += androidextras + } + ANDROID_EXTRA_LIBS += $$ECL/lib/libecl.so #ANDROID_PACKAGE_SOURCE_DIR = ../platforms/android @@ -72,9 +78,31 @@ ios { } 32bit { - LIBS += -llqml32 -llisp32 + android { + equals(QT_MAJOR_VERSION, 6) { + LIBS += -llqml32_armeabi-v7a + } + lessThan(QT_MAJOR_VERSION, 6) { + LIBS += -llqml32 + } + } + !android { + LIBS += -llqml32 + } + LIBS += -llisp32 } else { - LIBS += -llqml -llisp + android { + equals(QT_MAJOR_VERSION, 6) { + LIBS += -llqml_arm64-v8a + } + lessThan(QT_MAJOR_VERSION, 6) { + LIBS += -llqml + } + } + !android { + LIBS += -llqml + } + LIBS += -llisp } LIBS += -Ltmp -lapp diff --git a/examples/app-template/build-android/install-run.sh b/examples/app-template/build-android/install-run.sh index 49d4358..a524da1 100755 --- a/examples/app-template/build-android/install-run.sh +++ b/examples/app-template/build-android/install-run.sh @@ -1,3 +1,6 @@ # install/update (keeps app data) adb install -r android-build/*.apk + +# try both adb shell am start -n org.qtproject.example.app/org.qtproject.qt5.android.bindings.QtActivity # Qt5 +adb shell am start -n org.qtproject.example.app/org.qtproject.qt.android.bindings.QtActivity # Qt6 diff --git a/examples/cl-repl/app.pro b/examples/cl-repl/app.pro index 5a56186..15b5692 100644 --- a/examples/cl-repl/app.pro +++ b/examples/cl-repl/app.pro @@ -54,7 +54,6 @@ win32 { } android { - QT += androidextras DEFINES += NO_TEXT_HANDLES NO_USB DEFINES -= DESKTOP_APP INCLUDEPATH = $$ECL/include @@ -65,6 +64,13 @@ android { LIBS += -lasdf -lecl-help -ldeflate -lecl-cdb -lecl-curl -lql-minitar -lsockets LIBS += -L../../../platforms/android/lib + equals(QT_MAJOR_VERSION, 6) { + QT += core-private + } + lessThan(QT_MAJOR_VERSION, 6) { + QT += androidextras + } + ANDROID_MIN_SDK_VERSION = 21 ANDROID_TARGET_SDK_VERSION = 34 ANDROID_EXTRA_LIBS += $$ECL/lib/libecl.so @@ -108,9 +114,31 @@ ios { } 32bit { - LIBS += -llqml32 -llisp32 + android { + equals(QT_MAJOR_VERSION, 6) { + LIBS += -llqml32_armeabi-v7a + } + lessThan(QT_MAJOR_VERSION, 6) { + LIBS += -llqml32 + } + } + !android { + LIBS += -llqml32 + } + LIBS += -llisp32 } else { - LIBS += -llqml -llisp + android { + equals(QT_MAJOR_VERSION, 6) { + LIBS += -llqml_arm64-v8a + } + lessThan(QT_MAJOR_VERSION, 6) { + LIBS += -llqml + } + } + !android { + LIBS += -llqml + } + LIBS += -llisp } LIBS += -Ltmp -lapp diff --git a/examples/tilt-sensor/lisp/main.lisp b/examples/tilt-sensor/lisp/main.lisp index 6f892ad..c36e8df 100644 --- a/examples/tilt-sensor/lisp/main.lisp +++ b/examples/tilt-sensor/lisp/main.lisp @@ -8,36 +8,37 @@ (defvar *max-x* (* (1- *width*) +w+)) (defun move (x-rotation y-rotation) ; called from QML - (labels ((add (x) - (truncate (signum x))) - (to-pos (x) - (truncate (/ (+ x (/ +w+ 2)) - +w+))) - (normalize (x) - (* (to-pos x) +w+))) - ;; x axis rotation changes y - ;; y axis rotation changes x - (let* ((dx (min (* 0.2 y-rotation) (1- +w+))) - (dy (min (* 0.2 x-rotation) (1- +w+))) - (add-x (add dx)) - (add-y (add dy))) - (setf *x* (min *x* *max-x*)) ; don't lose ball (initial x) - (if (aref *maze* - (+ add-x (to-pos *x*)) - (to-pos *y*)) - (setf *x* (normalize *x*)) - (incf *x* dx)) - (if (aref *maze* - (to-pos *x*) - (+ add-y (to-pos *y*))) - (setf *y* (normalize *y*)) - (incf *y* dy)))) - (move-ball) + (when *ready* + (labels ((add (x) + (truncate (signum x))) + (to-pos (x) + (truncate (/ (+ x (/ +w+ 2)) + +w+))) + (normalize (x) + (* (to-pos x) +w+))) + ;; x axis rotation changes y + ;; y axis rotation changes x + (let* ((dx (min (* 0.2 y-rotation) (1- +w+))) + (dy (min (* 0.2 x-rotation) (1- +w+))) + (add-x (add dx)) + (add-y (add dy))) + (setf *x* (min *x* *max-x*)) ; don't lose ball (initial x) + (if (aref *maze* + (min (1- *width*) (+ add-x (to-pos *x*))) + (max 0 (to-pos *y*))) + (setf *x* (normalize *x*)) + (incf *x* dx)) + (if (aref *maze* + (min (1- *width*) (to-pos *x*)) + (max 0 (+ add-y (to-pos *y*)))) + (setf *y* (normalize *y*)) + (incf *y* dy)))) + (move-ball)) (values)) ; no return value to QML (defun move-ball () (if (and (= *x* +w+) - (= *y* 0)) + (<= *y* 0)) (new-game) (let ((ball (find-quick-item ui:*ball*))) ;; 'qset' is faster than 'q>', but can't trigger animations diff --git a/examples/tilt-sensor/lisp/maze.lisp b/examples/tilt-sensor/lisp/maze.lisp index 67da828..276ed2f 100644 --- a/examples/tilt-sensor/lisp/maze.lisp +++ b/examples/tilt-sensor/lisp/maze.lisp @@ -8,7 +8,8 @@ (defconstant *width* 25) (defconstant *height* 39) -(defvar *maze*) +(defvar *maze* nil) +(defvar *ready* t) (defun carve-maze (x y) (let ((d (random 4))) @@ -33,10 +34,11 @@ (carve-maze x2 y2)))))) (defun generate-maze () - (set-visible 1 1 nil) - (carve-maze 1 1) - (set-visible 1 0 nil) - (set-visible (- *width* 1) (- *height* 2) nil)) + (let ((*ready* nil)) + (set-visible 1 1 nil) + (carve-maze 1 1) + (set-visible 1 0 nil) + (set-visible (- *width* 1) (- *height* 2) nil))) (defun set-visible (x y visible) (setf (aref *maze* x y) visible) diff --git a/platforms/sailfish/qt5.15-installation.md b/platforms/sailfish/qt5.15-installation.md index eed6608..503a38c 100644 --- a/platforms/sailfish/qt5.15-installation.md +++ b/platforms/sailfish/qt5.15-installation.md @@ -22,15 +22,14 @@ $ devel-su zypper install opt-qt5-qtmultimedia-devel $ devel-su zypper install opt-qt5-qtquickcontrols2-devel $ devel-su zypper install opt-qt5-qtsensors-devel ``` -In one occasion (opt-qtdeclarative-devel) it will say: +If it says: ``` Problem: This request will break your system! -nothing provides 'pkgconfig(android-headers)' needed by the to be installed libhybris-devel ``` -You can safely ignore this warning, nothing will really break (see below), +You can safely ignore those warnings, nothing will really break (see below), so just choose: ``` -Solution 3: break libhybris-devel by ignoring some of its dependencies +Solution 3: break -devel by ignoring some of its dependencies ``` Now you should be able to build/install the `lqml` executable and library. diff --git a/readme-sailfish.md b/readme-sailfish.md index 4e9f32c..946796d 100644 --- a/readme-sailfish.md +++ b/readme-sailfish.md @@ -33,6 +33,21 @@ $ sshfs defaultuser@192.168.2.15: ~/phone First try to compile/install ECL (tab 1) just like you would do on the desktop. +You may need to run the following commands before compiling (ensure to be +logged in to your free Jolla account): +``` +$ devel-su pkcon refresh +$ devel-su pkcon install zypper +$ devel-su zypper install gcc make +``` +You may also needed to edit `ecl-23.9.9/src/gmp/configure`, and replace all +occurrences of `linux*android*)` with `linux-android*)`. + +After compiling and installing ECL, add this soft link: +``` +$ devel-su ln -s /usr/local/lib/libecl.so.23.9 /usr/lib/libecl.so.23.9 +``` + Then follow the description [qt5.15-rpm-installation](platforms/sailfish/qt5.15-installation.md). diff --git a/snippets/busy-simple/qml/main.qml b/snippets/busy-simple/qml/main.qml index 9bd518d..05ebec1 100644 --- a/snippets/busy-simple/qml/main.qml +++ b/snippets/busy-simple/qml/main.qml @@ -8,7 +8,7 @@ Item { AnimatedImage { objectName: "busy" anchors.centerIn: parent - width: 64 + width: 32 height: width z: 10 source: "img/busy.gif"