changeset 190:a1b48a630f73

D2 support, simple stuff works now
author eldar
date Sun, 12 Jul 2009 20:51:37 +0000
parents 37b419197d4b
children a212c97edcd2
files Makefile demos/interview/main.d demos/interview/model.d examples/tutorials/tutorial/t1/build.sh examples/tutorials/tutorial/t1/main.d examples/tutorials/tutorial/t3/build.sh examples/tutorials/tutorial/t3/main.d examples/tutorials/tutorial/t6/build.sh examples/tutorials/tutorial/t6/main.d generator/cppimplgenerator.cpp generator/typesystem_gui-java.java qt/d2/qt/Signal.d qt/d2/qt/core/QModelIndex.d
diffstat 13 files changed, 42 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sun Jul 12 19:45:29 2009 +0000
+++ b/Makefile	Sun Jul 12 20:51:37 2009 +0000
@@ -56,7 +56,7 @@
 NAME_PREFIX = qtd
 endif
 ifndef $(PACKAGES)
-PACKAGES = core
+PACKAGES = core gui
 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
@@ -152,7 +152,7 @@
 	cd generator && qmake && $(MAKE)
 
 dgen:  make_gen
-	cd generator && $(GEN) $(GEN_OPT) --d-target=$(D_TARGET) --output-directory=../ qtjambi_masterinclude.h build_core.txt
+	cd generator && $(GEN) $(GEN_OPT) --d-target=$(D_TARGET) --output-directory=../ qtjambi_masterinclude.h build_gui.txt
 ## DGenerator ## end
 
 mkdir:
--- a/demos/interview/main.d	Sun Jul 12 19:45:29 2009 +0000
+++ b/demos/interview/main.d	Sun Jul 12 20:51:37 2009 +0000
@@ -34,8 +34,10 @@
 ** contact the sales department at qt-sales@nokia.com.
 **
 ****************************************************************************/
-
-import model;
+version(D_Version2)
+    import model_d2;
+else
+    import model;
 
 import qt.gui.QApplication;
 import qt.gui.QItemSelectionModel;
@@ -48,7 +50,7 @@
 import qt.gui.QIcon;
 import qt.gui.QPixmap;
 
