[Kde-bindings] KDE/kdebindings/qtruby
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Thu Jun 1 12:36:03 UTC 2006
SVN commit 547240 by rdale:
* Added a rbrcc resource compiler, a ruby version of rcc
* Two new module methods Qt.qRegisterResourceData() and
Qt.qRegisterResourceData() were added to Qt.cpp to support the
resource compiler.
CCMAIL: kde-bindings at kde.org
M +7 -0 ChangeLog
M +1 -1 rubylib/designer/Makefile.am
A rubylib/designer/rbrcc (directory)
A rubylib/designer/rbrcc/Makefile.am
A rubylib/designer/rbrcc/main.cpp [License: UNKNOWN]
A rubylib/designer/rbrcc/rcc.cpp [License: GENERATED FILE]
A rubylib/designer/rbrcc/rcc.h [License: UNKNOWN]
A rubylib/examples/itemviews/chart/chart.qrc
M +1 -0 rubylib/examples/itemviews/chart/main.rb
M +1 -1 rubylib/examples/itemviews/chart/mainwindow.rb
A rubylib/examples/itemviews/chart/makefile
M +36 -0 rubylib/qtruby/Qt.cpp
--- trunk/KDE/kdebindings/qtruby/ChangeLog #547239:547240
@@ -1,3 +1,10 @@
+2006-06-01 Richard Dale <rdale at foton.es>
+
+ * Added a rbrcc resource compiler, a ruby version of rcc
+ * Two new module methods Qt.qRegisterResourceData() and
+ Qt.qRegisterResourceData() were added to Qt.cpp to support the
+ resource compiler.
+
2006-05-23 Richard Dale <rdale at foton.es>
* With code like the following, the QtRuby runtime was choosing
--- trunk/KDE/kdebindings/qtruby/rubylib/designer/Makefile.am #547239:547240
@@ -1 +1 @@
-SUBDIRS = rbuic
+SUBDIRS = rbuic rbrcc
--- trunk/KDE/kdebindings/qtruby/rubylib/examples/itemviews/chart/main.rb #547239:547240
@@ -24,6 +24,7 @@
=end
require 'Qt'
+require 'qrc_chart.rb'
require 'mainwindow.rb'
app = Qt::Application.new(ARGV)
--- trunk/KDE/kdebindings/qtruby/rubylib/examples/itemviews/chart/mainwindow.rb #547239:547240
@@ -50,7 +50,7 @@
menuBar().addMenu(fileMenu)
statusBar()
- openFile("qtdata.cht")
+ openFile(":/Charts/qtdata.cht")
setWindowTitle(tr("Chart"))
resize(640, 480)
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/Qt.cpp #547239:547240
@@ -45,6 +45,9 @@
#include <QtCore/qabstractitemmodel.h>
#include <QtGui/qitemselectionmodel.h>
+extern bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
+extern bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
+
#undef DEBUG
#ifndef __USE_POSIX
#define __USE_POSIX
@@ -933,6 +936,36 @@
}
static VALUE
+q_register_resource_data(VALUE /*self*/, VALUE version, VALUE tree_value, VALUE name_value, VALUE data_value)
+{
+ const unsigned char * tree = (const unsigned char *) malloc(RSTRING(tree_value)->len);
+ memcpy((void *) tree, (const void *) RSTRING(tree_value)->ptr, RSTRING(tree_value)->len);
+
+ const unsigned char * name = (const unsigned char *) malloc(RSTRING(name_value)->len);
+ memcpy((void *) name, (const void *) RSTRING(name_value)->ptr, RSTRING(name_value)->len);
+
+ const unsigned char * data = (const unsigned char *) malloc(RSTRING(data_value)->len);
+ memcpy((void *) data, (const void *) RSTRING(data_value)->ptr, RSTRING(data_value)->len);
+
+ return qRegisterResourceData(NUM2INT(version), tree, name, data) ? Qtrue : Qfalse;
+}
+
+static VALUE
+q_unregister_resource_data(VALUE /*self*/, VALUE version, VALUE tree_value, VALUE name_value, VALUE data_value)
+{
+ const unsigned char * tree = (const unsigned char *) malloc(RSTRING(tree_value)->len);
+ memcpy((void *) tree, (const void *) RSTRING(tree_value)->ptr, RSTRING(tree_value)->len);
+
+ const unsigned char * name = (const unsigned char *) malloc(RSTRING(name_value)->len);
+ memcpy((void *) name, (const void *) RSTRING(name_value)->ptr, RSTRING(name_value)->len);
+
+ const unsigned char * data = (const unsigned char *) malloc(RSTRING(data_value)->len);
+ memcpy((void *) data, (const void *) RSTRING(data_value)->ptr, RSTRING(data_value)->len);
+
+ return qUnregisterResourceData(NUM2INT(version), tree, name, data) ? Qtrue : Qfalse;
+}
+
+static VALUE
qabstract_item_model_rowcount(int argc, VALUE * argv, VALUE self)
{
smokeruby_object *o = value_obj_info(self);
@@ -2861,6 +2894,9 @@
rb_define_module_function(qt_module, "version", (VALUE (*) (...)) version, 0);
rb_define_module_function(qt_module, "qtruby_version", (VALUE (*) (...)) qtruby_version, 0);
+ rb_define_module_function(qt_module, "qRegisterResourceData", (VALUE (*) (...)) q_register_resource_data, 4);
+ rb_define_module_function(qt_module, "qUnregisterResourceData", (VALUE (*) (...)) q_unregister_resource_data, 4);
+
rb_require("Qt/qtruby.rb");
// Do package initialization
More information about the Kde-bindings
mailing list