Use new qt:with-app.
Annotate for file src/i18n-hello-world.lisp
2009-04-14 tobias 1 ;;; Copyright 2009 Tobias Rautenkranz
14:29:22 ' 2 ;;; License: X11 license
' 3
2009-04-05 tobias 4 (in-package :qt.examples)
15:36:46 ' 5
' 6 (defun i18n-hello-world ()
' 7 "i18n hello world"
2009-07-01 tobias 8 (qt:with-app ()
11:01:24 ' 9 ;; ensures that the message catalogs are found regardless
' 10 ;; of the current directory.
' 11 (let ((source-path
' 12 #+mudballs (directory-namestring
' 13 (mb.sysdef:input-file
' 14 (mb.sysdef:find-component :qt.examples "src"
' 15 "i18n-hello-world")))
' 16 #-mudballs *default-pathname-defaults*))
' 17 (qt:with-translator ("hello-world"
' 18 *default-pathname-defaults*
' 19 source-path)
' 20 (let ((widget (make-instance 'qt:label)))
' 21 (setf (cxx:window-title widget) (qt:tr "Lisp Qt Example" "hello-world")
' 22 (cxx:text widget) (format nil (qt:tr "<h1>Hello world</h1>
2009-04-05 tobias 23
15:36:46 ' 24 You are running ~A version ~A on a ~A ~A")
2009-07-01 tobias 25 (lisp-implementation-type)
11:01:24 ' 26 (lisp-implementation-version)
' 27 (software-type)
' 28 (software-version)))
' 29 (cxx:show widget)
' 30 (qt:exec))))))
' 31
' 32 ;; FIXME:
' 33 ;; calling #'software-version from the qt:application event loop
' 34 ;; segfaults in SBCL. The first call caches the result in
' 35 ;; sb-sys::*software-version* and we thus prevent the crash in
' 36 ;; (run-program "/bin/uname" [...]).
' 37 #+sbcl
' 38 (eval-when (:load-toplevel)
' 39 (software-version))