[Kde-bindings] KDE/kdebindings/csharp/qyoto

Arno Rehn kde at arnorehn.de
Thu Dec 17 18:27:59 UTC 2009


SVN commit 1063283 by arnorehn:

Adapt Qyoto to the modular qt smoke libs.  This seems to break the
qtwebkit module.

CCMAIL: kde-bindings at kde.org



 M  +5 -2      CMakeLists.txt  
 M  +44 -24    src/qyoto.cpp  
 M  +11 -11    src/qyotoshared.cpp  
 M  +3 -3      src/qyotosmokebinding.cpp  


--- trunk/KDE/kdebindings/csharp/qyoto/CMakeLists.txt #1063282:1063283
@@ -38,11 +38,14 @@
 LINK_DIRECTORIES (${LIBRARY_OUTPUT_PATH})
 
 ADD_LIBRARY (qyotoshared SHARED ${SRC_QYOTO_SHARED})
-TARGET_LINK_LIBRARIES (qyotoshared smokeqt ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
+TARGET_LINK_LIBRARIES (qyotoshared smokeqtcore smokeqtgui smokeqtxml smokeqtopengl smokeqtsql smokeqtnetwork smokeqtnetwork smokeqtdbus smokeqtsvg
+                       ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
 set_target_properties(qyotoshared PROPERTIES VERSION 1.0.0 SOVERSION 1 COMPILE_DEFINITIONS QYOTOSHARED_BUILDING)
 
 ADD_LIBRARY (qyoto MODULE ${SRC_QYOTO})
-TARGET_LINK_LIBRARIES (qyoto qyotoshared smokeqt ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
+TARGET_LINK_LIBRARIES (qyoto qyotoshared
+                       smokeqtcore smokeqtgui smokeqtxml smokeqtopengl smokeqtsql smokeqtnetwork smokeqtnetwork smokeqtdbus smokeqtsvg
+                       ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
 
 CSHARP_ADD_LIBRARY(qt-dotnet ${SRC_CS_QYOTO} COMPILE_FLAGS /warn:0 "/keyfile:${KEYFILE}" UNSAFE)
 SET_PROPERTY(TARGET qt-dotnet PROPERTY pkg-config_template_basename "qyoto")
--- trunk/KDE/kdebindings/csharp/qyoto/src/qyoto.cpp #1063282:1063283
@@ -64,11 +64,15 @@
 #define QYOTO_VERSION "0.0.1"
 // #define DEBUG
 
-#include <qt_smoke.h>
+#include <qtcore_smoke.h>
+#include <qtgui_smoke.h>
+#include <qtxml_smoke.h>
+#include <qtsql_smoke.h>
+#include <qtopengl_smoke.h>
+#include <qtnetwork_smoke.h>
+#include <qtsvg_smoke.h>
+#include <qtdbus_smoke.h>
 
-// Maps from a classname in the form Qt::Widget to an int id
-QHash<int,char *> classname;
-
 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 *);
 
@@ -132,12 +136,12 @@
 	fflush(stdout);
 #endif
 
-	Smoke::ModuleIndex meth = qt_Smoke->findMethod(classname, mungedname);
+	Smoke::ModuleIndex meth = qtcore_Smoke->findMethod(classname, mungedname);
 #ifdef DEBUG
 	if (do_debug & qtdb_calls) printf("DAMNIT on %s::%s => %d\n", classname, mungedname, meth.index);
 #endif
 	if (meth.index == 0) {
-    	meth = qt_Smoke->findMethod("QGlobalSpace", mungedname);
+    	meth = qtcore_Smoke->findMethod("QGlobalSpace", mungedname);
 #ifdef DEBUG
 		if (do_debug & qtdb_calls) printf("DAMNIT on QGlobalSpace::%s => %d\n", mungedname, meth.index);
 #endif
@@ -377,7 +381,7 @@
 	smokeqyoto_object *o = (smokeqyoto_object*) (*GetSmokeObject)(value);
 	if (o) (*FreeGCHandle)(value);
 	QVariant * v = new QVariant(type, o? o->ptr : value);
-	Smoke::ModuleIndex id = qt_Smoke->findClass("QVariant");
+	Smoke::ModuleIndex id = qtcore_Smoke->findClass("QVariant");
 	smokeqyoto_object  * vo = alloc_smokeqyoto_object(true, id.smoke, id.index, (void *) v);
 	return (*CreateInstance)("Qyoto.QVariant", vo);
 }
@@ -996,37 +1000,53 @@
 	
 	// create smoke object
 	smokeqyoto_object  * m = alloc_smokeqyoto_object(	true, 
-														qt_Smoke, 
-														qt_Smoke->idClass("QMetaObject").index, 
+														qtcore_Smoke,
+														qtcore_Smoke->idClass("QMetaObject").index,
 														meta );
 	
 	// create wrapper C# instance
 	return (*CreateInstance)("Qyoto.QMetaObject", m);
 }
 
-static Qyoto::Binding binding;
+#define INIT_BINDING(module) \
+    static QHash<int,char *> module##_classname; \
+    for (int i = 1; i <= module##_Smoke->numClasses; i++) { \
+        QByteArray name(module##_Smoke->classes[i].className); \
+        name.replace("::", "."); \
+        if (name != "QAccessible2" && name != "QDBus" && name != "QGL" && name != "QSql" && name != "QSsl") { \
+            name = prefix + name; \
+        } \
+        module##_classname.insert(i, strdup(name.constData())); \
+    } \
+    static Qyoto::Binding module##_binding = Qyoto::Binding(module##_Smoke, &module##_classname); \
+    QyotoModule module = { "Qyoto_" #module, qyoto_resolve_classname_qt, IsContainedInstanceQt, &module##_binding }; \
+    qyoto_modules[module##_Smoke] = module;
 
+
 Q_DECL_EXPORT void
 Init_qyoto()
 {
-    init_qt_Smoke();
+    init_qtcore_Smoke();
+    init_qtgui_Smoke();
+    init_qtxml_Smoke();
+    init_qtsql_Smoke();
+    init_qtopengl_Smoke();
+    init_qtnetwork_Smoke();
+    init_qtsvg_Smoke();
+    init_qtdbus_Smoke();
+
     qyoto_install_handlers(Qyoto_handlers);
     QByteArray prefix("Qyoto.");
 
-    for (int i = 1; i <= qt_Smoke->numClasses; i++) {
-		QByteArray name(qt_Smoke->classes[i].className);
-		name.replace("::", ".");
-		if (name != "QAccessible2" && name != "QDBus" && name != "QGL" && name != "QSql" && name != "QSsl") {
-			name = prefix + name;
-		}
+    INIT_BINDING(qtcore)
+    INIT_BINDING(qtgui)
+    INIT_BINDING(qtxml)
+    INIT_BINDING(qtsql)
+    INIT_BINDING(qtopengl)
+    INIT_BINDING(qtnetwork)
+    INIT_BINDING(qtsvg)
+    INIT_BINDING(qtdbus)
 
-		classname.insert(i, strdup(name.constData()));
-    }
-
-    binding = Qyoto::Binding(qt_Smoke, &classname);
-	QyotoModule module = { "Qyoto", qyoto_resolve_classname_qt, IsContainedInstanceQt, &binding };
-    qyoto_modules[qt_Smoke] = module;
-
 #if QT_VERSION >= 0x40300
     QInternal::registerCallback(QInternal::EventNotifyCallback, qyoto_event_notify);
 #endif
--- trunk/KDE/kdebindings/csharp/qyoto/src/qyotoshared.cpp #1063282:1063283
@@ -2,7 +2,7 @@
 #include <QtGui>
 
 #include <smoke/smoke.h>
-#include <smoke/qt_smoke.h>
+#include <smoke/qtcore_smoke.h>
 
 #include "smokeqyoto.h"
 #include "qyoto.h"
@@ -483,36 +483,36 @@
 				}
 			} else if (staticType == "bool") {
 				arg->argType = xmoc_bool;
-				smoke = qt_Smoke;
+				smoke = qtcore_Smoke;
 				typeId = smoke->idType(name.constData());
 			} else if (staticType == "int") {
 				arg->argType = xmoc_int;
-				smoke = qt_Smoke;
+				smoke = qtcore_Smoke;
 				typeId = smoke->idType(name.constData());
 			} else if (staticType == "uint") {
 				arg->argType = xmoc_uint;
-				smoke = qt_Smoke;
+				smoke = qtcore_Smoke;
 				typeId = smoke->idType(name.constData());
 			} else if (staticType == "long") {
 				arg->argType = xmoc_long;
-				smoke = qt_Smoke;
+				smoke = qtcore_Smoke;
 				typeId = smoke->idType(name.constData());
 			} else if (staticType == "ulong") {
 				arg->argType = xmoc_ulong;
-				smoke = qt_Smoke;
+				smoke = qtcore_Smoke;
 				typeId = smoke->idType(name.constData());
 			} else if (staticType == "double") {
 				arg->argType = xmoc_double;
-				smoke = qt_Smoke;
+				smoke = qtcore_Smoke;
 				typeId = smoke->idType(name.constData());
 			} else if (staticType == "char*") {
 				arg->argType = xmoc_charstar;
-				smoke = qt_Smoke;
+				smoke = qtcore_Smoke;
 				typeId = smoke->idType(name.constData());
 			} else if (staticType == "QString") {
 				arg->argType = xmoc_QString;
 				name += "*";
-				smoke = qt_Smoke;
+				smoke = qtcore_Smoke;
 				typeId = smoke->idType(name.constData());
 			}
 
@@ -588,8 +588,8 @@
 		((void**)_o)[0] = sqo->ptr;
 	} else if (_c == QMetaObject::WriteProperty) {
 		QMetaProperty property = metaobject->property(_id);
-		smokeqyoto_object* sqo = alloc_smokeqyoto_object(false, qt_Smoke,
-		                                                 qt_Smoke->idClass("QVariant").index,
+		smokeqyoto_object* sqo = alloc_smokeqyoto_object(false, qtcore_Smoke,
+		                                                 qtcore_Smoke->idClass("QVariant").index,
 		                                                 ((void**)_o)[0]);
 		void* variant = (*CreateInstance)("Qyoto.QVariant", sqo);
 		(*SetProperty)(obj, property.name(), variant);
--- trunk/KDE/kdebindings/csharp/qyoto/src/qyotosmokebinding.cpp #1063282:1063283
@@ -20,7 +20,7 @@
 #include <cstdlib>
 #include <cstdio>
 
-#include <qt_smoke.h>
+#include <qtgui_smoke.h>
 
 #if QT_VERSION >= 0x40200
 	#include <QVariant>
@@ -101,7 +101,7 @@
 	}
 
 #if QT_VERSION >= 0x40200
-	static Smoke::Index qgraphicsitem_class = qt_Smoke->idClass("QGraphicsItem").index;
+	static Smoke::Index qgraphicsitem_class = Smoke::classMap["QGraphicsItem"].index;
 #endif
 
 	smokeqyoto_object *sqo = (smokeqyoto_object*) (*GetSmokeObject)(obj);
@@ -116,7 +116,7 @@
 		return true;
 #if QT_VERSION >= 0x40200
 	} else if (strcmp(signature, "itemChange(QGraphicsItem::GraphicsItemChange, const QVariant&)") == 0
-	           && smoke->isDerivedFrom(smoke, sqo->classId, qt_Smoke, qgraphicsitem_class)) {
+	           && smoke->isDerivedFrom(smoke, sqo->classId, qtgui_Smoke, qgraphicsitem_class)) {
 		int change = args[1].s_int;
 		if (change == QGraphicsItem::ItemSceneChange) {
 			QGraphicsScene *scene = ((QVariant*) args[2].s_voidp)->value<QGraphicsScene*>();



More information about the Kde-bindings mailing list