add readme/screenshot for 'QML Live Preview and Slime'; revisions

This commit is contained in:
pls.153 2022-02-25 15:09:02 +01:00
parent d7a999acdb
commit be2b4520d1
17 changed files with 107 additions and 32 deletions

View file

@ -8,6 +8,7 @@
#include <QGuiApplication>
#include <QThread>
#include <QFile>
#include <QDir>
#include <QQuickItem>
#include <QQuickView>
#include <QQmlEngine>
@ -32,6 +33,7 @@ void iniCLFunctions() {
DEFUN ("%qapropos", qapropos2, 3)
DEFUN ("qchildren", qchildren, 1)
DEFUN ("qcopy-file", qcopy_file, 2)
DEFUN ("qdirectory", qdirectory, 1)
DEFUN ("qescape", qescape, 1)
DEFUN ("%qexec", qexec2, 1)
DEFUN ("qexit", qexit, 0)
@ -330,7 +332,6 @@ cl_object qexec2(cl_object l_milliseconds) {
LQML::eventLoop->exec();
return l_milliseconds;
}
QCoreApplication::exit(); // prevent "the event loop is already running"
QCoreApplication::exec();
return ECL_T;
}
@ -556,13 +557,32 @@ cl_object reload2() {
cl_object qcopy_file(cl_object l_from, cl_object l_to) {
/// args: (from to)
/// Convenience function for e.g. copying asset files on android, which can't
/// be accessed directly from Lisp.
/// Convenience function for android, for e.g. copying files from 'assets:/',
/// which can't be accessed directly from Lisp.
/// (qcopy-file "assets:/lib/asdf.fas" "asdf.fas")
bool ok = QFile::copy(toQString(l_from), toQString(l_to));
ecl_return1(ecl_process_env(), ok ? ECL_T : ECL_NIL);
}
cl_object qdirectory(cl_object l_dir) {
/// args: (path)
/// Convenience function for android, which works also with 'assets:/'
/// paths.
/// (qdirectory "assets:/lib")
QDir dir(toQString(l_dir));
QFileInfoList infos(dir.entryInfoList());
cl_object l_files = ECL_NIL;
for (QFileInfo info : qAsConst(infos)) {
QString path(info.absoluteFilePath());
if (info.isDir()) {
path.append("/");
}
l_files = CONS(from_qstring(path), l_files);
}
l_files = cl_nreverse(l_files);
ecl_return1(ecl_process_env(), l_files);
}
cl_object ensure_permissions2(cl_object l_permissions) {
/// args: (&rest permissions)
/// Android only; requests the passed permissions. Returns the list of

View file

@ -57,6 +57,7 @@ cl_object pixel_ratio ();
cl_object qapropos2 (cl_object, cl_object, cl_object);
cl_object qchildren (cl_object);
cl_object qcopy_file (cl_object, cl_object);
cl_object qdirectory (cl_object);
cl_object qescape (cl_object);
cl_object qexec2 (cl_object);
cl_object qexit ();

View file

@ -7,7 +7,7 @@
#include <QStringList>
#include <QDebug>
const char LQML::version[] = "22.2.1"; // Feb 2022
const char LQML::version[] = "22.2.2"; // Feb 2022
extern "C" void ini_LQML(cl_object);

View file

@ -77,7 +77,14 @@ int main(int argc, char* argv[]) {
arguments.removeAll("-norc");
}
else {
LQML::eval("(x:when-it (probe-file \"~/.eclrc\") (load x:it))");
#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_LISP
@ -99,6 +106,10 @@ int main(int argc, char* argv[]) {
}
}
#ifdef SWANK
slime = true;
#endif
if (slime) {
// fallback restart for conditions while processing the Qt event loop
LQML::eval("(loop (with-simple-restart (restart-qt-events \"Restart Qt event processing.\")"

View file

@ -260,7 +260,6 @@ cl_object from_qstring(const QString& s) {
cl_object from_qstringlist(const QStringList& l) {
cl_object l_list = ECL_NIL;
for (QString s : qAsConst(l)) {
l_list = CONS(from_qstring(s), l_list);
}