diff --git a/examples/debug-ui/app.asd b/examples/debug-ui/app.asd index 332f8f2..72502a5 100644 --- a/examples/debug-ui/app.asd +++ b/examples/debug-ui/app.asd @@ -1,10 +1,7 @@ (defsystem :app :serial t - :depends-on () + :depends-on (lqml-debug) :components ((:file "lisp/package") (:file "lisp/ui-vars") - (:file "lisp/d-dialogs") ; for debug-ui - (:file "lisp/d-input-hook") ; for debug-ui - (:file "lisp/d-debug-ui") ; for debug-ui (:file "lisp/main"))) diff --git a/examples/debug-ui/examples/clog-demo/app.asd b/examples/debug-ui/examples/clog-demo/app.asd new file mode 100644 index 0000000..76dc92d --- /dev/null +++ b/examples/debug-ui/examples/clog-demo/app.asd @@ -0,0 +1,13 @@ +(defsystem :app + :serial t + ;; requires this CLOG fork: https://gitlab.com/eql/clog-for-mobile/-/blob/main/clog-2.2.tgz + :depends-on (lqml-debug + #-depends-loaded :clog) + :components ((:file "lisp/package") + (:file "lisp/ini") + (:file "lisp/ui-vars") + #+mobile (:file "lisp/swank-quicklisp") + ;;(:file "lisp/eval") + (:file "lisp/clog-bridge") + (:file "clog-assets/demos/01-demo") + (:file "lisp/main"))) diff --git a/examples/debug-ui/examples/clog-demo/qml/ext/Log.qml b/examples/debug-ui/examples/clog-demo/qml/ext/Log.qml new file mode 100644 index 0000000..56d84c8 --- /dev/null +++ b/examples/debug-ui/examples/clog-demo/qml/ext/Log.qml @@ -0,0 +1,24 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import "." as Ext + +Rectangle { + color: "lavender" + + //Ext.Repl {} + + function log(message) { + logModel.append({ message: message }) + listView.positionViewAtEnd() + } + + ListView { + id: listView + anchors.fill: parent + model: ListModel { id: logModel } + delegate: Text { + font.pixelSize: 14 + text: message + } + } +} diff --git a/examples/debug-ui/examples/clog-demo/qml/main.qml b/examples/debug-ui/examples/clog-demo/qml/main.qml new file mode 100644 index 0000000..a711c9a --- /dev/null +++ b/examples/debug-ui/examples/clog-demo/qml/main.qml @@ -0,0 +1,72 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import "ext/" as Ext +import "debug/" as Dbg + +StackView { + id: main + width: 400 + height: 650 + objectName: "main" + initialItem: mainRect + + // show/hide dialogs + + function pushDialog(name) { + switch (name) { + case "debug": main.push(dialogDebug); break + } + } + + function popDialog() { main.pop() } + + // log + + function log(message) { + logPage.log(message) + } + + FontLoader { id: fontIcons; source: "fonts/fontawesome-webfont.ttf" } + FontLoader { id: fontHack; source: "fonts/Hack-Regular.ttf" } + FontLoader { id: fontHackBold; source: "fonts/Hack-Bold.ttf" } + + Rectangle { + id: mainRect + color: "#bbb" + + SwipeView { + id: view + objectName: "view" + anchors.fill: parent + + // page 1: webview (native on mobile) + Ext.Browser {} + + // page 2: log + Ext.Log { id: logPage } + } + + PageIndicator { + anchors.bottom: view.bottom + anchors.bottomMargin: 10 + anchors.horizontalCenter: parent.horizontalCenter + count: view.count + currentIndex: view.currentIndex + } + + // dialogs + + Dbg.DebugDialog { id: dialogDebug } + } + + Keys.onPressed: (event) => { + if (event.key === Qt.Key_Back) { + event.accepted = true + if (view.currentIndex === 0) { + Lisp.call("qml:qquit") + } else { + view.currentIndex-- + } + } + } +} diff --git a/examples/debug-ui/local-projects/lqml-debug.tgz b/examples/debug-ui/local-projects/lqml-debug.tgz new file mode 100644 index 0000000..705bc39 Binary files /dev/null and b/examples/debug-ui/local-projects/lqml-debug.tgz differ diff --git a/examples/debug-ui/qml/main.qml b/examples/debug-ui/qml/main.qml index 312ea6d..8fa0ec6 100644 --- a/examples/debug-ui/qml/main.qml +++ b/examples/debug-ui/qml/main.qml @@ -6,10 +6,9 @@ import 'debug/' as Dbg StackView { id: main objectName: "main" - width: 800 // alternatively: Screen.desktopAvailableWidth - height: 600 // alternatively: Screen.desktopAvailableHeight + width: 800 + height: 600 initialItem: mainRect - Screen.orientationUpdateMask: Qt.LandscapeOrientation | Qt.PortraitOrientation | Qt.InvertedLandscapeOrientation // show/hide dialogs diff --git a/examples/debug-ui/readme.md b/examples/debug-ui/readme.md index 4c012ff..d352bed 100644 --- a/examples/debug-ui/readme.md +++ b/examples/debug-ui/readme.md @@ -12,6 +12,15 @@ This is especially helpful on android, where Lisp issues are hard to debug once the app is installed. +Prepare +------- + +* extract `local-projects/lqml-debug.tgz` under `~/quicklisp/local-projects/` +* add `lqml-debug` as your very first dependency in your `app.asd` +* modify your `main.qml` as can be seen in `examples/` +* comment out evtl. present `eval.lisp` (needed for repl) and `Ext.Repl {}` + + Important note --------------