Much work, using Qt 6.10 on Linux for better https support

This commit is contained in:
2026-03-11 17:57:55 +01:00
parent 989c3d328a
commit 7d234bc834
16 changed files with 541 additions and 217 deletions

View File

@@ -11,13 +11,17 @@
example-1-window%
)
(define ww-debug displayln)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Example 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-runtime-path html-start "example-1.html")
(define-runtime-path dialog-html "example-1-dialog.html")
(define-runtime-path cur-dir ".")
#|
(define test-menu (menu 'main-menu
(menu-item 'm-file "File"
#:submenu
@@ -46,33 +50,34 @@
)
)
))
|#
(define example-1-dialog%
(class ww-webview-dialog%
(class wv-dialog%
(inherit-field settings)
(super-new [html-file dialog-html]
[width 400]
[height 300])
(super-new [window-context 'example-1-dialog]
[file-not-found-handler (root-file-not-found-handler "example-1-dialog.html")]
)
(define/override (html-loaded)
(super html-loaded)
(define/override (page-loaded oke)
(super page-loaded oke)
(ww-debug "html-loaded for example-1-dialog%")
(let* ((btn (send this element 'ok-btn)))
(send btn connect 'click (λ (data)
(send this close))))
;(ww-debug "html-loaded for example-1-dialog%")
(send this bind! 'ok-btn 'click (λ (el evt data)
(send this close)))
(let* ((inp1 (send this element 'inp1))
(inp2 (send this element 'inp2))
(inp3 (send this element 'inp3)))
(let* ((inp1 (send this element 'inp1 'text))
(inp2 (send this element 'inp2 'text))
(inp3 (send this element 'inp3 'text)))
(send inp1 set! (send settings get 'inp1 "<input 1 not set yet>"))
(send inp2 set! (send settings get 'inp2 "<input 2 not set yet>"))
(send inp3 set! (send settings get 'inp3 "<input 3 not set yet>"))
(send inp1 on-change!
(λ (val)
(send settings set! 'inp1 val)))
(send inp2 on-change! (λ (val) (send settings set! 'inp2 val)))
(send inp3 on-change! (λ (val) (send settings set! 'inp3 val)))
(send this bind! 'inp1 'change (λ (el evt data)
(displayln (format "~a ~a ~a" el evt data))
(displayln (format "get = ~a" (send el get)))
(send settings set! 'inp1 (send el get))))
(send this bind! 'inp2 'change (λ (el evt data) (send settings set! 'inp2 (send el get))))
(send this bind! 'inp3 'change (λ (el evt data) (send settings set! 'inp3 (send el get))))
)
)
)
@@ -86,10 +91,11 @@
var))))
(define example-1-window%
(class ww-webview%
(class wv-window%
(inherit-field settings)
(super-new [html-file html-start]
(inherit-field settings app-context)
(super-new [file-not-found-handler (root-file-not-found-handler "example-1.html")]
[window-context 'example-1-main]
)
(define go-on-counter #f)
@@ -97,14 +103,21 @@
(define counter-inc 1)
(define counter-thread #f)
(define div-counter #f)
(define my-dir (send settings get 'folder "."))
(define my-dir (send settings get/global 'folder "."))
(define/override (can-close?)
(eq? counter-thread #f))
(define/public (reset-counter)
(define start-stop-btn #f)
(define/public (stop-counter)
(send start-stop-btn set-innerHTML! "Start Counter")
(set! go-on-counter #f)
)
(define/public (reset-counter)
(stop-counter)
(set! counter-thread #f)
)
@@ -117,25 +130,26 @@
(send this update-counter))
(define/public (update-counter)
(send div-counter set-inner-html! (format "Count = ~a" c-counter))
(send div-counter set-innerHTML! (format "Count = ~a" c-counter))
(when (and (> c-counter 0) (<= c-counter 100))
(send div-counter set-style!
(css-style '((background white)))))
'((background white))))
(when (and (> c-counter 100) (<= c-counter 200))
(send div-counter set-style!
(css-style '((background green) (color white)))))
'((background green) (color white))))
(when (and (> c-counter 200) (<= c-counter 300))
(send div-counter set-style!
(css-style '((background yellow) (font-size: 120%)))))
'((background yellow) (color black) (font-size: 120%))))
(when (and (> c-counter 300) (<= c-counter 400))
(send div-counter set-style!
(css-style '((color white) (background orange) (font-size 110%)))))
'((color white) (background orange) (font-size 110%))))
(when (and (> c-counter 400))
(send div-counter set-style!
(css-style '((color white) (background red) (font-size 120%) (font-weight bold)))))
'((color white) (background red) (font-size 120%) (font-weight bold))))
)
(define/public (start-counter)
(send start-stop-btn set-innerHTML! "Stop Counter")
(set! counter-thread
(thread
(λ ()
@@ -150,65 +164,68 @@
(define/public (set-folder new-dir)
(set! my-dir new-dir)
(send settings set 'folder new-dir)
(send settings set/global! 'folder new-dir)
(let ((el (send this element 'folder)))
(send el set-inner-html! (format "Selected folder: <b>~a</b>" my-dir))
(send el set-innerHTML! (format "Selected folder: <b>~a</b>" my-dir))
)
)
(define/override (choose-dir)
(let ((handle (super choose-dir "Select a folder" my-dir)))
(displayln (format "choosen dir handle: ~a" handle))
(let ((result (super choose-dir "Select a folder" my-dir)))
(displayln (format "choosen dir handle: ~a" result))
(unless (eq? result 'canceled)
(send this set-folder result))
)
)
(define/override (dir-choosen handle choosen dir)
(displayln (format "dir-choosen: ~a ~a ~a" handle choosen dir))
(when choosen
(send this set-folder dir)))
(define/public (prefs)
(new example-1-dialog% [parent this] [settings (send this clone-settings 'example-1-dialog)]))
(stop-counter)
(set! go-on-counter #f)
(new example-1-dialog%
[parent this]
)
) ; (send this clone-settings 'example-1-dialog)]))
(define/override (handle-navigate url type kind)
(send this reset-counter)
(super handle-navigate url type kind))
;(define/override (handle-navigate url type kind)
; (send this reset-counter)
; (super handle-navigate url type kind))
(define/override (html-loaded)
(define/override (page-loaded oke)
(ww-debug "HTML LOADED")
(super html-loaded)
(super page-loaded oke)
(set! div-counter (send this element 'div-counter))
(send this update-counter)
(send this set-folder my-dir)
(ww-debug "CONNECTING BUTTONS")
(let* ((dialog-btn (send this element 'dialog-button))
(start-stop-btn (send this element 'start-stop-button))
(choose-dir-btn (send this element 'select-dir-button))
)
(send dialog-btn connect 'click
(λ (data) (send this prefs)))
(send start-stop-btn connect 'click
(λ (data)
(if (eq? counter-thread #f)
(begin
(send this start-counter)
(send start-stop-btn set-inner-html! "Stop Counter"))
(begin
(send this reset-counter)
(send start-stop-btn set-inner-html! "Start Counter"))
(send this bind! 'dialog-button 'click (λ (el evt data)
(send this prefs)))
(set! start-stop-btn (send this element 'start-stop-button))
(send this bind! 'start-stop-button 'click
(λ (el evt data)
(if (eq? counter-thread #f)
(begin
(send this start-counter)
)
)
(begin
(send this reset-counter)
)
)
)
(send choose-dir-btn connect 'click
(λ (data)
(send this choose-dir)))
)
)
(send this bind! 'devtools 'click
(λ (el evt data) (send this devtools)))
(send this bind! 'select-dir-button 'click
(λ (el evt data)
(send this choose-dir)))
(ww-debug "SETTING MENU")
(let* ((div-open (send this element 'div-open))
;(ww-debug "SETTING MENU")
#|(let* ((div-open (send this element 'div-open))
(c-open 0)
(div-close (send this element 'div-close))
(c-close 0)
@@ -250,7 +267,7 @@
(λ () (send this choose-dir)))
)
)
)|#
)
(begin
@@ -261,7 +278,9 @@
(define (run-example)
(let* ((ini (new ini% [file 'web-racket-example1]))
(settings (new ww-simple-ini% [ini ini] [section 'example-1-window]))
(window (new example-1-window% [settings settings]))
(window (new example-1-window%
[app-context 'example-1]
[ini ini]
[base-dir cur-dir]))
)
window))