Use overload resolution instead of static-call
Sun May 24 16:40:11 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Use overload resolution instead of static-call
diff -rN -u old-qt.gui/src/application.lisp new-qt.gui/src/application.lisp
--- old-qt.gui/src/application.lisp 2014-10-16 03:42:10.000000000 +0200
+++ new-qt.gui/src/application.lisp 2014-10-16 03:42:11.000000000 +0200
@@ -50,13 +50,14 @@
(values (make-instance 'qt:application :args (list argc argv)) t))))
(defun kill-app ()
(cxx:quit (app))
-; (when (typep (app) (find-class 'qt:application))
-; (application.close-all-windows))
+ (when (typep (app) (find-class 'qt:application))
+ (application.close-all-windows))
(setf *widgets* nil)
(trivial-garbage:cancel-finalization (app))
(smoke::remove-object (smoke::pointer (app)))
;; FIXME leak memory or memory fault!
;(smoke::delete-pointer (smoke::pointer (app)) (class-of (app)))
+ (cxx:delete-later (app))
(setf (slot-value (app) 'pointer) (null-pointer))
(makunbound '*app*)))
diff -rN -u old-qt.gui/src/package.lisp new-qt.gui/src/package.lisp
--- old-qt.gui/src/package.lisp 2014-10-16 03:42:10.000000000 +0200
+++ new-qt.gui/src/package.lisp 2014-10-16 03:42:11.000000000 +0200
@@ -1,8 +1,6 @@
(defpackage :qt
(:use :cl :smoke :cffi :bordeaux-threads :cxx-support)
- (:export #:call
-
- #:app
+ (:export #:app
#:app-p
#:exec
#:with-app
diff -rN -u old-qt.gui/src/qt.lisp new-qt.gui/src/qt.lisp
--- old-qt.gui/src/qt.lisp 2014-10-16 03:42:10.000000000 +0200
+++ new-qt.gui/src/qt.lisp 2014-10-16 03:42:11.000000000 +0200
@@ -33,6 +33,3 @@
(eval-when (:load-toplevel :compile-toplevel :execute)
(use-foreign-library libqt-smoke-extra))
-
-(defun static-call (class-name method-name &rest args)
- (apply #'smoke::static-call *qt-smoke* class-name method-name args))
diff -rN -u old-qt.gui/src/signal-slot/connect.lisp new-qt.gui/src/signal-slot/connect.lisp
--- old-qt.gui/src/signal-slot/connect.lisp 2014-10-16 03:42:10.000000000 +0200
+++ new-qt.gui/src/signal-slot/connect.lisp 2014-10-16 03:42:11.000000000 +0200
@@ -150,19 +150,12 @@
(defun connect-id (sender signal-id receiver slot-id type types)
- (static-call "QMetaObject" "connect#$#$$$"
- sender
- signal-id
- receiver
- slot-id
- (if (null type)
- (value +auto-connection+)
- (value type))
- types))
+ (meta-object.connect sender signal-id
+ receiver slot-id
+ (if (null type)
+ (value +auto-connection+)
+ (value type))
+ types))
(defun disconnect-id (sender signal-id receiver slot-id)
- (static-call "QMetaObject" "disconnect#$#$"
- sender
- signal-id
- receiver
- slot-id))
+ (meta-object.disconnect sender signal-id receiver slot-id))
diff -rN -u old-qt.gui/src/signal-slot/signal.lisp new-qt.gui/src/signal-slot/signal.lisp
--- old-qt.gui/src/signal-slot/signal.lisp 2014-10-16 03:42:10.000000000 +0200
+++ new-qt.gui/src/signal-slot/signal.lisp 2014-10-16 03:42:11.000000000 +0200
@@ -76,38 +76,32 @@
()
"No slot ~S for class ~S."
slot (class-name receiver))
- (assert (static-call "QMetaObject" "connect#$#$$$"
- qsignal
- (id qsignal)
- receiver
- slot-id
- type
- ;; QMetaObject::connect is responsible for freeing
- ;; the types array.
- (types (method-arguments-type
- (cxx:meta-object receiver)
- slot-id)))
- ()
- "Failed to connect ~S to the slot ~S of ~S."
- qsignal slot receiver)))
+ (or (meta-object.connect qsignal (id qsignal)
+ receiver slot-id
+ type
+ ;; QMetaObject::connect is responsible
+ ;; for freeing the types array.
+ (types (method-arguments-type
+ (cxx:meta-object receiver)
+ slot-id)))
+ (cerror "Ignore"
+ "Failed to connect ~S to the slot ~S of ~S."
+ qsignal slot receiver))))
(defun disconnect-signal (qsignal receiver slot)
(let ((qsignal (signal-object qsignal))
(slot-id (cxx:index-of-slot (cxx:meta-object receiver)
- (cxx:data
- (meta-object.normalized-signature slot)))))
+ (cxx:data
+ (meta-object.normalized-signature slot)))))
(assert (>= slot-id 0)
()
"No slot ~S for class ~S."
slot (class-name receiver))
- (assert (static-call "QMetaObject" "disconnect#$#$"
- qsignal
- (id qsignal)
- receiver
- slot-id)
- ()
- "Failed to disconnect ~S to the slot ~S of ~S."
- qsignal slot receiver)))
+ (or (meta-object.disconnect qsignal (id qsignal)
+ receiver slot-id)
+ (cerror "Ignore"
+ "Failed to disconnect ~S to the slot ~S of ~S."
+ qsignal slot receiver))))
(defmethod smoke::push-lisp-object (stack object class)
(let ((cxx-object (make-cxx-lisp-object object)))
@@ -147,9 +141,7 @@
'smoke::smoke-stack-item 'smoke::voidp))))
(setf (mem-aref args :pointer 0)
(null-pointer))
- (smoke::static-call *qt-smoke* "QMetaObject" "activate##$?"
- qsignal
- (cxx:meta-object qsignal)
+ (meta-object.activate qsignal (cxx:meta-object qsignal)
(id qsignal)
args))))
diff -rN -u old-qt.gui/src/signal-slot/slot.lisp new-qt.gui/src/signal-slot/slot.lisp
--- old-qt.gui/src/signal-slot/slot.lisp 2014-10-16 03:42:10.000000000 +0200
+++ new-qt.gui/src/signal-slot/slot.lisp 2014-10-16 03:42:11.000000000 +0200
@@ -70,14 +70,10 @@
:argument-types (method-arguments-type
(cxx:meta-object sender)
signal-id))))
- (let ((ret (static-call "QMetaObject" "connect#$#$$$"
- sender
- signal-id
- slot
- (id slot)
- type
- (types (arguments slot)))))
+ (let ((ret (meta-object.connect sender signal-id
+ slot (id slot)
+ type (types (arguments slot)))))
(if ret
- (cxx:connect-notify sender signal)
- (cerror "Failed to connect the signal ~S of ~S to the function ~S."
- signal sender function)))))
+ (cxx:connect-notify sender signal)
+ (cerror "Failed to connect the signal ~S of ~S to the function ~S."
+ signal sender function)))))