[Kde-bindings] KDE/kdebindings/ruby/qtruby

Richard Dale Richard_Dale at tipitina.demon.co.uk
Fri Apr 24 10:04:05 UTC 2009


SVN commit 958553 by rdale:

* The resolve_classname() function was not resolving names for QObject
  derived classes when the class wasn't in the base Qt smoke library.
  For instance, this meant that a Plasma::Applet was not being resolved to
  a Plasma::PopupApplet to match the underlying C++ type.

CCMAIL: kde-bindings at kde.org



 M  +10 -4     ChangeLog  
 M  +17 -0     src/Qt.cpp  
 M  +2 -16     src/handlers.cpp  
 M  +4 -4      src/marshall_basetypes.h  


--- trunk/KDE/kdebindings/ruby/qtruby/ChangeLog #958552:958553
@@ -1,8 +1,14 @@
+2009-04-24  Richard Dale  <richard.j.dale at gmail.com>
+	* The resolve_classname() function was not resolving names for QObject
+	  derived classes when the class wasn't in the base Qt smoke library.
+	  For instance, this meant that a Plasma::Applet was not being resolved to
+	  a Plasma::PopupApplet to match the underlying C++ type.
+
 2009-04-17  Richard Dale  <richard.j.dale at gmail.com>
-  * When Qt::StandardItemModel#setItemPrototype was used with a 
-    Qt::StandardItem it crashed because the clone() method was using 
-    Object#clone. So special case the clone() method. Thanks to Stefano Crocco
-    for reporting the bug.
+	* When Qt::StandardItemModel#setItemPrototype was used with a 
+      Qt::StandardItem it crashed because the clone() method was using 
+      Object#clone. So special case the clone() method. Thanks to Stefano Crocco
+      for reporting the bug.
 
 2009-04-07  Richard Dale  <richard.j.dale at gmail.com>
 	* The ActiveRecord based model classes were setting changed values in the 
--- trunk/KDE/kdebindings/ruby/qtruby/src/Qt.cpp #958552:958553
@@ -459,6 +459,23 @@
 const char *
 resolve_classname(smokeruby_object * o)
 {
+	if (o->smoke->isDerivedFromByName(o->smoke->classes[o->classId].className, "QObject")) {
+		QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
+		const QMetaObject * meta = qobject->metaObject();
+
+		while (meta != 0) {
+			o->smoke = Smoke::classMap[meta->className()];
+			if (o->smoke != 0) {
+				o->classId = o->smoke->idClass(meta->className()).index;
+				if (o->classId != 0) {
+					return qtruby_modules[o->smoke].binding->className(o->classId);
+				}
+			}
+
+			meta = meta->superClass();
+		}
+	}
+
     if (o->smoke->classes[o->classId].external) {
         Smoke::ModuleIndex mi = o->smoke->findClass(o->smoke->className(o->classId));
         o->smoke = mi.smoke;
--- trunk/KDE/kdebindings/ruby/qtruby/src/handlers.cpp #958552:958553
@@ -623,21 +623,6 @@
 		default:
 			break;
 		}
-	} else if (o->smoke->isDerivedFromByName(o->smoke->classes[o->classId].className, "QObject")) {
-		QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
-		const QMetaObject * meta = qobject->metaObject();
-
-		while (meta != 0) {
-			o->smoke = Smoke::classMap[meta->className()];
-			if (o->smoke != 0) {
-				o->classId = o->smoke->idClass(meta->className()).index;
-				if (o->classId != 0) {
-					return qtruby_modules[o->smoke].binding->className(o->classId);
-				}
-			}
-
-			meta = meta->superClass();
-		}
 	} else if (o->smoke->isDerivedFromByName(o->smoke->classes[o->classId].className, "QGraphicsItem")) {
 		QGraphicsItem * item = (QGraphicsItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QGraphicsItem").index);
 		switch (item->type()) {
@@ -1213,6 +1198,7 @@
 						stringlist->append(QString());
 						continue;
 					}
+
 				stringlist->append(*(qstringFromRString(item)));
 			}
 
@@ -1228,7 +1214,7 @@
 			if (m->cleanup()) {
 				delete stringlist;
 			}
-	   
+   
 			break;
 		}
 
--- trunk/KDE/kdebindings/ruby/qtruby/src/marshall_basetypes.h #958552:958553
@@ -139,13 +139,13 @@
 template <>
 void marshall_to_ruby<SmokeClassWrapper>(Marshall *m)
 {
-	if(m->item().s_voidp == 0) {
+	if (m->item().s_voidp == 0) {
 		*(m->var()) = Qnil;
 		return;
 	}
 	void *p = m->item().s_voidp;
 	VALUE obj = getPointerObject(p);
-	if(obj != Qnil) {
+	if (obj != Qnil) {
 		*(m->var()) = obj;
 		return ;
 	}
@@ -153,13 +153,13 @@
 	smokeruby_object  * o = alloc_smokeruby_object(false, m->smoke(), m->type().classId(), p);
 
 	const char * classname = resolve_classname(o);
-	if(m->type().isConst() && m->type().isRef()) {
+	if (m->type().isConst() && m->type().isRef()) {
 		p = construct_copy( o );
 		if (do_debug & qtdb_gc) {
 			qWarning("copying %s %p to %p\n", classname, o->ptr, p);
 		}
 
-		if(p) {
+		if (p) {
 			o->ptr = p;
 			o->allocated = true;
 		}



More information about the Kde-bindings mailing list