mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-06 02:30:38 -08:00
fix example 'swank-server' to work again on mobile; revisions
This commit is contained in:
parent
fc662c4f48
commit
5f3b251a69
9 changed files with 59 additions and 44 deletions
|
|
@ -17,7 +17,7 @@
|
||||||
(let ((name (namestring *load-truename*)))
|
(let ((name (namestring *load-truename*)))
|
||||||
(subseq name
|
(subseq name
|
||||||
(length (namestring *default-pathname-defaults*))
|
(length (namestring *default-pathname-defaults*))
|
||||||
(position #\/ name :from-end t))))
|
(1+ (position #\/ name :from-end t)))))
|
||||||
|
|
||||||
;; load all LQML symbols
|
;; load all LQML symbols
|
||||||
(dolist (file (list "package" "x" "ecl-ext" "ini" "qml"))
|
(dolist (file (list "package" "x" "ecl-ext" "ini" "qml"))
|
||||||
|
|
@ -31,11 +31,11 @@
|
||||||
(asdf:make-build "app"
|
(asdf:make-build "app"
|
||||||
:monolithic t
|
:monolithic t
|
||||||
:type :static-library
|
:type :static-library
|
||||||
:move-here (cc *current* "/build/tmp/")
|
:move-here (cc *current* "build/tmp/")
|
||||||
:init-name "ini_app")
|
:init-name "ini_app")
|
||||||
(let* ((from (cc *current* "/build/tmp/app--all-systems.a"))
|
(let* ((from (cc *current* "build/tmp/app--all-systems.a"))
|
||||||
(to "libapp.a")
|
(to "libapp.a")
|
||||||
(to* (cc *current* "/build/tmp/" to)))
|
(to* (cc *current* "build/tmp/" to)))
|
||||||
(when (probe-file to*)
|
(when (probe-file to*)
|
||||||
(delete-file to*))
|
(delete-file to*))
|
||||||
(rename-file from to)))
|
(rename-file from to)))
|
||||||
|
|
@ -43,9 +43,9 @@
|
||||||
#+(or android ios)
|
#+(or android ios)
|
||||||
(progn
|
(progn
|
||||||
(defvar *asdf-system* "app")
|
(defvar *asdf-system* "app")
|
||||||
(defvar *ql-libs* (cc *current* "/ql-libs.lisp"))
|
(defvar *ql-libs* (cc *current* "ql-libs.lisp"))
|
||||||
(defvar *init-name* "ini_app")
|
(defvar *init-name* "ini_app")
|
||||||
(defvar *library-name* (format nil "~A/build-~A/tmp/app"
|
(defvar *library-name* (format nil "~Abuild-~A/tmp/app"
|
||||||
*current*
|
*current*
|
||||||
#+android "android"
|
#+android "android"
|
||||||
#+ios "ios"))
|
#+ios "ios"))
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
(in-package :app)
|
(in-package :app)
|
||||||
|
|
||||||
#+(or android ios)
|
#+(or android ios)
|
||||||
(qsingle-shot 1000 'auto-reload-qml)
|
(when qml::*remote-ip*
|
||||||
|
(qsingle-shot 1000 'auto-reload-qml))
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,17 @@
|
||||||
(in-package :qml)
|
(in-package :qml)
|
||||||
|
|
||||||
#+(or android ios)
|
#+(or android ios)
|
||||||
(defvar *remote-ip* #-interpreter
|
(defun remote-ip ()
|
||||||
(format nil "http://~A:8080/"
|
|
||||||
#.(progn
|
|
||||||
(terpri *query-io*)
|
(terpri *query-io*)
|
||||||
(princ "Please enter WiFi IP of desktop computer: " *query-io*)
|
(princ "Please enter WiFi IP of desktop computer (hit RET to skip): "
|
||||||
(read-line *query-io*))))
|
*query-io*)
|
||||||
|
(let ((ip (read-line *query-io*)))
|
||||||
|
(unless (x:empty-string ip)
|
||||||
|
(format nil "http://~A:8080/" ip))))
|
||||||
|
|
||||||
|
#+(or android ios)
|
||||||
|
(defvar *remote-ip* #+interpreter nil
|
||||||
|
#-interpreter #.(remote-ip))
|
||||||
|
|
||||||
#+(or android ios)
|
#+(or android ios)
|
||||||
(defun qml:view-status-changed (status)
|
(defun qml:view-status-changed (status)
|
||||||
|
|
@ -35,7 +40,9 @@
|
||||||
(if ini
|
(if ini
|
||||||
(progn
|
(progn
|
||||||
(setf ini nil)
|
(setf ini nil)
|
||||||
(qset *quick-view* |source| (x:cc *remote-ip* "qml/main.qml")))
|
(qset *engine* |baseUrl| *remote-ip*)
|
||||||
|
(let ((src (qget *quick-view* |source|)))
|
||||||
|
(qset *quick-view* |source| (subseq src #.(length "qrc:///")))))
|
||||||
(qml:reload)))
|
(qml:reload)))
|
||||||
(setf secs curr)))
|
(setf secs curr)))
|
||||||
(qsingle-shot 250 'auto-reload-qml)))
|
(qsingle-shot 250 'auto-reload-qml)))
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
(let ((name (namestring *load-truename*)))
|
(let ((name (namestring *load-truename*)))
|
||||||
(subseq name
|
(subseq name
|
||||||
(length (namestring *default-pathname-defaults*))
|
(length (namestring *default-pathname-defaults*))
|
||||||
(position #\/ name :from-end t))))
|
(1+ (position #\/ name :from-end t)))))
|
||||||
|
|
||||||
;; load all LQML symbols
|
;; load all LQML symbols
|
||||||
(dolist (file (list "package" "x" "ecl-ext" "ini" "qml"))
|
(dolist (file (list "package" "x" "ecl-ext" "ini" "qml"))
|
||||||
|
|
@ -71,11 +71,11 @@
|
||||||
(asdf:make-build "app"
|
(asdf:make-build "app"
|
||||||
:monolithic t
|
:monolithic t
|
||||||
:type :static-library
|
:type :static-library
|
||||||
:move-here (cc *current* "/build/tmp/")
|
:move-here (cc *current* "build/tmp/")
|
||||||
:init-name "ini_app")
|
:init-name "ini_app")
|
||||||
(let* ((from (cc *current* "/build/tmp/app--all-systems.a"))
|
(let* ((from (cc *current* "build/tmp/app--all-systems.a"))
|
||||||
(to "libapp.a")
|
(to "libapp.a")
|
||||||
(to* (cc *current* "/build/tmp/" to)))
|
(to* (cc *current* "build/tmp/" to)))
|
||||||
(when (probe-file to*)
|
(when (probe-file to*)
|
||||||
(delete-file to*))
|
(delete-file to*))
|
||||||
(rename-file from to)))
|
(rename-file from to)))
|
||||||
|
|
@ -84,9 +84,9 @@
|
||||||
(progn
|
(progn
|
||||||
(pushnew :interpreter *features*)
|
(pushnew :interpreter *features*)
|
||||||
(defvar *asdf-system* "app")
|
(defvar *asdf-system* "app")
|
||||||
(defvar *ql-libs* (cc *current* "/ql-libs.lisp"))
|
(defvar *ql-libs* (cc *current* "ql-libs.lisp"))
|
||||||
(defvar *init-name* "ini_app")
|
(defvar *init-name* "ini_app")
|
||||||
(defvar *library-name* (format nil "~A/build-~A/tmp/app"
|
(defvar *library-name* (format nil "~Abuild-~A/tmp/app"
|
||||||
*current*
|
*current*
|
||||||
#+android "android"
|
#+android "android"
|
||||||
#+ios "ios"))
|
#+ios "ios"))
|
||||||
|
|
@ -99,6 +99,6 @@
|
||||||
(progn
|
(progn
|
||||||
(require :ecl-curl)
|
(require :ecl-curl)
|
||||||
(ext:install-bytecodes-compiler)
|
(ext:install-bytecodes-compiler)
|
||||||
(compile-file (cc *current* "/lisp/curl.lisp")
|
(compile-file (cc *current* "lisp/curl.lisp")
|
||||||
:output-file (cc *current* "/lisp/" *assets* "curl.fasc")))
|
:output-file (cc *current* "lisp/" *assets* "curl.fasc")))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QQuickView>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
const char LQML::version[] = "22.3.3"; // Mar 2022
|
const char LQML::version[] = "22.3.3"; // Mar 2022
|
||||||
|
|
@ -49,6 +50,8 @@ LQML::LQML(int argc, char* argv[], QQuickView* view) : QObject() {
|
||||||
eval("(in-package :qml-user)");
|
eval("(in-package :qml-user)");
|
||||||
eval(QString("(setf qml:*quick-view* (qml:qt-object %1))")
|
eval(QString("(setf qml:*quick-view* (qml:qt-object %1))")
|
||||||
.arg(reinterpret_cast<quintptr>(view)));
|
.arg(reinterpret_cast<quintptr>(view)));
|
||||||
|
eval(QString("(setf qml:*engine* (qml:qt-object %1))")
|
||||||
|
.arg(reinterpret_cast<quintptr>(view->engine())));
|
||||||
}
|
}
|
||||||
|
|
||||||
LQML::~LQML() {
|
LQML::~LQML() {
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,27 @@ int main(int argc, char* argv[]) {
|
||||||
lqml.ignoreIOStreams();
|
lqml.ignoreIOStreams();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// load .eclrc
|
||||||
|
if (arguments.contains("-norc")) {
|
||||||
|
arguments.removeAll("-norc");
|
||||||
|
} else {
|
||||||
|
#if (defined Q_OS_ANDROID) || (defined Q_OS_IOS)
|
||||||
|
// mobile: don't hang on startup
|
||||||
|
LQML::eval("(x:when-it (probe-file \"~/.eclrc\")"
|
||||||
|
" (ignore-errors (load x:it)))");
|
||||||
|
#else
|
||||||
|
LQML::eval("(x:when-it (probe-file \"~/.eclrc\")"
|
||||||
|
" (load x:it))");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// load Lisp file
|
||||||
|
QStringList files = arguments.filter(".lisp");
|
||||||
|
if (!files.isEmpty()) {
|
||||||
|
QString file = QDir::fromNativeSeparators(files.first());
|
||||||
|
LQML::eval(QString("(load \"%1\")").arg(file), true);
|
||||||
|
}
|
||||||
|
|
||||||
new QQmlFileSelector(view.engine(), &view);
|
new QQmlFileSelector(view.engine(), &view);
|
||||||
QString qml("qml/main.qml");
|
QString qml("qml/main.qml");
|
||||||
QUrl url;
|
QUrl url;
|
||||||
|
|
@ -97,20 +118,6 @@ int main(int argc, char* argv[]) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// load .eclrc
|
|
||||||
if (arguments.contains("-norc")) {
|
|
||||||
arguments.removeAll("-norc");
|
|
||||||
} else {
|
|
||||||
#if (defined Q_OS_ANDROID) || (defined Q_OS_IOS)
|
|
||||||
// mobile: don't hang on startup
|
|
||||||
LQML::eval("(x:when-it (probe-file \"~/.eclrc\")"
|
|
||||||
" (ignore-errors (load x:it)))");
|
|
||||||
#else
|
|
||||||
LQML::eval("(x:when-it (probe-file \"~/.eclrc\")"
|
|
||||||
" (load x:it))");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef INI_ECL_CONTRIB
|
#ifdef INI_ECL_CONTRIB
|
||||||
// for iOS; ASDF is loaded on demand (slow)
|
// for iOS; ASDF is loaded on demand (slow)
|
||||||
ecl_init_module(NULL, init_lib_DEFLATE);
|
ecl_init_module(NULL, init_lib_DEFLATE);
|
||||||
|
|
@ -137,13 +144,6 @@ int main(int argc, char* argv[]) {
|
||||||
qtRestart = true;
|
qtRestart = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// load Lisp file
|
|
||||||
QStringList files = arguments.filter(".lisp");
|
|
||||||
if (!files.isEmpty()) {
|
|
||||||
QString file = QDir::fromNativeSeparators(files.first());
|
|
||||||
LQML::eval(QString("(load \"%1\")").arg(file), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qtRestart) {
|
if (qtRestart) {
|
||||||
LQML::eval("(qml::exec-with-qt-restart)", true);
|
LQML::eval("(qml::exec-with-qt-restart)", true);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,7 @@ class Engine : public QQmlEngine {
|
||||||
public:
|
public:
|
||||||
Engine(QObject* parent = nullptr) : QQmlEngine(parent) {}
|
Engine(QObject* parent = nullptr) : QQmlEngine(parent) {}
|
||||||
|
|
||||||
|
Q_PROPERTY (QUrl baseUrl READ baseUrl WRITE setBaseUrl)
|
||||||
|
|
||||||
Q_INVOKABLE void clearCache() { clearComponentCache(); }
|
Q_INVOKABLE void clearCache() { clearComponentCache(); }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
(:export
|
(:export
|
||||||
#:*break-on-errors*
|
#:*break-on-errors*
|
||||||
#:*quick-view*
|
#:*quick-view*
|
||||||
|
#:*engine*
|
||||||
#:*root-item*
|
#:*root-item*
|
||||||
#:*caller*
|
#:*caller*
|
||||||
#:define-qt-wrappers
|
#:define-qt-wrappers
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
(in-package :qml)
|
(in-package :qml)
|
||||||
|
|
||||||
(defvar *quick-view* nil) ; is set in 'lqml.cpp' on startup
|
(defvar *quick-view* nil) ; QQuickView - is set in 'lqml.cpp' on startup
|
||||||
|
(defvar *engine* nil) ; QQmlEngine - (see above)
|
||||||
(defvar *caller* nil)
|
(defvar *caller* nil)
|
||||||
(defvar *root-item* nil) ; see note in 'find-quick-item'
|
(defvar *root-item* nil) ; see note in 'find-quick-item'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue