changeset 37:8022ef40f110

svg package
author eldar
date Sat, 16 May 2009 21:33:50 +0000
parents 0f7c514f076e
children 08631ce8e46a
files CMakeLists.txt Makefile build/svg.makefile build/svg.txt generator/cppimplgenerator.cpp generator/dgenerator.cpp generator/typesystem_svg-common.xml generator/typesystem_svg-java.xml generator/typesystem_svg.xml generator/typesystem_xml-java.xml
diffstat 10 files changed, 36 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Sat May 16 20:48:20 2009 +0000
+++ b/CMakeLists.txt	Sat May 16 21:33:50 2009 +0000
@@ -12,7 +12,7 @@
 option(BUILD_EXAMPLES "Build examples" "ON")
 option(GENERATE_DI_FILES "Generate *.di files with DC -H command" "OFF")
 
-set(all_packages Core Gui OpenGL Xml) ## TODO: Loading.
+set(all_packages Core Gui OpenGL Xml Svg) ## TODO: Loading.
 
 
 ## Strip utility.
--- a/Makefile	Sat May 16 20:48:20 2009 +0000
+++ b/Makefile	Sat May 16 21:33:50 2009 +0000
@@ -53,7 +53,7 @@
 NAME_PREFIX = qtd
 endif
 ifndef $(PACKAGES)
-PACKAGES = core gui opengl xml
+PACKAGES = core gui opengl xml svg
 endif
 LIB_PREFIX = lib
 CC_INCLUDE += include $(QTDIR_INC) $(QTDIR_INC)$(SL)Qt $(QTDIR_INC)$(SL)QtCore $(QTDIR_INC)$(SL)QtGui $(QTDIR_INC)$(SL)QtOpenGL $(QTDIR_INC)$(SL)QtSvg
@@ -135,7 +135,7 @@
 	cd generator && qmake && $(MAKE)
 
 dgen:  make_gen
-	cd generator && $(GEN) $(GEN_OPT) --d-target=$(D_TARGET) --output-directory=../ qtjambi_masterinclude.h build_xml.txt
+	cd generator && $(GEN) $(GEN_OPT) --d-target=$(D_TARGET) --output-directory=../ qtjambi_masterinclude.h build_svg.txt
 ## DGenerator ## end
 
 mkdir:
--- a/build/svg.makefile	Sat May 16 20:48:20 2009 +0000
+++ b/build/svg.makefile	Sat May 16 21:33:50 2009 +0000
@@ -16,5 +16,8 @@
 ## Classes.
 ## TODO: use list that generated by dgen.
 svg_classes = \
-	QSvgWidget \
-	QSvgRenderer
\ No newline at end of file
+    ArrayOps \
+    QGraphicsSvgItem \
+    QSvgGenerator \
+    QSvgRenderer \
+    QSvgWidget
\ No newline at end of file
--- a/build/svg.txt	Sat May 16 20:48:20 2009 +0000
+++ b/build/svg.txt	Sat May 16 21:33:50 2009 +0000
@@ -1,6 +1,8 @@
-set(link_cpp cpp_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} )
+set(required Core Gui Xml)
 
 set(classes
-	QSvgWidget
-	QSvgRenderer
+    QGraphicsSvgItem
+    QSvgGenerator
+    QSvgRenderer
+    QSvgWidget
   )
\ No newline at end of file
--- a/generator/cppimplgenerator.cpp	Sat May 16 20:48:20 2009 +0000
+++ b/generator/cppimplgenerator.cpp	Sat May 16 21:33:50 2009 +0000
@@ -595,7 +595,7 @@
       << "#include \"ArrayOps_qt_core.h\"" << endl;
 
     // qtd2 hack!!
-    if (java_class->package() == "qt.gui")
+    if (java_class->package() == "qt.svg")
         s << "#include \"ArrayOps_qt_gui.h\"" << endl;
 
     QString pkg_name = QString(java_class->package()).replace(".", "_");
