mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-05 18:20:33 -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*)))
|
||||
(subseq name
|
||||
(length (namestring *default-pathname-defaults*))
|
||||
(position #\/ name :from-end t))))
|
||||
(1+ (position #\/ name :from-end t)))))
|
||||
|
||||
;; load all LQML symbols
|
||||
(dolist (file (list "package" "x" "ecl-ext" "ini" "qml"))
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
(asdf:make-build "app"
|
||||
:monolithic t
|
||||
:type :static-library
|
||||
:move-here (cc *current* "/build/tmp/")
|
||||
:move-here (cc *current* "build/tmp/")
|
||||
: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* (cc *current* "/build/tmp/" to)))
|
||||
(to* (cc *current* "build/tmp/" to)))
|
||||
(when (probe-file to*)
|
||||
(delete-file to*))
|
||||
(rename-file from to)))
|
||||
|
|
@ -43,9 +43,9 @@
|
|||
#+(or android ios)
|
||||
(progn
|
||||
(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 *library-name* (format nil "~A/build-~A/tmp/app"
|
||||
(defvar *library-name* (format nil "~Abuild-~A/tmp/app"
|
||||
*current*
|
||||
#+android "android"
|
||||
#+ios "ios"))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
(in-package :app)
|
||||
|
||||
#+(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)
|
||||
|
||||
#+(or android ios)
|
||||
(defvar *remote-ip* #-interpreter
|
||||
(format nil "http://~A:8080/"
|
||||
#.(progn
|
||||
(terpri *query-io*)
|
||||
(princ "Please enter WiFi IP of desktop computer: " *query-io*)
|
||||
(read-line *query-io*))))
|
||||
(defun remote-ip ()
|
||||
(terpri *query-io*)
|
||||
(princ "Please enter WiFi IP of desktop computer (hit RET to skip): "
|
||||
*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)
|
||||
(defun qml:view-status-changed (status)
|
||||
|
|
@ -35,7 +40,9 @@
|
|||
(if ini
|
||||
(progn
|
||||
(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)))
|
||||
(setf secs curr)))
|
||||
(qsingle-shot 250 'auto-reload-qml)))
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
(let ((name (namestring *load-truename*)))
|
||||
(subseq name
|
||||
(length (namestring *default-pathname-defaults*))
|
||||
(position #\/ name :from-end t))))
|
||||
(1+ (position #\/ name :from-end t)))))
|
||||
|
||||
;; load all LQML symbols
|
||||
(dolist (file (list "package" "x" "ecl-ext" "ini" "qml"))
|
||||
|
|
@ -71,11 +71,11 @@
|
|||
(asdf:make-build "app"
|
||||
:monolithic t
|
||||
:type :static-library
|
||||
:move-here (cc *current* "/build/tmp/")
|
||||
:move-here (cc *current* "build/tmp/")
|
||||
: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* (cc *current* "/build/tmp/" to)))
|
||||
(to* (cc *current* "build/tmp/" to)))
|
||||
(when (probe-file to*)
|
||||
(delete-file to*))
|
||||
(rename-file from to)))
|
||||
|
|
@ -84,9 +84,9 @@
|
|||
(progn
|
||||
(pushnew :interpreter *features*)
|
||||
(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 *library-name* (format nil "~A/build-~A/tmp/app"
|
||||
(defvar *library-name* (format nil "~Abuild-~A/tmp/app"
|
||||
*current*
|
||||
#+android "android"
|
||||
#+ios "ios"))
|
||||
|
|
@ -99,6 +99,6 @@
|
|||
(progn
|
||||
(require :ecl-curl)
|
||||
(ext:install-bytecodes-compiler)
|
||||
(compile-file (cc *current* "/lisp/curl.lisp")
|
||||
:output-file (cc *current* "/lisp/" *assets* "curl.fasc")))
|
||||
(compile-file (cc *current* "lisp/curl.lisp")
|
||||
:output-file (cc *current* "lisp/" *assets* "curl.fasc")))
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QTimer>
|
||||
#include <QStringList>
|
||||
#include <QQuickView>
|
||||
#include <QDebug>
|
||||
|
||||
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(QString("(setf qml:*quick-view* (qml:qt-object %1))")
|
||||
.arg(reinterpret_cast<quintptr>(view)));
|
||||
eval(QString("(setf qml:*engine* (qml:qt-object %1))")
|
||||
.arg(reinterpret_cast<quintptr>(view->engine())));
|
||||
}
|
||||
|
||||
LQML::~LQML() {
|
||||
|
|
|
|||
|
|
@ -79,6 +79,27 @@ int main(int argc, char* argv[]) {
|
|||
lqml.ignoreIOStreams();
|
||||
#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);
|
||||
QString qml("qml/main.qml");
|
||||
QUrl url;
|
||||
|
|
@ -97,20 +118,6 @@ int main(int argc, char* argv[]) {
|
|||
#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
|
||||
// for iOS; ASDF is loaded on demand (slow)
|
||||
ecl_init_module(NULL, init_lib_DEFLATE);
|
||||
|
|
@ -137,13 +144,6 @@ int main(int argc, char* argv[]) {
|
|||
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) {
|
||||
LQML::eval("(qml::exec-with-qt-restart)", true);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -7,5 +7,7 @@ class Engine : public QQmlEngine {
|
|||
public:
|
||||
Engine(QObject* parent = nullptr) : QQmlEngine(parent) {}
|
||||
|
||||
Q_PROPERTY (QUrl baseUrl READ baseUrl WRITE setBaseUrl)
|
||||
|
||||
Q_INVOKABLE void clearCache() { clearComponentCache(); }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
(:export
|
||||
#:*break-on-errors*
|
||||
#:*quick-view*
|
||||
#:*engine*
|
||||
#:*root-item*
|
||||
#:*caller*
|
||||
#:define-qt-wrappers
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
(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 *root-item* nil) ; see note in 'find-quick-item'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue