Wed Jul 1 13:01:24 CEST 2009 Tobias Rautenkranz * Use new qt:with-app. diff -rN -u old-qt.examples/src/class-browser.lisp new-qt.examples/src/class-browser.lisp --- old-qt.examples/src/class-browser.lisp 2014-09-30 23:43:41.000000000 +0200 +++ new-qt.examples/src/class-browser.lisp 2014-09-30 23:43:41.000000000 +0200 @@ -81,8 +81,8 @@ (defun set-info (info web-view model-index) (let* ((class (class-at model-index))) (cxx:load web-view (format nil "http://doc.trolltech.com/~A/~A.html" - (subseq (qt:q-version) 0 3) - (remove #\: (smoke:name class) :count 1))) + (subseq (qt:q-version) 0 3) + (remove #\: (smoke:name class) :count 1))) (cxx:set-text info (format nil "

qt:~A

~A

@@ -104,7 +104,7 @@ (defun class-browser () "Qt Class Browser" - (qt:with-app - (let ((browser (make-instance 'class-browser))) - (cxx:show browser) - (qt:exec)))) + (qt:with-app () + (let ((browser (make-instance 'class-browser))) + (cxx:show browser) + (qt:exec)))) diff -rN -u old-qt.examples/src/hello-world-quit.lisp new-qt.examples/src/hello-world-quit.lisp --- old-qt.examples/src/hello-world-quit.lisp 2014-09-30 23:43:41.000000000 +0200 +++ new-qt.examples/src/hello-world-quit.lisp 2014-09-30 23:43:41.000000000 +0200 @@ -4,8 +4,8 @@ (in-package :qt.examples) (defun hello-world-quit () - "Quit on push-button click" - (qt:with-app + "Quit on push-button click." + (qt:with-app () (let ((quit (make-instance 'qt:push-button :args '("Quit"))) (font (make-instance 'qt:font :args (list "Times" 18 @@ -16,8 +16,8 @@ (qt:connect (qt:get-signal quit "pressed()") #'(lambda () (format t "About to quit()~%"))) - + (qt:connect (qt:get-signal quit "clicked()") (qt:get-slot (qt:app) "quit()")) (cxx:show quit) - (qt:exec quit)))) + (qt:exec)))) diff -rN -u old-qt.examples/src/hello-world.lisp new-qt.examples/src/hello-world.lisp --- old-qt.examples/src/hello-world.lisp 2014-09-30 23:43:41.000000000 +0200 +++ new-qt.examples/src/hello-world.lisp 2014-09-30 23:43:41.000000000 +0200 @@ -5,7 +5,7 @@ (defun hello-world () "Hello world" - (qt:with-app + (qt:with-app () (let ((widget (make-instance 'qt:push-button :args '("Hello world")))) (cxx:show widget) - (qt:exec widget)))) + (qt:exec)))) diff -rN -u old-qt.examples/src/hello-world_de.po new-qt.examples/src/hello-world_de.po --- old-qt.examples/src/hello-world_de.po 2014-09-30 23:43:41.000000000 +0200 +++ new-qt.examples/src/hello-world_de.po 2014-09-30 23:43:41.000000000 +0200 @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: hello-world\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-05-30 16:10+0200\n" +"POT-Creation-Date: 2009-07-01 01:17+0200\n" "PO-Revision-Date: 2009-03-21 11:41+0100\n" "Last-Translator: Tobias Rautenkranz \n" "Language-Team: German <>\n" diff -rN -u old-qt.examples/src/i18n-hello-world.lisp new-qt.examples/src/i18n-hello-world.lisp --- old-qt.examples/src/i18n-hello-world.lisp 2014-09-30 23:43:41.000000000 +0200 +++ new-qt.examples/src/i18n-hello-world.lisp 2014-09-30 23:43:41.000000000 +0200 @@ -5,26 +5,35 @@ (defun i18n-hello-world () "i18n hello world" - (qt:with-app - ;; ensures that the message catalogs are found regardless - ;; of the current directory. - (let ((source-path - #+mudballs (directory-namestring - (mb.sysdef:input-file - (mb.sysdef:find-component :qt.examples "src" - "i18n-hello-world"))) - #-mudballs *default-pathname-defaults*)) - (qt:with-translator ("hello-world" - *default-pathname-defaults* - source-path) - (let ((widget (make-instance 'qt:label))) - (setf (cxx:window-title widget) (qt:tr "Lisp Qt Example" "hello-world") - (cxx:text widget) (format nil (qt:tr "

Hello world

+ (qt:with-app () + ;; ensures that the message catalogs are found regardless + ;; of the current directory. + (let ((source-path + #+mudballs (directory-namestring + (mb.sysdef:input-file + (mb.sysdef:find-component :qt.examples "src" + "i18n-hello-world"))) + #-mudballs *default-pathname-defaults*)) + (qt:with-translator ("hello-world" + *default-pathname-defaults* + source-path) + (let ((widget (make-instance 'qt:label))) + (setf (cxx:window-title widget) (qt:tr "Lisp Qt Example" "hello-world") + (cxx:text widget) (format nil (qt:tr "

Hello world

You are running ~A version ~A on a ~A ~A") - (lisp-implementation-type) - (lisp-implementation-version) - (software-type) - (software-version))) - (cxx:show widget) - (qt:exec widget)))))) + (lisp-implementation-type) + (lisp-implementation-version) + (software-type) + (software-version))) + (cxx:show widget) + (qt:exec)))))) + +;; FIXME: +;; calling #'software-version from the qt:application event loop +;; segfaults in SBCL. The first call caches the result in +;; sb-sys::*software-version* and we thus prevent the crash in +;; (run-program "/bin/uname" [...]). +#+sbcl +(eval-when (:load-toplevel) + (software-version)) diff -rN -u old-qt.examples/src/launcher.lisp new-qt.examples/src/launcher.lisp --- old-qt.examples/src/launcher.lisp 2014-09-30 23:43:41.000000000 +0200 +++ new-qt.examples/src/launcher.lisp 2014-09-30 23:43:41.000000000 +0200 @@ -26,7 +26,7 @@ (defun launcher () "Launch the Qt examples" - (qt:with-app + (qt:with-app () (let ((launcher (make-instance 'launcher))) (cxx:show launcher) - (qt:exec launcher)))) + (qt:exec)))) diff -rN -u old-qt.examples/src/repl.lisp new-qt.examples/src/repl.lisp --- old-qt.examples/src/repl.lisp 2014-09-30 23:43:41.000000000 +0200 +++ new-qt.examples/src/repl.lisp 2014-09-30 23:43:41.000000000 +0200 @@ -8,7 +8,7 @@ :initform (make-instance 'qt:string-list-model)) (output :reader output :initform (make-instance 'qt:list-view)) - (input :reader input + (input :reader input :initform (make-instance 'qt:line-edit))) (:metaclass cxx:class)) @@ -43,7 +43,7 @@ (defun repl () "Lisp REPL" - (qt:with-app + (qt:with-app () (let ((repl (make-instance 'repl))) (cxx:show repl) - (qt:exec repl)))) + (qt:exec)))) diff -rN -u old-qt.examples/src/tick-tack-toe.lisp new-qt.examples/src/tick-tack-toe.lisp --- old-qt.examples/src/tick-tack-toe.lisp 2014-09-30 23:43:41.000000000 +0200 +++ new-qt.examples/src/tick-tack-toe.lisp 2014-09-30 23:43:41.000000000 +0200 @@ -215,7 +215,7 @@ (defun tick-tack-toe () "Tick Tack Toe" - (qt:with-app + (qt:with-app () (let ((widget (make-instance 'tick-tack-toe))) (cxx:show widget) - (qt:exec widget)))) + (qt:exec)))) diff -rN -u old-qt.examples/src/ui.lisp new-qt.examples/src/ui.lisp --- old-qt.examples/src/ui.lisp 2014-09-30 23:43:41.000000000 +0200 +++ new-qt.examples/src/ui.lisp 2014-09-30 23:43:41.000000000 +0200 @@ -5,24 +5,24 @@ (defun load-ui-file () "Load a Qt Designer .ui file" - (qt:with-app - (let ((loader (make-instance 'qt:ui-loader)) - (file (make-instance 'qt:file)) - (widget)) - (setf (cxx:file-name file) - (namestring - (qt:search-file "widget.ui" - *default-pathname-defaults* - #+mudballs (directory-namestring - (mb.sysdef:input-file - (mb.sysdef:find-component :qt.examples "src" "ui")))))) - (assert (cxx:exists file) (file) - "File ~A does not exists" (cxx:file-name file)) - (unless (cxx:open file qt:iodevice.+read-only+) - (error "open failed")) - (setf widget (cxx:load loader file)) - (when (cffi:null-pointer-p (smoke:pointer widget)) - (error "load failed")) - (cxx:close file) - (cxx:show widget) - (qt:exec)))) + (qt:with-app () + (let ((loader (make-instance 'qt:ui-loader)) + (file (make-instance 'qt:file)) + (widget)) + (setf (cxx:file-name file) + (namestring + (qt:search-file "widget.ui" + *default-pathname-defaults* + #+mudballs (directory-namestring + (mb.sysdef:input-file + (mb.sysdef:find-component :qt.examples "src" "ui")))))) + (assert (cxx:exists file) (file) + "File ~A does not exists" (cxx:file-name file)) + (unless (cxx:open file qt:iodevice.+read-only+) + (error "open failed")) + (setf widget (cxx:load loader file)) + (when (cffi:null-pointer-p (smoke:pointer widget)) + (error "load failed")) + (cxx:close file) + (cxx:show widget) + (qt:exec))))