[Kde-bindings] KDE/kdebindings/csharp

Arno Rehn kde at arnorehn.de
Sun Jul 6 18:43:10 UTC 2008


SVN commit 828820 by arnorehn:

* Moved the PlasmaScripting.* classes back into the main plasma assembly,
  since we can't reference Applet.dll and DataEngine.dll for C# Plasma
  plugins.
* Added camelize() method from krubypluginfactory.
* Added "KSharedPtr<KSharedConfig>" to the marshallers array.

CCMAIL: kde-bindings at kde.org



 M  +2 -0      kimono/ChangeLog  
 M  +2 -0      kimono/src/kdehandlers.cpp  
 M  +22 -2     kimono/src/kimonopluginfactory.cpp  
 M  +5 -5      plasma/CMakeLists.txt  
 M  +6 -0      plasma/ChangeLog  
 M  +29 -18    plasma/src/PlasmaScriptengineKimono_Applet.cs  


--- trunk/KDE/kdebindings/csharp/kimono/ChangeLog #828819:828820
@@ -3,6 +3,8 @@
 	* mono_jit_cleanup() is now called from a function that is registered
 	  via atexit(). This seems to be the only way to do that, since calling
 	  it from the destructor of KimonoPluginFactory makes mono crash.
+	* Added camelize() method from krubypluginfactory.
+	* Added "KSharedPtr<KSharedConfig>" to the marshallers array.
 
 2008-07-01  Arno Rehn  <arno at arnorehn.de>
 
--- trunk/KDE/kdebindings/csharp/kimono/src/kdehandlers.cpp #828819:828820
@@ -165,6 +165,8 @@
     { "KSharedConfig::Ptr&", marshall_KSharedConfigPtr },
     { "KSharedConfigPtr", marshall_KSharedConfigPtr },
     { "KSharedConfigPtr&", marshall_KSharedConfigPtr },
+    { "KSharedPtr<KSharedConfig>", marshall_KSharedConfigPtr },
+    { "KSharedPtr<KSharedConfig>&", marshall_KSharedConfigPtr },
     { "KUrl::List", marshall_KUrlList },
     { "KUrl::List&", marshall_KUrlList },
     { "KUrlList", marshall_KUrlList },
--- trunk/KDE/kdebindings/csharp/kimono/src/kimonopluginfactory.cpp #828819:828820
@@ -55,6 +55,7 @@
 
 private:
 	void initQyotoRuntime();
+	QByteArray camelize(QByteArray name);
 	
 	QHash<QString, MonoAssembly*> assemblies;
 	QHash<MonoAssembly*, MonoImage*> images;
@@ -89,6 +90,25 @@
 {
 }
 
