2024-02-04 20:42:34 -06:00
|
|
|
|
;; Copyright © 2023, Jaidyn Ann <jadedctrl@posteo.at>
|
|
|
|
|
;;
|
|
|
|
|
;; This program is free software: you can redistribute it and/or
|
|
|
|
|
;; modify it under the terms of the GNU General Public License as
|
|
|
|
|
;; published by the Free Software Foundation, either version 3 of
|
|
|
|
|
;; the License, or (at your option) any later version.
|
|
|
|
|
;;
|
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
;;
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
(import (chicken io)
|
|
|
|
|
qt-light)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Start & run the application.
|
|
|
|
|
(define (init)
|
|
|
|
|
(let ([qt-app (qt:init)]
|
|
|
|
|
[qt-win (create-window)])
|
|
|
|
|
(init-window qt-win)
|
|
|
|
|
(qt:run)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Create the application window.
|
|
|
|
|
(define (create-window)
|
|
|
|
|
(qt:widget (window-contents)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Return the UI’s XML, read from “contacts.ui”.
|
|
|
|
|
;; We could generate this XML ourselves, and write a nice s-expr front-end,
|
|
|
|
|
;; maybe… `o`
|
|
|
|
|
(define (window-contents)
|
|
|
|
|
(call-with-input-file
|
|
|
|
|
"contact.ui"
|
|
|
|
|
(lambda (in-port) (read-string #f in-port))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Initialize the window.
|
|
|
|
|
(define (init-window window)
|
2024-02-04 20:54:58 -06:00
|
|
|
|
(window-callbacks window)
|
2024-02-04 20:42:34 -06:00
|
|
|
|
(qt:show window))
|
|
|
|
|
|
|
|
|
|
|
2024-02-04 20:54:58 -06:00
|
|
|
|
;; Connect callback functions to widgets’ signals.
|
|
|
|
|
(define (window-callbacks window)
|
|
|
|
|
(let ([file→exit (qt:find window "actionQuit")])
|
|
|
|
|
(if file→exit
|
|
|
|
|
(qt:connect
|
|
|
|
|
file→exit "triggered()"
|
|
|
|
|
(qt:receiver exit)))))
|
|
|
|
|
|
|
|
|
|
|
2024-02-04 20:42:34 -06:00
|
|
|
|
(init)
|