mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-06 02:30:38 -08:00
example 'advanced-qml-auto-reload': show message if 'web-server.sh' is not running
This commit is contained in:
parent
1959fb3bd9
commit
7e49027c57
9 changed files with 126 additions and 4 deletions
|
|
@ -1,5 +1,9 @@
|
||||||
(in-package :app)
|
(in-package :app)
|
||||||
|
|
||||||
#+(or android ios)
|
#+mobile
|
||||||
(when qml::*remote-ip*
|
(qsingle-shot 1000 (lambda ()
|
||||||
(qsingle-shot 1000 'auto-reload-qml))
|
(when qml::*remote-ip*
|
||||||
|
(qjs |message| ui:*dialogs*
|
||||||
|
(format nil "<qt>QML auto reload enabled from: <br><br>~A<br><br>Ensure <b>web-server.sh</b> is running.</qt>"
|
||||||
|
qml::*remote-ip*))
|
||||||
|
(auto-reload-qml))))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
(defpackage ui
|
(defpackage ui
|
||||||
(:use :cl :qml)
|
(:use :cl :qml)
|
||||||
(:export
|
(:export
|
||||||
|
#:*dialogs*
|
||||||
#:*flick-output*
|
#:*flick-output*
|
||||||
#:*history-back*
|
#:*history-back*
|
||||||
#:*history-forward*
|
#:*history-forward*
|
||||||
|
|
@ -12,6 +13,7 @@
|
||||||
|
|
||||||
(in-package :ui)
|
(in-package :ui)
|
||||||
|
|
||||||
|
(defparameter *dialogs* "dialogs")
|
||||||
(defparameter *flick-output* "flick_output")
|
(defparameter *flick-output* "flick_output")
|
||||||
(defparameter *history-back* "history_back")
|
(defparameter *history-back* "history_back")
|
||||||
(defparameter *history-forward* "history_forward")
|
(defparameter *history-forward* "history_forward")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Dialogs 1.3
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
title: "LQML"
|
||||||
|
standardButtons: Dialog.Save | Dialog.Cancel
|
||||||
|
|
||||||
|
property alias text: message.text
|
||||||
|
property string callback
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: message
|
||||||
|
width: parent.width // without width word wrap won't work
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
|
||||||
|
onAccepted: Lisp.call(callback, true)
|
||||||
|
onRejected: Lisp.call(callback, false)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
title: "Confirm"
|
||||||
|
font.pixelSize: 18
|
||||||
|
modal: true
|
||||||
|
standardButtons: Dialog.Save | Dialog.Cancel
|
||||||
|
|
||||||
|
property alias text: message.text
|
||||||
|
property string callback
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: message
|
||||||
|
width: parent.width // without width word wrap won't work
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
font.pixelSize: 18
|
||||||
|
}
|
||||||
|
|
||||||
|
onAccepted: Lisp.call(callback, true)
|
||||||
|
onRejected: Lisp.call(callback, false)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
import QtQuick 2.15
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: dialogs
|
||||||
|
objectName: "dialogs"
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: loader
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
function message(text) {
|
||||||
|
if ((Qt.platform.os === "android") ||
|
||||||
|
(Qt.platform.os === "ios")) {
|
||||||
|
loader.source = "MessageMobile.qml"
|
||||||
|
} else {
|
||||||
|
loader.source = "Message.qml"
|
||||||
|
}
|
||||||
|
loader.item.text = text
|
||||||
|
loader.item.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirm(title, text, callback) {
|
||||||
|
if ((Qt.platform.os === "android") ||
|
||||||
|
(Qt.platform.os === "ios")) {
|
||||||
|
loader.source = "ConfirmMobile.qml"
|
||||||
|
} else {
|
||||||
|
loader.source = "Confirm.qml"
|
||||||
|
}
|
||||||
|
loader.item.title = title
|
||||||
|
loader.item.text = text
|
||||||
|
loader.item.callback = callback
|
||||||
|
loader.item.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Dialogs 1.3
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
title: "Info"
|
||||||
|
standardButtons: Dialog.Ok
|
||||||
|
|
||||||
|
property alias text: message.text
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: message
|
||||||
|
width: parent.width // without width word wrap won't work
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
title: "Info"
|
||||||
|
font.pixelSize: 18
|
||||||
|
modal: true
|
||||||
|
standardButtons: Dialog.Ok
|
||||||
|
|
||||||
|
property alias text: message.text
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: message
|
||||||
|
width: parent.width // without width word wrap won't work
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
font.pixelSize: 18
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,8 +2,10 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import ".ext/" as Ext // for single file auto reload (development)
|
import ".ext/" as Ext // for single file auto reload (development)
|
||||||
//import "ext/" as Ext // release version
|
//import "ext/" as Ext // release version
|
||||||
|
import 'ext/dialogs' as Dlg
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
id: main
|
||||||
width: 300
|
width: 300
|
||||||
height: 500
|
height: 500
|
||||||
objectName: "main"
|
objectName: "main"
|
||||||
|
|
@ -44,4 +46,6 @@ Rectangle {
|
||||||
FontLoader { id: fontIcons; source: "fonts/fontawesome-webfont.ttf" }
|
FontLoader { id: fontIcons; source: "fonts/fontawesome-webfont.ttf" }
|
||||||
FontLoader { id: fontHack; source: "fonts/Hack-Regular.ttf" }
|
FontLoader { id: fontHack; source: "fonts/Hack-Regular.ttf" }
|
||||||
FontLoader { id: fontHackBold; source: "fonts/Hack-Bold.ttf" }
|
FontLoader { id: fontHackBold; source: "fonts/Hack-Bold.ttf" }
|
||||||
|
|
||||||
|
Dlg.Dialogs {} // modal dialogs
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ext.ScaleAnimator {
|
Ext.ScaleAnimator {
|
||||||
objectName: "zoom_board_in"
|
objectName: "zoom_board_in"
|
||||||
target: board
|
target: board
|
||||||
from: 0.0
|
from: 0.0
|
||||||
to: 1.0
|
to: 1.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue