Add the option to specify main qml url as last command-line parameter

This commit is contained in:
Renaud Casenave-Péré 2021-12-10 21:53:51 +01:00
parent 5937fc848f
commit e1c848b560
2 changed files with 7 additions and 14 deletions

View file

@ -1,9 +1,6 @@
(defpackage :app
(:use :cl :eql)
(:export #:start-slynk
#:stop-slynk
#:start
#:reload-qml))
(:export #:start))
(in-package :app)
(qrequire :quick)
@ -33,15 +30,6 @@
(#.|QQuickView.Ready|
(qml-reloaded))))))
(defun reload-qml (&optional (url "http://localhost:8000/"))
"Reload QML file from an url, directly on the device."
(qrun*
(let ((src (|toString| (|source| qml:*quick-view*))))
(if (x:starts-with (concatenate 'string "file://" qml:*root*) src)
(|setSource| qml:*quick-view* (qnew "QUrl(QString)" (x:string-substitute url (concatenate 'string "file://" qml:*root*) src)))
(qml:reload))
(|toString| (|source| qml:*quick-view*)))))
(defun qml-reloaded ()
;; re-ini
)

View file

@ -32,7 +32,12 @@ int main(int argc, char *argv[])
EQL eql;
eql.exec (init_app);
eql_fun ("qml:ini-sailfish", Q_ARG (QUrl, SailfishApp::pathToMainQml ()),
QUrl url = SailfishApp::pathToMainQml();
if (argc > 1)
url = argv[argc - 1];
eql_fun ("qml:ini-sailfish", Q_ARG (QUrl, url),
Q_ARG (QUrl, SailfishApp::pathTo ("")),
Q_ARG (QQuickView*, view.data ()), Q_ARG(bool, true));
}