[Kde-bindings] KDE/kdebindings/qtruby

Richard Dale Richard_Dale at tipitina.demon.co.uk
Mon Oct 2 16:06:46 UTC 2006


SVN commit 591514 by rdale:

* It is now possible to call on a Qt::DBusInterface instance directly like
  this:

	app = Qt::Application.new(ARGV)
	bus = Qt::DBusConnection.sessionBus()
	proxy = Qt::DBusInterface.new(  "org.freedesktop.DBus", 
	                                "/org/freedesktop/DBus", 
	                                "org.freedesktop.DBus", 
	                                bus )
		
	result = proxy.ListNames()

	# result is ["org.freedesktop.DBus", ":1.0", "com.trolltech.Assistant", ":1.15"]

* Fixed bugs in Qt::Variant where some constants were missing, and the one for 'String'
	gave a warning

CCMAIL: kde-bindings at kde.org



 M  +19 -0     ChangeLog  
 M  +23 -2     rubylib/qtruby/lib/Qt/qtruby4.rb  


--- trunk/KDE/kdebindings/qtruby/ChangeLog #591513:591514
@@ -3,6 +3,25 @@
 	* qVariantFromValue() wasn't working with non-Qt classes as arguments,
 	  such as Ruby Strings and Integers
 
+	* The rbuic4 tool was not setting up slot/signal connections.
+
+	* It is now possible to call on a Qt::DBusInterface instance directly like
+	  this:
+
+		app = Qt::Application.new(ARGV)
+		bus = Qt::DBusConnection.sessionBus()
+		proxy = Qt::DBusInterface.new(  "org.freedesktop.DBus", 
+		                                "/org/freedesktop/DBus", 
+		                                "org.freedesktop.DBus", 
+		                                bus )
+		
+		result = proxy.ListNames()
+
+		# result is ["org.freedesktop.DBus", ":1.0", "com.trolltech.Assistant", ":1.15"]
+
+	* Fixed bugs in Qt::Variant where some constants were missing, and the one for 'String'
+		gave a warning
+
 2006-10-01  Richard Dale  <rdale at foton.es>
 
 	* The Qt::DBusMessage.type method now works. Fixes problem reported by 
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/lib/Qt/qtruby4.rb #591513:591514
@@ -398,6 +398,26 @@
 		end
 	end
 
+	class DBusInterface < Qt::Base 
+		def method_missing(id, *args)
+			begin
+				# First look for a method in the Smoke runtime
+				# If not found, then throw an exception and try dbus.
+				super(id, *args)
+			rescue
+				if args.length == 0
+					qdbusMessage = call(id.to_s)
+				else
+					# create an Array 'dbusArgs' of Qt::Variants from '*args'
+					qdbusArgs = args.collect {|arg| qVariantFromValue(arg)}
+					qdbusMessage = call(id.to_s, *dbusArgs)
+				end
+				reply = qdbusMessage.arguments
+				return reply.length > 0 ? reply[0].to_ruby : nil
+			end
+		end
+	end
+
 	class DBusMessage < Qt::Base 
 		def type(*args)
 			method_missing(:type, *args)
@@ -1305,6 +1325,8 @@
 	end
 	
 	class Variant < Qt::Base
+		String = 10
+
 		def to_a
 			return toStringList()
 		end
@@ -1372,7 +1394,6 @@
 				return qVariantValue(Qt::Pixmap, self)
 			when Qt::Variant::Point
 				return toPoint
-			when Qt::Variant::PointArray
 			when Qt::Variant::PointF
 				return toPointF
 			when Qt::Variant::Polygon
@@ -1405,7 +1426,7 @@
 				return toUint
 			when Qt::Variant::ULongLong
 				return toULongLong
-			when Qt::Variant::UrL
+			when Qt::Variant::Url
 				return toUrl
 			end
 		end



More information about the Kde-bindings mailing list