+QByteArray
+KimonoPluginFactory::camelize(QByteArray name)
+{
+    // Convert foo_bar_baz to FooBarBaz
+    QByteArray camelCaseName = name.left(1).toUpper();
+    for (int i = 1; i < name.size(); i++) {
+        if (name[i] == '_' || name[i] == '-') {
+            i++;
+            if (i < name.size()) {
+                 camelCaseName += name.mid(i, 1).toUpper();
+            }
+        } else {
+             camelCaseName += name[i];
+        }
+    }
+
+    return camelCaseName;
+}
+
 void
 KimonoPluginFactory::initQyotoRuntime()
 {
@@ -152,8 +172,8 @@
 
 	// a path in the form Foo/Bar.dll results in the class Bar in the namespace Foo
 	QFileInfo file(path);
-	QString nameSpace = file.dir().dirName();
-	QString className = file.completeBaseName();
+	QString nameSpace = camelize(file.dir().dirName().toLatin1());
+	QString className = camelize(file.completeBaseName().toLatin1());
 	MonoClass* klass = mono_class_from_name(image, (const char*) nameSpace.toLatin1(), (const char*) className.toLatin1());
 
 	// we want the Foo.Bar:.ctor(QObject, List<QVariant>)
--- trunk/KDE/kdebindings/csharp/plasma/CMakeLists.txt #828819:828820
@@ -11,19 +11,19 @@
 SET(SRC_CPP src/plasma.cpp src/plasmahandlers.cpp)
 
 SET(SRC_CS src/AssemblyInfo.cs 
+ src/PlasmaScripting_DataEngine.cs
+ src/PlasmaScripting_Applet.cs
+ src/PlasmaScripting_QGraphicsWidget.cs
  src/Plasma.cs 
 plasma/*.cs)
 
 SET(SRC_PLASMASCRIPTING src/PlasmaScripting_Applet.cs)
 
 SET(SRC_PLASMASCRIPTENGINEKIMONO_APPLET
-    src/PlasmaScriptengineKimono_Applet.cs
-    src/PlasmaScripting_Applet.cs
-    src/PlasmaScripting_QGraphicsWidget.cs)
+    src/PlasmaScriptengineKimono_Applet.cs)
 
 SET(SRC_PLASMASCRIPTENGINEKIMONO_DATAENGINE
-    src/PlasmaScriptengineKimono_DataEngine.cs
-    src/PlasmaScripting_DataEngine.cs)
+    src/PlasmaScriptengineKimono_DataEngine.cs)
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/smoke 
 	${CMAKE_CURRENT_SOURCE_DIR}/../qyoto/src ${QT_INCLUDES})
--- trunk/KDE/kdebindings/csharp/plasma/ChangeLog #828819:828820
@@ -1,3 +1,9 @@
+2008-07-06  Arno Rehn  <arno at arnorehn.de>
+
+	* Moved the PlasmaScripting.* classes back into the main plasma assembly,
+	  since we can't reference Applet.dll and DataEngine.dll for C# Plasma
+	  plugins.
+
 2008-07-06  Richard Dale  <richard.j.dale at gmail.com>
 * Add a PlasmaScripting.QGraphicsWidget class with all the public methods in
   the QGraphicsWidget/QGraphicsItem/QGraphicsLayoutItem heirarchy implemented
--- trunk/KDE/kdebindings/csharp/plasma/src/PlasmaScriptengineKimono_Applet.cs #828819:828820
@@ -86,110 +86,121 @@
         private void SetUpEventHandlers() {
             Type[] paramTypes = new Type[1];
             MethodInfo eventHandler = null;
+            Assembly assembly = null;
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneContextMenuEvent");
+            foreach(Assembly a in AppDomain.CurrentDomain.GetAssemblies()) {
+                if (a.FullName.StartsWith("qt-dotnet"))
+                    assembly = a;
+            }
+            if (assembly == null) {
+                // shouldn't happen
+                Console.WriteLine("Couldn't find qt-dotnet assembly!");
+                return;
+            }
+
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneContextMenuEvent");
             eventHandler = appletType.GetMethod("ContextMenuEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneContextMenu] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneDragDropEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneDragDropEvent");
             eventHandler = appletType.GetMethod("DragEnterEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneDragEnter] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneDragDropEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneDragDropEvent");
             eventHandler = appletType.GetMethod("DragLeaveEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneDragLeave] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneDragDropEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneDragDropEvent");
             eventHandler = appletType.GetMethod("DragMoveEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneDragMove] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneDragDropEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneDragDropEvent");
             eventHandler = appletType.GetMethod("DropEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneDrop] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QFocusEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QFocusEvent");
             eventHandler = appletType.GetMethod("FocusInEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.FocusIn] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QFocusEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QFocusEvent");
             eventHandler = appletType.GetMethod("FocusOutEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.FocusOut] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneHoverEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneHoverEvent");
             eventHandler = appletType.GetMethod("HoverEnterEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneHoverEnter] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneHoverEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneHoverEvent");
             eventHandler = appletType.GetMethod("HoverMoveEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneHoverMove] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneHoverEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneHoverEvent");
             eventHandler = appletType.GetMethod("HoverLeaveEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneHoverLeave] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QKeyEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QKeyEvent");
             eventHandler = appletType.GetMethod("KeyPressEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.KeyPress] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QKeyEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QKeyEvent");
             eventHandler = appletType.GetMethod("KeyReleaseEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.KeyRelease] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneMouseEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneMouseEvent");
             eventHandler = appletType.GetMethod("MousePressEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneMousePress] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneMouseEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneMouseEvent");
             eventHandler = appletType.GetMethod("MouseMoveEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneMouseMove] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneMouseEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneMouseEvent");
             eventHandler = appletType.GetMethod("MouseReleaseEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneMouseRelease] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneMouseEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneMouseEvent");
             eventHandler = appletType.GetMethod("MouseDoubleClickEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneMouseDoubleClick] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QGraphicsSceneWheelEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QGraphicsSceneWheelEvent");
             eventHandler = appletType.GetMethod("WheelEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.GraphicsSceneWheel] = eventHandler;
             }
 
-            paramTypes[0] = Type.GetType("Qyoto.QInputMethodEvent");
+            paramTypes[0] = assembly.GetType("Qyoto.QInputMethodEvent");
             eventHandler = appletType.GetMethod("InputMethodEvent", paramTypes);
             if (eventHandler != null) {
                 eventHandlers[QEvent.TypeOf.InputMethod] = eventHandler;



More information about the Kde-bindings mailing list