Mere formatting tweaks

This commit is contained in:
Jaidyn Ann 2024-02-05 15:50:59 -06:00
parent 65e48e7f2d
commit 508a86325e

View File

@ -1,4 +1,4 @@
;; Copyright © 2023, Jaidyn Ann <jadedctrl@posteo.at> ;; Copyright © 2024 Jaidyn Ann <jadedctrl@posteo.at>
;; ;;
;; This program is free software: you can redistribute it and/or ;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as ;; modify it under the terms of the GNU General Public License as
@ -20,8 +20,8 @@
;; Start & run the application. ;; Start & run the application.
(define (init) (define (init)
(let ([qt-app (qt:init)] (let [(qt-app (qt:init))
[qt-win (create-window)]) (qt-win (create-window))]
(init-window qt-win) (init-window qt-win)
(qt:run))) (qt:run)))
@ -55,32 +55,32 @@
;; Connect callback functions to menubar items. ;; Connect callback functions to menubar items.
(define (menubar-callbacks window) (define (menubar-callbacks window)
(let* ([fileexit (qt:find window "actionQuit")] (let* [(menu-file-exit (qt:find window "actionQuit"))
[filesave (qt:find window "actionSave")]) (menu-file-save (qt:find window "actionSave"))]
;; We connect to https://doc.qt.io/qt-6/qaction.html#triggered ;; We connect to https://doc.qt.io/qt-6/qaction.html#triggered
(if fileexit (if menu-file-exit
(qt:connect (qt:connect
fileexit "triggered()" menu-file-exit "triggered()"
(qt:receiver exit))) (qt:receiver exit)))
(if filesave (if menu-file-save
(qt:connect (qt:connect
filesave "triggered()" menu-file-save "triggered()"
(qt:receiver (qt:receiver
(lambda () (lambda ()
(qt:message "Saving is not implemented." "Saving"))))))) (qt:message "Saving is not implemented.")))))))
;; Connect a text-printing callback to each textbox. ;; Connect a text-printing callback to each textbox.
(define (textbox-callbacks window) (define (textbox-callbacks window)
(let* ([property-names (let* [(property-names
'("address" "city" "company" "county" "eMail" "fax" '("address" "city" "company" "country" "eMail" "fax"
"homePhone" "name" "nickname" "state" "url" "homePhone" "name" "nickname" "state" "url"
"workPhone" "zip")] "workPhone" "zip"))
[textboxes (textboxes
;; The texbox widgets are all named like “countryLineEdit”. ;; The texbox widgets are all named like “countryLineEdit”.
(map (lambda (property) (map (lambda (property)
(qt:find window (conc property "LineEdit"))) (qt:find window (conc property "LineEdit")))
property-names)]) property-names))]
;; Cycle through each textbox, connecting them to a callback that prints ;; Cycle through each textbox, connecting them to a callback that prints
;; their contents each time you type in text. ;; their contents each time you type in text.
(map (lambda (textbox) (map (lambda (textbox)
@ -92,9 +92,9 @@
(qt:connect textbox "textChanged(QString)" (qt:connect textbox "textChanged(QString)"
(qt:receiver (qt:receiver
(lambda () (lambda ()
(let ([filesave (qt:find window "actionSave")]) (let [(menu-file-save (qt:find window "actionSave"))]
(if filesave (if menu-file-save
(set! (qt:property filesave "enabled") #t))) (set! (qt:property menu-file-save "enabled") #t)))
(print (qt:property textbox "text"))))))) (print (qt:property textbox "text")))))))
textboxes))) textboxes)))