[Kde-bindings] KDE/kdebindings/ruby/qtruby
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Sat Jul 12 14:31:33 UTC 2008
SVN commit 831363 by rdale:
* Change the layout of the smokeruby_object struct so that the ptr to
the C++ instance is at the start. This should make it easier for
QtRuby to interoperate with Kross
* The type of a slot arg should always be in the smoke module of the slot
being invoked. However, that isn't true for a dataUpdated() slot in a
PlasmaScripting::Applet. So make GetMocArguments search through all the
loaded smoke modules if the arg type isn't found at first.
* In the GC mark function the tests for a QObject type had gone missing, so
restore it.
CCMAIL: kde-bindings at kde.org
M +12 -0 ChangeLog
M +30 -3 src/Qt.cpp
M +9 -0 src/handlers.cpp
M +1 -1 src/qtruby.h
--- trunk/KDE/kdebindings/ruby/qtruby/ChangeLog #831362:831363
@@ -1,3 +1,15 @@
+2008-07-12 Richard Dale <richard.j.dale at gmail.com>
+
+ * Change the layout of the smokeruby_object struct so that the ptr to
+ the C++ instance is at the start. This should make it easier for
+ QtRuby to interoperate with Kross
+ * The type of a slot arg should always be in the smoke module of the slot
+ being invoked. However, that isn't true for a dataUpdated() slot in a
+ PlasmaScripting::Applet. So make GetMocArguments search through all the
+ loaded smoke modules if the arg type isn't found at first.
+ * In the GC mark function the tests for a QObject type had gone missing, so
+ restore it.
+
2008-07-11 Cyrille Berger <cberger at cberger.net>
* Make it possible to call set_qtruby_embedded from ruby.
--- trunk/KDE/kdebindings/ruby/qtruby/src/Qt.cpp #831362:831363
@@ -964,11 +964,38 @@
QString staticType = (rx->indexIn(name) != -1 ? rx->cap(1) : "ptr");
if (staticType == "ptr") {
arg->argType = xmoc_ptr;
- typeId = smoke->idType(name.constData());
+ QByteArray targetType = name;
+ typeId = smoke->idType(targetType.constData());
if (typeId == 0 && !name.contains('*')) {
- name += "&";
- typeId = smoke->idType(name.constData());
+ if (!name.contains("&")) {
+ targetType += "&";
+ }
+ typeId = smoke->idType(targetType.constData());
}
+
+ // This shouldn't be necessary because the type of the slot arg should always be in the
+ // smoke module of the slot being invoked. However, that isn't true for a dataUpdated()
+ // slot in a PlasmaScripting::Applet
+ if (typeId == 0) {
+ QHash<Smoke*, QtRubyModule>::const_iterator it;
+ for (it = qtruby_modules.constBegin(); it != qtruby_modules.constEnd(); ++it) {
+ smoke = it.key();
+ targetType = name;
+ typeId = smoke->idType(targetType.constData());
+
+ if (typeId == 0 && !name.contains('*')) {
+ if (!name.contains("&")) {
+ targetType += "&";
+ }
+
+ typeId = smoke->idType(targetType.constData());
+
+ if (typeId != 0) {
+ break;
+ }
+ }
+ }
+ }
} else if (staticType == "bool") {
arg->argType = xmoc_bool;
typeId = smoke->idType(name.constData());
--- trunk/KDE/kdebindings/ruby/qtruby/src/handlers.cpp #831362:831363
@@ -170,6 +170,15 @@
if (do_debug & qtdb_gc) qWarning("Checking for mark (%s*)%p", className, o->ptr);
if (o->ptr && o->allocated) {
+ if (o->smoke->isDerivedFromByName(className, "QObject")) {
+ QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
+ // Only mark the QObject tree if the current item doesn't have a parent.
+ // This avoids marking parts of a tree more than once.
+ if (qobject->parent() == 0) {
+ mark_qobject_children(qobject);
+ }
+ }
+
if (o->smoke->isDerivedFromByName(className, "QListWidget")) {
QListWidget * listwidget = (QListWidget *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QListWidget").index);
--- trunk/KDE/kdebindings/ruby/qtruby/src/qtruby.h #831362:831363
@@ -50,10 +50,10 @@
};
struct smokeruby_object {
+ void *ptr;
bool allocated;
Smoke *smoke;
int classId;
- void *ptr;
};
struct TypeHandler {
More information about the Kde-bindings
mailing list