-int main(char[][] args)
+int main(string[] args)
 {
     scope app = new QApplication(args);
     scope page = new QSplitter;
--- a/demos/interview/model.d	Sun Jul 12 19:45:29 2009 +0000
+++ b/demos/interview/model.d	Sun Jul 12 20:51:37 2009 +0000
@@ -48,18 +48,17 @@
 import tango.core.Array;
 import Integer = tango.text.convert.Integer;
 
-import tango.io.Stdout;
-
-    class Node
+    
+class Node
+{
+    this(Node parent_ = null)
     {
-        this(Node parent_ = null)
-        {
-            parent = parent_;
-        }
+        parent = parent_;
+    }
         
-        Node parent;
-        Node[] children;
-    }
+    Node parent;
+    Node[] children;
+}
     
 class Model : QAbstractItemModel
 {
--- a/examples/tutorials/tutorial/t1/build.sh	Sun Jul 12 19:45:29 2009 +0000
+++ b/examples/tutorials/tutorial/t1/build.sh	Sun Jul 12 20:51:37 2009 +0000
@@ -1,3 +1,3 @@
 #! /bin/bash
 
-dmd main.d -I../../../../ -I../../../../qt/d1 -L-L../../../../lib -L-lqtdgui -L-lqtdcore -L-lQtCore -L-lQtGui -oft1
+dmd main.d -I../../../../ -I../../../../qt/d2 -L-L../../../../lib -L-lqtdgui -L-lqtdcore -L-lQtCore -L-lQtGui -oft1
--- a/examples/tutorials/tutorial/t1/main.d	Sun Jul 12 19:45:29 2009 +0000
+++ b/examples/tutorials/tutorial/t1/main.d	Sun Jul 12 20:51:37 2009 +0000
@@ -38,7 +38,7 @@
 import qt.gui.QApplication;
 import qt.gui.QPushButton;
 
-int main(char[][] args)
+int main(string[] args)
 {
     QApplication app = new QApplication(args);
     QPushButton hello = new QPushButton("Hello world!");
--- a/examples/tutorials/tutorial/t3/build.sh	Sun Jul 12 19:45:29 2009 +0000
+++ b/examples/tutorials/tutorial/t3/build.sh	Sun Jul 12 20:51:37 2009 +0000
@@ -1,3 +1,3 @@
 #! /bin/bash
 
-dmd main.d -I../../../../ -I../../../../qt/d1 -L-L../../../../lib -L-lqtdgui -L-lqtdcore -L-lQtCore -L-lQtGui -oft3
+dmd main.d -I../../../../ -I../../../../qt/d2 -L-L../../../../lib -L-lqtdgui -L-lqtdcore -L-lQtCore -L-lQtGui -oft3
--- a/examples/tutorials/tutorial/t3/main.d	Sun Jul 12 19:45:29 2009 +0000
+++ b/examples/tutorials/tutorial/t3/main.d	Sun Jul 12 20:51:37 2009 +0000
@@ -40,9 +40,8 @@
 import qt.gui.QPushButton;
 import qt.gui.QWidget;
 
-import tango.io.Stdout;
 
-int main(char[][] args)
+int main(string[] args)
 {
     QApplication app = new QApplication(args);
     QWidget window = new QWidget();
--- a/examples/tutorials/tutorial/t6/build.sh	Sun Jul 12 19:45:29 2009 +0000
+++ b/examples/tutorials/tutorial/t6/build.sh	Sun Jul 12 20:51:37 2009 +0000
@@ -1,3 +1,3 @@
 #! /bin/bash
 
-dmd main.d -I../../../../ -I../../../../qt/d1 -L-L../../../../lib -L-lqtdgui -L-lqtdcore -L-lQtCore -L-lQtGui -oft6
+dmd main.d -I../../../../ -I../../../../qt/d2 -L-L../../../../lib -L-lqtdgui -L-lqtdcore -L-lQtCore -L-lQtGui -oft6
--- a/examples/tutorials/tutorial/t6/main.d	Sun Jul 12 19:45:29 2009 +0000
+++ b/examples/tutorials/tutorial/t6/main.d	Sun Jul 12 20:51:37 2009 +0000
@@ -93,7 +93,7 @@
 	}
 }
 
-int main(char[][] args)
+int main(string[] args)
 {
     auto app = new QApplication(args);
     auto widget = new MyWidget;
--- a/generator/cppimplgenerator.cpp	Sun Jul 12 19:45:29 2009 +0000
+++ b/generator/cppimplgenerator.cpp	Sun Jul 12 20:51:37 2009 +0000
@@ -3716,13 +3716,15 @@
         else
             return d_name + " "+ QString(java_type->actualIndirections(), '*');
     } else if (java_type->isNativePointer()) {
-        if (java_type->typeEntry()->isValue())
+        if (java_type->typeEntry()->isStructInD() && dVersion == 2 && java_type->isConstant() && d_export)
+            return "const(" + d_name + QString(java_type->indirections()-1, '*') + ")*";
+        else if (java_type->typeEntry()->isValue())
             return "void*";
         else if (java_type->typeEntry()->isEnum() && d_export)
             return "int" + QString(java_type->indirections(), '*');
         else {
             if (java_type->isConstant() && dVersion == 2 && d_export)
-                return "const (" + d_name + ")" + QString(java_type->indirections(), '*');
+                return "const (" + d_name + QString(java_type->indirections(), '*') + ")";
             else
                 return d_name + QString(java_type->indirections(), '*');
         }
--- a/generator/typesystem_gui-java.java	Sun Jul 12 19:45:29 2009 +0000
+++ b/generator/typesystem_gui-java.java	Sun Jul 12 20:51:37 2009 +0000
@@ -293,7 +293,7 @@
 class QImage___ extends QImage {
     private import qt.qtd.Str;
 
-    public this(in string[] xpm) {
+    public this(string[] xpm) {
         this(toStringzArray(xpm));
     }
 /*
@@ -479,7 +479,7 @@
 
 	private import qt.qtd.Str;
 
-        public this(in string[] xpm) {
+    public this(string[] xpm) {
 		this(toStringzArray(xpm));
 	}
 	
--- a/qt/d2/qt/Signal.d	Sun Jul 12 19:45:29 2009 +0000
+++ b/qt/d2/qt/Signal.d	Sun Jul 12 20:51:37 2009 +0000
@@ -88,9 +88,9 @@
 {
     void* funcptr;
 
-    static typeof(*this) opCall(R, A...)(R function(A) fn)
+    static typeof(this) opCall(R, A...)(R function(A) fn)
     {
-        typeof(*this) r;
+        typeof(this) r;
         r.funcptr = fn;
         return r;
     }
@@ -121,9 +121,9 @@
     void* context;
     void* funcptr;
 
-    static typeof(*this) opCall(R, A...)(R delegate(A) dg)
+    static typeof(this) opCall(R, A...)(R delegate(A) dg)
     {
-        typeof(*this) r;
+        typeof(this) r;
         r.context = dg.ptr;
         r.funcptr = dg.funcptr;
         return r;
@@ -692,7 +692,7 @@
     // Adjusts signal arguments and calls the slot. S - slot signature, A - signal arguments
     private void invokeSlot(S, Receiver, A...)(Receiver r, A args)
     {
-        r.get!(S)()(args[0..ParameterTupleOf!(S).length]);
+        r.get!(S)()(args[0..ParameterTypeTuple!(S).length]);
     }
 
     void blockSignals()
@@ -769,14 +769,14 @@
 
 template CheckSlot(Slot, A...)
 {
-    static assert(ParameterTupleOf!(Slot).length <= A.length, "Slot " ~ ParameterTypeTuple!(Slot).stringof ~
+    static assert(ParameterTypeTuple!(Slot).length <= A.length, "Slot " ~ ParameterTypeTuple!(Slot).stringof ~
         " has more prameters than signal " ~ A.stringof);
     alias CheckSlotImpl!(Slot, 0, A) check;
 }
 
 template CheckSlotImpl(Slot, int i, A...)
 {
-    alias ParameterTupleOf!(Slot) SlotArgs;
+    alias ParameterTypeTuple!(Slot) SlotArgs;
     static if (i < SlotArgs.length)
     {
         static assert (is(SlotArgs[i] : A[i]), "Argument " ~ ToString!(i) ~
--- a/qt/d2/qt/core/QModelIndex.d	Sun Jul 12 19:45:29 2009 +0000
+++ b/qt/d2/qt/core/QModelIndex.d	Sun Jul 12 20:51:37 2009 +0000
@@ -22,8 +22,8 @@
         return __qtd_QModelIndex_child_int_int(&this, row, column);
     }
 
-    public final int column() {
-        return __qtd_QModelIndex_column(&this);
+    public final int column() const {
+        return __qtd_QModelIndex_column(cast(void*)&this);
     }
 
     public final QVariant data(int role = 0) {
@@ -39,7 +39,7 @@
         return __qtd_QModelIndex_internalId(&this);
     }
 
-    public final void* internalPointer() {
+    public final const (void*) internalPointer() const {
         //return __qtd_QModelIndex_internalPointer(&this);
         return p;
     }
@@ -48,8 +48,8 @@
         return cast(Object) p;
     }
 
-    public final bool isValid() {
-        return __qtd_QModelIndex_isValid(&this);
+    public final bool isValid() const {
+        return __qtd_QModelIndex_isValid(cast(void*)&this);
     }
 
     public final QAbstractItemModel model() {
@@ -73,8 +73,8 @@
         return __qtd_QModelIndex_parent(&this);
     }
 
-    public final int row() {
-        return __qtd_QModelIndex_row(&this);
+    public final int row() const {
+        return __qtd_QModelIndex_row(cast(void*)&this);
     }
 
     public final QModelIndex sibling(int row, int column) {