mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-05 18:20:33 -08:00
example 'cl-repl': add help, screenshot; several revisions
This commit is contained in:
parent
ad70df7399
commit
a131436dde
14 changed files with 86 additions and 73 deletions
|
|
@ -72,7 +72,6 @@
|
|||
(define-symbol-macro :q (quicklisp)))
|
||||
|
||||
(export
|
||||
(list #+ios
|
||||
'start-swank
|
||||
(list 'start-swank
|
||||
'stop-swank
|
||||
'quicklisp))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#:debug-dialog
|
||||
#:get-file-name
|
||||
#:exited
|
||||
#:help
|
||||
#:push-dialog
|
||||
#:pop-dialog
|
||||
#:*file-name*))
|
||||
|
|
@ -26,8 +27,7 @@
|
|||
(disable-clipboard-menu)
|
||||
(prog1
|
||||
(> (q< |depth| ui:*main*) 1)
|
||||
(qjs |popDialog| ui:*main*)
|
||||
(exited)))
|
||||
(qjs |popDialog| ui:*main*)))
|
||||
|
||||
(defun wait-while-transition ()
|
||||
;; needed for evtl. recursive calls
|
||||
|
|
@ -43,7 +43,6 @@
|
|||
(q! |forceActiveFocus| ui:*query-input*)
|
||||
(q! |showKeyboard| ui:*main* t) ; needed on recursive calls
|
||||
(wait-for-closed)
|
||||
(pop-dialog)
|
||||
(qlater (lambda () (editor:ensure-focus :show)))
|
||||
(q< |text| ui:*query-input*))
|
||||
|
||||
|
|
@ -66,18 +65,20 @@
|
|||
(q! |forceActiveFocus| ui:*debug-input*)
|
||||
(qsingle-shot 500 (lambda () (q! |positionViewAtEnd| ui:*debug-text*)))
|
||||
(wait-for-closed)
|
||||
(pop-dialog)
|
||||
(qlater (lambda () (editor:ensure-focus :show)))
|
||||
(q< |text| ui:*debug-input*))
|
||||
|
||||
(let ((exited t))
|
||||
(let (waiting)
|
||||
(defun wait-for-closed ()
|
||||
(setf exited nil)
|
||||
(setf waiting t)
|
||||
;; busy waiting is safer than suspending a thread, especially on mobile
|
||||
(x:while (not exited)
|
||||
(qsleep 0.1)))
|
||||
(x:while waiting
|
||||
(qsleep 0.1))
|
||||
(pop-dialog))
|
||||
(defun exited () ; called from QML
|
||||
(setf exited t)))
|
||||
(unless waiting
|
||||
(pop-dialog))
|
||||
(setf waiting nil)))
|
||||
|
||||
;; file browser
|
||||
|
||||
|
|
@ -99,8 +100,9 @@
|
|||
(qsingle-shot 500 (lambda () (q! |forceActiveFocus| ui:*path*))))))
|
||||
|
||||
(defun directory-p (path)
|
||||
(not (or (pathname-name path)
|
||||
(pathname-type path))))
|
||||
(unless (equal "" path)
|
||||
(not (or (pathname-name path)
|
||||
(pathname-type path)))))
|
||||
|
||||
(defun set-file-name (file-name) ; called from QML
|
||||
(let ((name (remove-if (lambda (ch) (find ch "*?\\")) file-name)))
|
||||
|
|
@ -134,3 +136,7 @@
|
|||
(unless (x:ends-with "/" url)
|
||||
(setf path* (x:cc url "/")))
|
||||
(q> |folder| ui:*folder-model* url)))
|
||||
|
||||
(defun help ()
|
||||
(push-dialog :help))
|
||||
|
||||
|
|
|
|||
|
|
@ -658,19 +658,13 @@
|
|||
(print-eval-output :values "kill: eval thread not running")))
|
||||
(t
|
||||
(let ((cmd (cond ((cmd ":h")
|
||||
"(qml:help)")
|
||||
"(dialogs:help)")
|
||||
((cmd ":s")
|
||||
"(qml:start-swank)")
|
||||
((cmd ":q")
|
||||
"(qml:quicklisp)")
|
||||
((cmd ":a")
|
||||
"(require :asdf)")
|
||||
((cmd ":f")
|
||||
"(dialogs:get-file-name)")
|
||||
((cmd ":c")
|
||||
"(progn (qml:q! |clear| ui:*output-model*) (values))")
|
||||
((cmd ":r")
|
||||
"(editor:reload-qml)")
|
||||
((cmd "*")
|
||||
(format nil "(progn~% (editor::set-clipboard-text (prin1-to-string *))~% *)"))
|
||||
((x:starts-with ":? " text*)
|
||||
|
|
@ -1133,7 +1127,8 @@
|
|||
(change-font :smaller 3))
|
||||
(eval:ini :output 'print-eval-output
|
||||
:query-dialog 'dialogs:query-dialog
|
||||
:debug-dialog 'dialogs:debug-dialog))
|
||||
:debug-dialog 'dialogs:debug-dialog)
|
||||
(append-output (format nil "~% :h for help") :bold t))
|
||||
|
||||
;;; quit app
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@
|
|||
(define-symbol-macro :q (quicklisp)))
|
||||
|
||||
(export
|
||||
(list #+ios
|
||||
'start-swank
|
||||
(list 'start-swank
|
||||
'stop-swank
|
||||
'quicklisp))
|
||||
|
|
|
|||
|
|
@ -14,12 +14,8 @@ Rectangle {
|
|||
|
||||
Ext.MenuBack {
|
||||
id: menuBack
|
||||
Layout.fillWidth: true
|
||||
label: "Debug Dialog"
|
||||
|
||||
onPressed: {
|
||||
debugInput.text = ":q"
|
||||
Lisp.call("dialogs:exited")
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
|
|
|
|||
|
|
@ -26,11 +26,6 @@ Rectangle {
|
|||
Ext.MenuBack {
|
||||
id: menuBack
|
||||
|
||||
onPressed: {
|
||||
Lisp.call("dialogs:set-file-name", "")
|
||||
Lisp.call("dialogs:pop-dialog")
|
||||
}
|
||||
|
||||
Row {
|
||||
id: buttonRow
|
||||
spacing: 4
|
||||
|
|
|
|||
43
examples/cl-repl/qml/ext/Help.qml
Normal file
43
examples/cl-repl/qml/ext/Help.qml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import QtQuick 2.15
|
||||
import "." as Ext
|
||||
|
||||
Rectangle {
|
||||
color: "lightyellow"
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
|
||||
Ext.MenuBack {
|
||||
label: "Help"
|
||||
}
|
||||
|
||||
Ext.Flickable {
|
||||
id: flick
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
contentWidth: help.paintedWidth
|
||||
contentHeight: help.paintedHeight + 75
|
||||
|
||||
Text {
|
||||
id: help
|
||||
width: flick.width
|
||||
height: flick.height
|
||||
padding: 20
|
||||
wrapMode: Text.WordWrap
|
||||
font.pixelSize: 20
|
||||
text:
|
||||
"<h2>Help</h2>
|
||||
<ul>
|
||||
<p><b>:?</b> find regular expression, e.g. <b>:? prin[c1]</b></p>
|
||||
<p><b>*</b> copy result to clipboard</p>
|
||||
<p><b>:s</b> start swank server</p>
|
||||
<p><b>:c</b> clear all output</p>
|
||||
<p><b>:k</b> kill eval thread (long running task)</p>
|
||||
<p><b>double [Space]</b> auto completion, e.g. <b>m-v-b</b></p>
|
||||
<p><b>tap and hold</b> in the editor to select/copy/paste/eval s-expression, e.g. on <b>defun</b></p>
|
||||
<p><b>tap and hold</b> cursor buttons to move to beginning/end of line/file</p>
|
||||
</ul>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,9 +7,7 @@ Rectangle {
|
|||
height: backButton.height
|
||||
color: "#f0f0f0"
|
||||
|
||||
property string label
|
||||
|
||||
signal pressed()
|
||||
property alias label: label.text
|
||||
|
||||
Button {
|
||||
id: backButton
|
||||
|
|
@ -27,15 +25,27 @@ Rectangle {
|
|||
color: "#007aff"
|
||||
text: "\uf104"
|
||||
}
|
||||
|
||||
Text {
|
||||
x: 30
|
||||
height: backButton.height * 1.1 // align correction (different font from above)
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.weight: Font.DemiBold
|
||||
color: iconBack.color
|
||||
text: "Repl"
|
||||
visible: (Qt.platform.os === "ios")
|
||||
}
|
||||
|
||||
implicitWidth: 90
|
||||
color: menuBack.color
|
||||
}
|
||||
|
||||
onPressed: parent.pressed()
|
||||
onPressed: Lisp.call("dialogs:exited")
|
||||
}
|
||||
|
||||
Text {
|
||||
id: label
|
||||
anchors.centerIn: parent
|
||||
text: menuBack.label
|
||||
font.weight: Font.DemiBold
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@ Rectangle {
|
|||
Ext.MenuBack {
|
||||
id: menuBack
|
||||
label: "Query Dialog"
|
||||
|
||||
onPressed: {
|
||||
queryInput.clear()
|
||||
Lisp.call("dialogs:exited")
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
|
|
@ -44,29 +39,4 @@ Rectangle {
|
|||
font.pixelSize: queryInput.font.pixelSize - (main.small ? 2 : 0)
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: queryInput.y + queryInput.height + (main.small ? 7 : 10)
|
||||
spacing: 20
|
||||
visible: queryInput.focus
|
||||
|
||||
// cursor back
|
||||
Ext.ArrowButton {
|
||||
opacity: 0.15
|
||||
text: "\uf137"
|
||||
|
||||
onPressed: queryInput.cursorPosition--
|
||||
onPressAndHold: queryInput.cursorPosition = 0
|
||||
}
|
||||
|
||||
// cursor forward
|
||||
Ext.ArrowButton {
|
||||
opacity: 0.15
|
||||
text: "\uf138"
|
||||
|
||||
onPressed: queryInput.cursorPosition++
|
||||
onPressAndHold: queryInput.cursorPosition = queryInput.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ StackView {
|
|||
case "file": main.push(dialogFile); break;
|
||||
case "debug": main.push(dialogDebug); break;
|
||||
case "query": main.push(dialogQuery); break;
|
||||
case "help": main.push(dialogHelp); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -616,6 +617,7 @@ StackView {
|
|||
Ext.FileBrowser { id: dialogFile; opacity: 0 }
|
||||
Ext.QueryDialog { id: dialogQuery; opacity: 0 }
|
||||
Ext.DebugDialog { id: dialogDebug; opacity: 0 }
|
||||
Ext.Help { id: dialogHelp; opacity: 0 }
|
||||
|
||||
Ext.ClipboardMenu {}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@
|
|||
(define-symbol-macro :q (quicklisp)))
|
||||
|
||||
(export
|
||||
(list #+ios
|
||||
'start-swank
|
||||
(list 'start-swank
|
||||
'stop-swank
|
||||
'quicklisp))
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@
|
|||
(define-symbol-macro :q (quicklisp)))
|
||||
|
||||
(export
|
||||
(list #+ios
|
||||
'start-swank
|
||||
(list 'start-swank
|
||||
'stop-swank
|
||||
'quicklisp))
|
||||
|
|
|
|||
BIN
screenshots/cl-repl.jpg
Normal file
BIN
screenshots/cl-repl.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
|
|
@ -7,7 +7,7 @@
|
|||
#include <QQuickView>
|
||||
#include <QDebug>
|
||||
|
||||
const char LQML::version[] = "22.4.1"; // Apr 2022
|
||||
const char LQML::version[] = "22.4.2"; // Apr 2022
|
||||
|
||||
extern "C" void ini_LQML(cl_object);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue