diff --git a/doc/.make-doc.lisp b/doc/.make-doc.lisp new file mode 100644 index 0000000..0e6bdde --- /dev/null +++ b/doc/.make-doc.lisp @@ -0,0 +1,96 @@ +;;; hack to generate 'help.htm' from both Lisp and Qt/C++ doc strings. +;;; usage: 'lqml .make-doc.lisp' + +(in-package :qml-user) + +(defparameter *help* nil) + +(defun add-cpp-docu () + (with-open-file (s "../src/cpp/ecl_ext.cpp") + (let (curr ex) + (flet ((add-curr () + (when curr + (push (reverse curr) *help*) + (setf curr nil))) + (trim (str) + (string-trim '(#\/) str))) + (x:while-it (read-line s nil nil) + (let ((line (string-trim " " x:it))) + (when (x:starts-with "///" line) + (when (x:starts-with "cl_object " ex) + (add-curr) + (let* ((pos (search "///" ex :start2 3)) ; exception: Lisp name at end of line + (fun (if pos + (trim (subseq ex (+ 3 pos))) + (trim (subseq ex 10))))) + (push (if pos + fun + (substitute #\- #\_ (string-trim "2" (subseq fun 0 (position #\( fun))))) + curr))) + (push (x:cc " " (trim line)) curr)) + (setf ex line))) + (add-curr))))) + +(defun add-lisp-docu () + (do-external-symbols (sym (find-package :qml)) + (let ((name (symbol-name sym))) + (when (and (or (char= #\Q (char name 0)) + (find name '("DEFINE-QT-WRAPPERS" "TR" "FIND-QUICK-ITEM" "RELOAD" "ROOT-ITEM" + "ENSURE-PERMISSION" "VIEW-STATUS-CHANGED" "COPY-ALL-ASSET-FILES" + "WITH-ROOT-ITEM" "HEX") + :test 'string=)) + (not (find name '("QQ") :test 'string=))) + (print name) + (x:when-it (documentation sym 'function) + (print :doc) + (let ((fun (string-downcase (symbol-name sym))) + (docu (x:split x:it #\Newline))) + (unless (string= fun (subseq (second docu) 7)) + (push (cons fun docu) *help*)))))))) + +(defun help () + (setf *help* nil) + (add-cpp-docu) + (add-lisp-docu) + (with-open-file (s "help.htm" :direction :output :if-exists :supersede) + (format s "~%~ + ~%~ + ~%~ + Function List~%~ + ~%~ + ~%~ + ~%~ +

LQML

~%~ +
~%~%")
+    (flet ((el (tag x)
+             (format nil "<~A>~A" tag x tag))
+           (! (x)
+             (format s "~A~%" x))
+           (tab ()
+             (write-string "  " s)))
+      (setf *help* (sort *help* #'string< :key (lambda (x) (string-trim " " (first x)))))
+      (dolist (curr *help*)
+        (! (el "b" (format nil "~A ~A" (string-trim " " (first curr)) (subseq (string-trim " " (second curr)) 6))))
+        (let ((n 2))
+          (when (x:starts-with "alias:" (string-trim " " (third curr)))
+            (incf n)
+            (! (el "b" (subseq (string-trim " " (third curr)) 7))))
+          (! "")
+          (let ((examples (nthcdr n curr))
+                nl)
+            (when examples
+              (dolist (example examples)
+                (if (x:starts-with "   " example)
+                    (progn
+                      (unless nl
+                        (setf nl t)
+                        (! ""))
+                      (! example))
+                    (! example))))))
+        (! "")
+        (! ""))
+      (format s "
~%~%~%")))) + +(progn + (help) + (qq)) diff --git a/doc/help.htm b/doc/help.htm index d6c0e79..eb3be59 100644 --- a/doc/help.htm +++ b/doc/help.htm @@ -146,7 +146,7 @@ qexit () Calls QEventLoop::exit(), in order to exit event processing after a call - QEXEC with a timeout. Returns T if the event loop has effectively been + to QEXEC with a timeout. Returns T if the event loop has effectively been exited. diff --git a/examples/meshtastic/hacks/readme.md b/examples/meshtastic/hacks/readme.md index f4230e1..66ec62c 100644 --- a/examples/meshtastic/hacks/readme.md +++ b/examples/meshtastic/hacks/readme.md @@ -1,5 +1,9 @@ -Before applying this patch, please install latest ECL from development branch -(as of May 2023). +Before applying this patch, ensure you have ECL >= 23.9.9 installed. + +(Assuming you already copied :float-features from Quicklisp under +`~/quicklisp/local-projects/`.) Just copy **float-features** from Quicklisp under -`~/quicklisp/local-projects/` and apply patch (or copy `float-features.lisp`). +`~/quicklisp/local-projects/` and apply patch (or just copy +`float-features.lisp`). + diff --git a/examples/meshtastic/qml/img/logo-128.png b/examples/meshtastic/qml/img/logo-128.png deleted file mode 100644 index 8cd1f56..0000000 Binary files a/examples/meshtastic/qml/img/logo-128.png and /dev/null differ diff --git a/examples/meshtastic/qml/main.qml b/examples/meshtastic/qml/main.qml index 92a3088..6ee270b 100644 --- a/examples/meshtastic/qml/main.qml +++ b/examples/meshtastic/qml/main.qml @@ -47,7 +47,7 @@ Item { } Image { - source: "img/logo-128.png" + source: "img/logo.png" x: 2 y: 2 width: headerHeight diff --git a/examples/meshtastic/readme.md b/examples/meshtastic/readme.md index 18c5e62..0ee88e1 100644 --- a/examples/meshtastic/readme.md +++ b/examples/meshtastic/readme.md @@ -59,6 +59,9 @@ The macOS version must be compiled first, moved to `/Applications/` and started from Finder (not the console), otherwise BLE permissions will not work (if run from console, the app will show a BLE exception and consume 100% CPU). +TODO: SailfishOS, using the Qt5.15 port (that is, SailfishOS using Qt5.6, with +additional Qt5.15 installed). + How to use cl-meshtastic diff --git a/src/cpp/ecl_ext.cpp b/src/cpp/ecl_ext.cpp index e0b9cf5..6c3ff3c 100644 --- a/src/cpp/ecl_ext.cpp +++ b/src/cpp/ecl_ext.cpp @@ -217,9 +217,9 @@ cl_object qfind_children2(cl_object l_obj, cl_object l_name, cl_object l_class) QByteArray className(toCString(l_class)); QObject* qobject = toQObjectPointer(l_obj); if (qobject != nullptr) { - QObjectList children = qobject->findChildren(objectName); + const QObjectList children = qobject->findChildren(objectName); cl_object l_children = ECL_NIL; - for (QObject* child : qAsConst(children)) { + for (QObject* child : children) { QByteArray className2(child->metaObject()->className()); if (className.isEmpty() || (className == className2)) { l_children = CONS(from_qobject_pointer(child), @@ -240,9 +240,9 @@ cl_object qchildren(cl_object l_item) { QObject* qobject = toQObjectPointer(l_item); QQuickItem* item = qobject_cast(qobject); // type check if (item != nullptr) { - QList children = item->childItems(); + const QList children = item->childItems(); cl_object l_children = ECL_NIL; - for (QQuickItem* child : qAsConst(children)) { + for (QQuickItem* child : children) { l_children = CONS(from_qobject_pointer(child), l_children); } @@ -410,7 +410,7 @@ cl_object qexec2(cl_object l_milliseconds) { cl_object qexit() { /// args: () /// Calls QEventLoop::exit(), in order to exit event processing after a call - /// QEXEC with a timeout. Returns T if the event loop has effectively been + /// to QEXEC with a timeout. Returns T if the event loop has effectively been /// exited. ecl_process_env()->nvalues = 1; if (LQML::eventLoop) { @@ -670,9 +670,9 @@ cl_object qdirectory(cl_object l_dir) { /// paths. /// (qdirectory "assets:/lib") QDir dir(toQString(l_dir)); - QFileInfoList infos(dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)); + const QFileInfoList infos(dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)); cl_object l_files = ECL_NIL; - for (QFileInfo info : qAsConst(infos)) { + for (QFileInfo info : infos) { QString path(info.absoluteFilePath()); if (info.isDir()) { path.append("/"); diff --git a/src/cpp/ecl_fun_plugin.h b/src/cpp/ecl_fun_plugin.h index c51f958..cef4606 100644 --- a/src/cpp/ecl_fun_plugin.h +++ b/src/cpp/ecl_fun_plugin.h @@ -392,8 +392,8 @@ cl_object from_qvariant(const QVariant& var) { case QMetaType::QUrl: l_obj = from_qstring(var.toString()); break; // special case (can be nested) case QMetaType::QVariantList: { - QVariantList list(var.value()); - for (QVariant v : qAsConst(list)) { + const QVariantList list(var.value()); + for (QVariant v : list) { l_obj = CONS(from_qvariant(v), l_obj); } l_obj = cl_nreverse(l_obj); diff --git a/src/cpp/main.h b/src/cpp/main.h index 371c1a8..ceec05e 100644 --- a/src/cpp/main.h +++ b/src/cpp/main.h @@ -103,7 +103,7 @@ public: const int code = s.at(0).unicode(); switch (code) { // replace iOS smart quotation marks with standard ones - // (Frensh, ...) + // (French, ...) case 171: case 187: s[0] = QChar('"'); diff --git a/src/cpp/marshal.cpp b/src/cpp/marshal.cpp index f8b1d6d..6ed22bc 100644 --- a/src/cpp/marshal.cpp +++ b/src/cpp/marshal.cpp @@ -318,8 +318,8 @@ cl_object from_qvariant(const QVariant& var) { case QMetaType::QUrl: l_obj = from_qstring(var.toString()); break; // special case (can be nested) case QMetaType::QVariantList: { - QVariantList list(var.value()); - for (QVariant v : qAsConst(list)) { + const QVariantList list(var.value()); + for (QVariant v : list) { l_obj = CONS(from_qvariant(v), l_obj); } l_obj = cl_nreverse(l_obj);