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

Richard Dale Richard_Dale at tipitina.demon.co.uk
Mon Nov 19 16:34:53 UTC 2007


SVN commit 738768 by rdale:

* When calling a slot directly, it wouldn't work when then slot had no
  arguments
* Special case any classes which are sub classes of QDBusAbstractInterface
  when calling slots directly as the slots will be remote.
* When there is more than one return value in a Qt::DBusMessage the value
  method now will return a Ruby Array

CCMAIL: kde-bindings at kde.org



 M  +6 -0      ChangeLog  
 M  +5 -2      src/Qt.cpp  
 M  +7 -1      src/lib/Qt/qtruby4.rb  


--- trunk/KDE/kdebindings/ruby/qtruby/ChangeLog #738767:738768
@@ -2,6 +2,12 @@
 
 	* Slot arguments types of 'uint', 'long' and 'ulong' weren't working.
 	  Thanks to maniel for the bug report.
+	* When calling a slot directly, it wouldn't work when then slot had no
+	  arguments
+	* Special case any classes which are sub classes of QDBusAbstractInterface
+	  when calling slots directly as the slots will be remote.
+	* When there is more than one return value in a Qt::DBusMessage the value
+	  method now will return a Ruby Array
 
 2007-11-18  Richard Dale  <rdale at foton.es>
 
--- trunk/KDE/kdebindings/ruby/qtruby/src/Qt.cpp #738767:738768
@@ -1882,7 +1882,10 @@
 						// The class isn't in the Smoke lib. But if it is called 'local::Merged'
 						// it is from a QDBusInterface and the slots are remote, so don't try to
 						// those.
-						while (classId == 0 && qstrcmp(meta->className(), "local::Merged") != 0) {
+						while (	classId == 0 
+								&& qstrcmp(meta->className(), "local::Merged") != 0
+								&& qstrcmp(meta->superClass()->className(), "QDBusAbstractInterface") != 0 ) 
+						{
 							// Assume the QObject has slots which aren't in the Smoke library, so try
 							// and call the slot directly
 							for (int id = meta->methodOffset(); id < meta->methodCount(); id++) {
@@ -1892,7 +1895,7 @@
 
 									// Don't check that the types of the ruby args match the c++ ones for now,
 									// only that the name and arg count is the same.
-									if (*name == methodName && signature.count(',') == (argc - 2)) {
+									if (*name == methodName && meta->method(id).parameterTypes().count() == (argc - 1)) {
 										VALUE args = rb_funcall(	qt_internal_module, 
 																	rb_intern("getMocArguments"), 
 																	2, 
--- trunk/KDE/kdebindings/ruby/qtruby/src/lib/Qt/qtruby4.rb #738767:738768
@@ -509,7 +509,13 @@
 		def value
 			if type() == Qt::DBusMessage::ReplyMessage
 				reply = arguments()
-				return reply.length > 0 ? reply[0].value : nil
+				if reply.length == 0
+					return nil
+				elsif reply.length == 1
+					return reply[0].value
+				else
+					return reply.collect {|v| v.value}
+				end
 			else
 				return nil
 			end



More information about the Kde-bindings mailing list