[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bindings
Subject:    [Kde-bindings] KDE/kdebindings/qtruby
From:       Richard Dale <Richard_Dale () tipitina ! demon ! co ! uk>
Date:       2006-10-16 21:09:35
Message-ID: 1161032975.331053.17023.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 596188 by rdale:

* Fixed Qt::DBusInterface.call() so it automatically wraps the arguments
  as Qt::Variants. Thanks to prullmann for testing and finding problems.

* Improved the pingpong example to be more like the C++ version.

CCMAIL: kde-bindings@kde.org



 M  +7 -0      ChangeLog  
 M  +4 -3      rubylib/examples/qdbus/pingpong/ping.rb  
 M  +13 -3     rubylib/qtruby/lib/Qt/qtruby4.rb  


--- trunk/KDE/kdebindings/qtruby/ChangeLog #596187:596188
@@ -1,3 +1,10 @@
+2006-10-16  Richard Dale  <rdale@foton.es>
+
+	* Fixed Qt::DBusInterface.call() so it automatically wraps the arguments
+	  as Qt::Variants. Thanks to prullmann for testing and finding problems.
+
+	* Improved the pingpong example to be more like the C++ version.
+
 2006-10-13  Richard Dale  <rdale@foton.es>
 
 	* Added marshallers for QList<QPair<QString,QString> > and QGradiantStops
--- trunk/KDE/kdebindings/qtruby/rubylib/examples/qdbus/pingpong/ping.rb #596187:596188
@@ -37,15 +37,16 @@
 	
 iface = Qt::DBusInterface.new(SERVICE_NAME, "/", "", Qt::DBusConnection.sessionBus)
 if iface.valid?
-	reply = iface.ping(ARGV.length > 0 ? ARGV[0] : "")
+	message = iface.call("ping", ARGV.length > 0 ? ARGV[0] : "")
+	reply = Qt::DBusReply.new(message)
 	if reply.valid?
 		puts("Reply was: %s\n" % reply.value)
 		exit(0)
 	end
 	
-	$stderr.puts("Call failed: %s\n", reply.error.message)
+	$stderr.puts("Call failed: %s\n" % reply.error.message)
 	exit(1)
 end
 	
 $stderr.puts("%s\n" % Qt::DBusConnection.sessionBus.lastError.message)
-exit(1)
\ No newline at end of file
+exit(1)
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/lib/Qt/qtruby4.rb #596187:596188
@@ -435,6 +435,18 @@
 	end
 
 	class DBusInterface < Qt::Base 
+
+		def call(method_name, *args)
+			if args.length == 0
+				return super(method_name.to_sym)
+			else
+				# If the method is Qt::DBusInterface.call(), create an Array 
+				# 'dbusArgs' of Qt::Variants from '*args'
+				qdbusArgs = args.collect {|arg| qVariantFromValue(arg)}
+				return super(method_name, *qdbusArgs)
+			end
+		end
+
 		def method_missing(id, *args)
 			begin
 				# First look for a method in the Smoke runtime
@@ -444,9 +456,7 @@
 				if args.length == 0
 					return call(id.to_s).value
 				else
-					# create an Array 'dbusArgs' of Qt::Variants from '*args'
-					qdbusArgs = args.collect {|arg| qVariantFromValue(arg)}
-					return call(id.to_s, *dbusArgs).value
+					return call(id.to_s, *args).value
 				end
 			end
 		end
_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic