mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-06 02:30:38 -08:00
revision of example 'debug-ui'
This commit is contained in:
parent
08c81af287
commit
502799eba5
7 changed files with 121 additions and 7 deletions
|
|
@ -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")))
|
||||
|
||||
|
|
|
|||
13
examples/debug-ui/examples/clog-demo/app.asd
Normal file
13
examples/debug-ui/examples/clog-demo/app.asd
Normal file
|
|
@ -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")))
|
||||
24
examples/debug-ui/examples/clog-demo/qml/ext/Log.qml
Normal file
24
examples/debug-ui/examples/clog-demo/qml/ext/Log.qml
Normal file
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
72
examples/debug-ui/examples/clog-demo/qml/main.qml
Normal file
72
examples/debug-ui/examples/clog-demo/qml/main.qml
Normal file
|
|
@ -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--
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
examples/debug-ui/local-projects/lqml-debug.tgz
Normal file
BIN
examples/debug-ui/local-projects/lqml-debug.tgz
Normal file
Binary file not shown.
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
--------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue