SailfishOS fixes and docu

This commit is contained in:
pls.153 2023-10-09 22:32:58 +02:00
parent 48a80bf5fb
commit c264025a60
9 changed files with 210 additions and 11 deletions

View file

@ -60,6 +60,15 @@
If the conversion to 'qint64' is not possible, the hex string is returned,
which can be passed to READ-FROM-STRING to get arbitrary integer length.
Important note: because of the automatic conversion of INTEGERs, you need to
explicitly add '(float x)' to values you don't want to be converted to hex
strings, like drawing a line in a QML Canvas.
<b>mobile-p ()</b>
Returns T on android, iOS, SailfishOS.
<b>pixel-ratio ()</b>

View file

@ -9,13 +9,13 @@
(defmacro with-path ((color &optional (line-width 14)) &body body)
`(progn
(qjs |begin| *canvas* ,color ,line-width)
(qjs |begin| *canvas* ,color ,(float line-width))
,@body
(qjs |end| *canvas*)))
(defun draw-line (x1 y1 x2 y2)
(qjs |drawLine| *canvas*
x1 y1 x2 y2))
(float x1) (float y1) (float x2) (float y2)))
(defun draw-number (number)
(setf *number* number)

View file

@ -13,17 +13,17 @@
(defvar *canvas* "canvas")
(defun line (x1 y1 x2 y2)
(qjs |line| *canvas* x1 y1 x2 y2))
(qjs |line| *canvas* (float x1) (float y1) (float x2) (float y2)))
(defun move-to (x y)
(qjs |moveTo| *canvas* x y))
(qjs |moveTo| *canvas* (float x) (float y)))
(defun line-to (x y)
(qjs |lineTo| *canvas* x y))
(qjs |lineTo| *canvas* (float x) (float y)))
(defmacro with-path ((color line-width) &body body)
`(progn
(qjs |begin| *canvas* ,color ,line-width)
(qjs |begin| *canvas* ,color ,(float line-width))
,@body
(qjs |end| *canvas*)))

View file

@ -27,7 +27,7 @@ QMAKE_EXTRA_COMPILERS += lisp
win32: PRE_TARGETDEPS = tmp/app.lib
!win32: PRE_TARGETDEPS = tmp/libapp.a
QT += quick qml bluetooth sql positioning location
QT += quick qml bluetooth sql location
TEMPLATE = app
CONFIG += c++17 no_keywords release
DEFINES += DESKTOP_APP BACKGROUND_INI_LISP INI_ECL_CONTRIB QT_EXTENSION

View file

@ -1,4 +1,4 @@
QT += bluetooth sql positioning network
QT += bluetooth sql network # positioning
TEMPLATE = lib
CONFIG += c++17 plugin release no_keywords
DEFINES += PLUGIN

View file

