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

Richard Dale Richard_Dale at tipitina.demon.co.uk
Thu Apr 19 16:18:16 UTC 2007


SVN commit 655861 by rdale:

* Fixed a bug in resolving overloaded methods where an enum passed as an
  quint64 arg type needed to be given a lower priority that an Integer one
* Added two models useful for Rails ActiveRecord or ActiveResource with Qt
  widgets
* Fixed a bug in the Qt::HttpRequestHeader method() method

CCMAIL: kde-bindings at kde.org



 M  +1 -0      CMakeLists.txt  
 M  +8 -0      ChangeLog  
 M  +1 -1      examples/network/http/httpwindow.rb  
 A             rails_support (directory)  
 A             rails_support/CMakeLists.txt  
 A             rails_support/active_item_model.rb  
 A             rails_support/active_table_model.rb  
 M  +25 -0     src/handlers.cpp  
 M  +13 -7     src/lib/Qt/qtruby4.rb  


--- trunk/KDE/kdebindings/ruby/qtruby/CMakeLists.txt #655860:655861
@@ -1,3 +1,4 @@
 add_subdirectory( bin )
 add_subdirectory( src )
+add_subdirectory( rails_support )
 add_subdirectory( tools )
--- trunk/KDE/kdebindings/ruby/qtruby/ChangeLog #655860:655861
@@ -1,3 +1,11 @@
+2007-04-19  Richard Dale  <rdale at foton.es>
+
+	* Fixed a bug in resolving overloaded methods where an enum passed as an
+	  quint64 arg type needed to be given a lower priority that an Integer one
+	* Added two models useful for Rails ActiveRecord or ActiveResource with Qt
+	  widgets
+	* Fixed a bug in the Qt::HttpRequestHeader method() method
+
 2007-04-05  Richard Dale  <rdale at foton.es>
 
 	* Add some marshallers for the QVector types in the new Qt 4.3 QXmlStream*
--- trunk/KDE/kdebindings/ruby/qtruby/examples/network/http/httpwindow.rb #655860:655861
@@ -151,7 +151,7 @@
 	                                 tr("Download failed: %s." %
 	                                    @http.errorString))
 	    else
-	        fileName = Qt::FileInfo(Qt::Url.new(@urlLineEdit.text).path).fileName
+	        fileName = Qt::FileInfo.new(Qt::Url.new(@urlLineEdit.text).path).fileName
 	        @statusLabel.text = tr("Downloaded %s to current directory." % fileName)
 	    end
 	
--- trunk/KDE/kdebindings/ruby/qtruby/src/handlers.cpp #655860:655861
@@ -145,6 +145,28 @@
 }
 
 void
+mark_qstandarditem_children(QStandardItem * item)
+{
+	VALUE obj;
+
+	for (int row = 0; row < item->rowCount(); row++) {
+		for (int column = 0; column < item->columnCount(); column++) {
+			QStandardItem * child = item->child(row, column);
+			if (child != 0) {
+				if (child->hasChildren()) {
+					mark_qstandarditem_children(child);
+				}
+				obj = getPointerObject(child);
+				if (obj != Qnil) {
+					if (do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p", "QStandardItem", item, (void*)obj);
+					rb_gc_mark(obj);
+				}
+			}
+		}
+	}
+}
+
+void
 smokeruby_mark(void * p)
 {
 	VALUE obj;
@@ -221,6 +243,9 @@
 				for (int column = 0; column < model->columnCount(); column++) {
 					QStandardItem * item = model->item(row, column);
 					if (item != 0) {
+						if (item->hasChildren()) {
+							mark_qstandarditem_children(item);
+						}
 						obj = getPointerObject(item);
 						if (obj != Qnil) {
 							if (do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p", "QStandardItem", item, (void*)obj);
--- trunk/KDE/kdebindings/ruby/qtruby/src/lib/Qt/qtruby4.rb #655860:655861
@@ -795,7 +795,11 @@
 
 	class HttpRequestHeader < Qt::Base
 		def method(*args)
-			method_missing(:method, *args)
+			if args.length == 1
+				super(*args)
+			else
+				method_missing(:method, *args)
+			end
 		end
 	end
 
@@ -973,10 +977,12 @@
 	end
 
 	class MetaObject < Qt::Base
-		alias_method :_method, :method
-
 		def method(*args)
-			method_missing(:method, *args)
+            if args.length == 1 && args[0].kind_of?(Symbol)
+				super(*args)
+			else
+				method_missing(:method, *args)
+			end
 		end
 
 		# Add three methods, 'propertyNames()', 'slotNames()' and 'signalNames()'
@@ -2094,11 +2100,11 @@
 			puts "      #{typename} (#{argtype})" if debug_level >= DebugLevel::High
 			if argtype == 'i'
 				if typename =~ /^int&?$|^signed int&?$|^signed$|^qint32&?$|^quint32&?$/
+					return 2
+				elsif typename =~ /^(?:short|ushort|unsigned short int|uchar|uint|long|ulong|unsigned long int|unsigned|float|double|WId|Q_PID|^quint16&?$|^qint16&?$)$/
 					return 1
-				elsif typename =~ /^(?:short|ushort|unsigned short int|uchar|uint|long|ulong|unsigned long int|unsigned|float|double|WId|Q_PID|^quint16&?$|^qint16&?$)$/
-					return 0
 				elsif typename =~ /^(quint|qint|qulong|qlong|qreal)/
-					return 0
+					return 1
 				else 
 					t = typename.sub(/^const\s+/, '')
 					t.sub!(/[&*]$/, '')



More information about the Kde-bindings mailing list