--- a/generator/dgenerator.cpp	Sat May 16 20:48:20 2009 +0000
+++ b/generator/dgenerator.cpp	Sat May 16 21:33:50 2009 +0000
@@ -3222,16 +3222,20 @@
         {
             bool hasParentArg = false;
             AbstractMetaArgumentList arguments = d_function->arguments();
+            int arg_index = 0;
             for (int i=0; i<arguments.count(); ++i) {
                 const AbstractMetaArgument *arg = arguments.at(i);
-                if (arg->argumentName() == "parent_")
+                if (arg->argumentName().contains("parent", Qt::CaseInsensitive)) {
+                    arg_index = i;
                     hasParentArg = true;
+                }
             }
 
+            const AbstractMetaArgument *arg = arguments.at(arg_index);
 //            QString ctor_call = d_function->implementingClass()->name() == "QObject"? "this" : "super";
             QString ctor_call = "this";
             if (hasParentArg) {
-                s << INDENT << "bool gc_managed = parent_ is null ? true : false;" << endl
+                s << INDENT << "bool gc_managed = " << arg->argumentName() << " is null ? true : false;" << endl
                   << INDENT << ctor_call << "(__qt_return_value, gc_managed);" << endl;
             } else {
                 s << INDENT << ctor_call << "(__qt_return_value, true);" << endl;
--- a/generator/typesystem_svg-common.xml	Sat May 16 20:48:20 2009 +0000
+++ b/generator/typesystem_svg-common.xml	Sat May 16 21:33:50 2009 +0000
@@ -39,6 +39,6 @@
     <modify-function signature="resetMatrix()" remove="all"/>
     <modify-function signature="sceneMatrix()const" remove="all"/>
     <modify-function signature="setMatrix(QMatrix, bool)" remove="all"/>
-  </object-type>
+ </object-type>
 
 </typesystem>
--- a/generator/typesystem_svg-java.xml	Sat May 16 20:48:20 2009 +0000
+++ b/generator/typesystem_svg-java.xml	Sat May 16 21:33:50 2009 +0000
@@ -1,4 +1,4 @@
-<typesystem package="qt.svg" default-superclass="qt.QtJambiObject">
+<typesystem package="qt.svg" default-superclass="QtDObject">
     <inject-code>
         qt.Utilities.loadQtLibrary("QtXml");
         qt.Utilities.loadQtLibrary("QtGui");
--- a/generator/typesystem_svg.xml	Sat May 16 20:48:20 2009 +0000
+++ b/generator/typesystem_svg.xml	Sat May 16 21:33:50 2009 +0000
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<typesystem package="qt.svg" default-superclass="qt.QtJambiObject">
+<typesystem package="qt.svg" default-superclass="QtDObject">
 <inject-code>
         qt.Utilities.loadQtLibrary("QtXml");
         qt.Utilities.loadQtLibrary("QtGui");
@@ -48,7 +48,7 @@
     <modify-function signature="resetMatrix()" remove="all"/>
     <modify-function signature="sceneMatrix()const" remove="all"/>
     <modify-function signature="setMatrix(QMatrix, bool)" remove="all"/>
-  
+ 
         <modify-function signature="setGroup(QGraphicsItemGroup*)">
             <modify-argument index="1">
                 <!-- Handled by injected code in QGraphicsItem -->
@@ -61,7 +61,7 @@
                 <reference-count action="ignore"/>
             </modify-argument>
         </modify-function>
-        <modify-function signature="setSharedRenderer(QSvgRenderer*)">
+<!--        <modify-function signature="setSharedRenderer(QSvgRenderer*)">
             <modify-argument index="1">
                 <define-ownership class="java" owner="c++"/>
             </modify-argument>
@@ -69,23 +69,23 @@
                 QSvgRenderer oldRenderer = renderer();
             </inject-code>
             <inject-code position="end">
-            if (oldRenderer != null)
+            if (oldRenderer !is null)
                 oldRenderer.reenableGarbageCollection();
             </inject-code>
         </modify-function>
         <modify-function signature="QGraphicsSvgItem(QGraphicsItem*)">
             <inject-code position="end">
                 <argument-map index="1" meta-name="%1"/>
-            if (%1 != null) disableGarbageCollection();
+            if (%1 !is null) disableGarbageCollection();
             </inject-code>
         </modify-function>
         <modify-function signature="QGraphicsSvgItem(const QString &amp;,QGraphicsItem*)">
             <inject-code position="end">
                 <argument-map index="2" meta-name="%2"/>
-            if (%2 != null) disableGarbageCollection();
+            if (%2 !is null) disableGarbageCollection();
             </inject-code>
         </modify-function>
-
+-->
     </object-type>
 
 </typesystem>
--- a/generator/typesystem_xml-java.xml	Sat May 16 20:48:20 2009 +0000
+++ b/generator/typesystem_xml-java.xml	Sat May 16 21:33:50 2009 +0000
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
-<typesystem package="com.trolltech.qt.xml" default-superclass="com.trolltech.qt.QtJambiObject">
+<typesystem package="qt.xml" default-superclass="qt.QtJambiObject">
     <inject-code>
-        com.trolltech.qt.Utilities.loadQtLibrary("QtXml");
+        qt.Utilities.loadQtLibrary("QtXml");
     </inject-code>
 
 
@@ -10,9 +10,9 @@
             <import-file name="typesystem_xml-java.java" quote-after-line="class QDomDocument___" quote-before-line="}// class"/>
         </inject-code>
         <extra-includes>
-            <include file-name="com.trolltech.qt.QNativePointer.Type" location="java"/>
-            <include file-name="com.trolltech.qt.core.QIODevice" location="java"/>
-            <include file-name="com.trolltech.qt.core.QByteArray" location="java"/>
+            <include file-name="qt.QNativePointer.Type" location="java"/>
+            <include file-name="qt.core.QIODevice" location="java"/>
+            <include file-name="qt.core.QByteArray" location="java"/>
         </extra-includes>
 
 
@@ -188,7 +188,7 @@
             <import-file name="typesystem_xml-java.java" quote-after-line="class QXmlNamespaceSupport___" quote-before-line="}// class"/>
         </inject-code>
         <extra-includes>
-            <include file-name="com.trolltech.qt.QNativePointer" location="java"/>
+            <include file-name="qt.QNativePointer" location="java"/>
         </extra-includes>
         <modify-function signature="processName(QString,bool,QString&amp;,QString&amp;)const">
             <access modifier="private"/>
@@ -343,7 +343,7 @@
                 </conversion-rule>
             </modify-argument>
             <modify-argument index="return">
-                <replace-type modified-type="com.trolltech.qt.xml.QXmlEntityResolver$ResolvedEntity" />
+                <replace-type modified-type="qt.xml.QXmlEntityResolver$ResolvedEntity" />
                 <conversion-rule class="native">
                     jobject %out = qtjambi_to_resolvedentity(__jni_env, %in, inputSourceHolder);
                 </conversion-rule>