diff --git a/contact.scm b/contact.scm index d93f0de..c231c5a 100644 --- a/contact.scm +++ b/contact.scm @@ -14,16 +14,39 @@ ;; along with this program. If not, see . (import (chicken io) + (chicken repl) (chicken string) + (chicken time) + srfi-18 + nrepl qt-light) +(define qt-app #f) ;; The object. +(define qt-win #f) ;; The object. + + ;; Start & run the application. (define (init) - (let [(qt-app (qt:init)) - (qt-win (create-window))] - (init-window qt-win) - (qt:run))) + ;; Set up some global state, prepare the QT app. + (set! qt-app (qt:init)) + (set! qt-win (create-window)) + (init-window qt-win) + + (let ;; Start QT loop. + [(qt-thread (thread-start! qt-loop)) + ;; Kick off the remote-REPL… + (nrepl-thread (thread-start! (lambda () (nrepl 1234))))] + ;; … and also provide a local REPL. + (repl) + ;; Wait for the QT program, even after stdin is closed off. + (thread-join! qt-thread))) + + +;; Loop through QT’s processing, again and again. +(define (qt-loop) + (qt:run #t) + (qt-loop)) ;; Create the application window. @@ -52,7 +75,6 @@ (textbox-callbacks window)) - ;; Connect callback functions to menubar items. (define (menubar-callbacks window) (let* [(menu-file-exit (qt:find window "actionQuit"))