@ -0,0 +1,105 @@
Manual installation of Qt5.15 rpms directly on device
-----------------------------------------------------
Please note that this is not a straightforward way to install, and may turn out
being tedious (I'm not a SailfishOS expert and have very limited experience).
(for **armv7hl**, replace with **aarch64** for 64bit)
Download from repo (see file list at bottom):
```
https://repo.sailfishos.org/obs/sailfishos:/chum/4.5.0.19_armv7hl/armv7hl/
```
Download all files in one directory and install with:
```
$ devel-su rpm -U --force *.rpm
```
On missing SailfishOS lib dependencies, search for package providing the lib
with:
```
$ zypper search <name>
```
and install with:
```
$ devel-su zypper install <name>
```
To force package install even with missing dependencies - may occur with rpms
that require e.g. `pkgconfig(...)`, even with standard `pkgconfig` already
installed - you can extract the rpm locally with:
```
$ rpm2cpio <rpm> | cpio -idmv
```
and copy the extracted files under `/opt/` and `/usr/`:
```
$ devel-su cp -r opt/* /opt/
$ devel-su cp -r usr/* /usr/
```
File list to download:
```
opt-kf5-karchive-5.108.0-1.5.2.jolla.armv7hl.rpm
opt-kf5-kauth-5.108.0-1.4.1.jolla.armv7hl.rpm
opt-kf5-kbookmarks-5.108.0-1.4.1.jolla.armv7hl.rpm
opt-kf5-kcodecs-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kcompletion-5.108.0-1.4.1.jolla.armv7hl.rpm
opt-kf5-kconfig-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kconfig-core-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kconfig-gui-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kconfigwidgets-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kcoreaddons-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kcrash-5.108.0-1.4.1.jolla.armv7hl.rpm
opt-kf5-kdbusaddons-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kguiaddons-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-ki18n-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kiconthemes-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kio-core-5.108.0-1.7.1.jolla.armv7hl.rpm
opt-kf5-kio-core-libs-5.108.0-1.7.1.jolla.armv7hl.rpm
opt-kf5-kio-file-widgets-5.108.0-1.7.1.jolla.armv7hl.rpm
opt-kf5-kio-gui-5.108.0-1.7.1.jolla.armv7hl.rpm
opt-kf5-kio-widgets-5.108.0-1.7.1.jolla.armv7hl.rpm
opt-kf5-kio-widgets-libs-5.108.0-1.7.1.jolla.armv7hl.rpm
opt-kf5-kirigami2-5.108.0-1.6.1.jolla.armv7hl.rpm
opt-kf5-kitemviews-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kjobwidgets-5.108.0-1.4.1.jolla.armv7hl.rpm
opt-kf5-knotifications-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kquickcharts-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kservice-5.108.0-1.4.1.jolla.armv7hl.rpm
opt-kf5-kwallet-5.108.0-1.4.1.jolla.armv7hl.rpm
opt-kf5-kwallet-libs-5.108.0-1.4.1.jolla.armv7hl.rpm
opt-kf5-kwidgetsaddons-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kwindowsystem-5.108.0-1.5.1.jolla.armv7hl.rpm
opt-kf5-kxmlgui-5.108.0-1.4.1.jolla.armv7hl.rpm
opt-kf5-solid-5.108.0-1.4.1.jolla.armv7hl.rpm
opt-plasma-integration-5.27.4\+git1-1.2.7.jolla.armv7hl.rpm
opt-qt5-qtbase-5.15.10\+kde137-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtbase-common-5.15.10\+kde137-1.3.1.jolla.noarch.rpm
opt-qt5-qtbase-devel-5.15.10+kde137-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtbase-gui-5.15.10\+kde137-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtconnectivity-5.15.10\+kde4-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtconnectivity-devel-5.15.10+kde4-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtdeclarative-5.15.10\+kde29-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtdeclarative-devel-5.15.10+kde29-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtdeclarative-tools-5.15.10+kde29-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtgraphicaleffects-5.15.10-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtimageformats-5.15.10+kde9-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtlocation-5.15.10\+kde4-1.5.1.jolla.armv7hl.rpm
opt-qt5-qtlocation-devel-5.15.10+kde4-1.5.1.jolla.armv7hl.rpm
opt-qt5-qtmultimedia-5.15.10+kde3-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtmultimedia-devel-5.15.10+kde3-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtquickcontrols-5.15.10-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtquickcontrols2-5.15.10\+kde6-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtquickcontrols2-devel-5.15.10+kde6-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtsensors-5.15.10-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtsvg-5.15.10\+kde8-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtwayland-5.15.10\+kde52-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtwebchannel-5.15.10\+kde3-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtwebengine-5.15.14-1.2307312104.armv7hl.rpm
opt-qt5-qtwebsockets-5.15.10+kde2-1.3.1.jolla.armv7hl.rpm
opt-qt5-qtwebview-5.15.10-1.3.2.jolla.armv7hl.rpm
opt-qt5-rpm-macros-5.15.10-1.4.1.jolla.noarch.rpm
opt-qt5-sfos-maliit-platforminputcontext-1.0.1-1.1.4.jolla.armv7hl.rpm
qqc2-breeze-style-5.27.4\+git1-1.2.8.jolla.armv7hl.rpm
qt-runner-0.4.0-1.6.1.jolla.armv7hl.rpm
```

73
readme-sailfish.md Normal file
View file

@ -0,0 +1,73 @@
Building ECL + LQML
-------------------
If you run Linux on your desktop, the simplest way to build and develop is just
doing it directly on the device (only this route is described here - no bloated
SDK or similar is needed, but Qt5.15 installation may result being tedious, but
I got it to work like described here).
After connecting your Sailfish device via USB, open 2 console tabs on Linux:
tab 1: shell
```
ssh -L4005:127.0.0.1:4005 defaultuser@192.168.2.15`
```
You need to manually do `source ~/.bashrc` for e.g. your personal aliases to
work.
tab 2: file access
```
mkdir ~/phone
sshfs defaultuser@192.168.2.15: ~/phone
```
First try to compile/install ECL (tab 1) just like you would do on the desktop.
Then follow the description
[qt5.15-rpm-installation](platforms/sailfish/qt5.15-rpm-installation.md).
Add an alias in `~/.bashrc` on the device:
```
alias qmake5.15=/opt/qt5/bin/qmake
```
Run `qt-runner` without arguments to check the following 2 settings:
- "Override DPI": set to 2/3 of max value, e.g. 458 * 2/3 = 305 (on my phone)
- Select "Reduce window when keyboard is shown"
- apply changes (top right)
Now you should be able to build/install lqml using `qmake` from above
installation. Note that you always need to start the apps using `qt-runner`:
```
qt-runner lqml run.lisp
```
For your final apps, just compile them in `build/`, rename `app` accordingly
and copy it under e.g. `/usr/local/bin/`. Since the executables contain all
resources, nothing else needs to be installed.
Developing with Slime directly on device
----------------------------------------
Using the 2 console tabs as described above, you can start Swank in tab 1:
```
qt-runner lqml run.lisp -slime
```
Add `-auto` for QML auto reload (just like on the desktop).
In tab 2 switch to a lqml example directory on device, open any Lisp file in
Emacs and connect:
```
:slime-connect RET RET
```
Tips
----
You should always kill `sshfs` after you are done using it:
```
pkill sshfs
```

View file

@ -6,7 +6,7 @@ A lightweight ECL based QML-only binding to Qt5/Qt6.
This small project aims to simplify all the steps needed for building
cross-platform apps. The same sources can be used to build executables for both
desktop (Linux/macOS/Windows) and mobile (android/iOS).
desktop (Linux/macOS/Windows) and mobile (android/iOS/SailfishOS).
QML auto reload
@ -48,7 +48,6 @@ Qt Creator.
TODO
----
* port to SailfishOS (using the SFOS Qt5.15 libs project)
* port to CMake (?)
@ -69,6 +68,15 @@ The Windows version is only meant to run on the desktop, using the (free) MSVC
compiler. Please see [readme-windows](readme-windows.md) for details.
SailfishOS note
---------------
On Sailfish it runs using **Qt5.15** and **qt-runner**, so it's not really
'native' (in a pure sense) and doesn't have native look and feel, but that's
the only feasable way to run it on that platform, see
[readme-sailfish](readme-sailfish.md).
Known issues
------------

View file

@ -23,7 +23,11 @@
Those hex strings are automatically converted back to a 'qint64' integer when
passed with 'Lisp.call()'.
If the conversion to 'qint64' is not possible, the hex string is returned,
which can be passed to READ-FROM-STRING to get arbitrary integer length."
which can be passed to READ-FROM-STRING to get arbitrary integer length.
Important note: because of the automatic conversion of INTEGERs, you need to
explicitly add '(float x)' to values you don't want to be converted to hex
strings, like drawing a line in a QML Canvas."
(assert (integerp integer))
(let ((*print-base* 16))
(x:cc "#x" (princ-to-string integer))))