diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 90825e2392b2d70e43c7a25b8a3752299a933894 (patch) | |
tree | e33aa27f02b74604afbfd0ea4f1cfca8833d882a /qtsharp/src/uicsharp | |
download | tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'qtsharp/src/uicsharp')
-rw-r--r-- | qtsharp/src/uicsharp/Makefile.am | 21 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/tests/form1.ui | 43 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/tests/form10.ui | 131 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/tests/form2.ui | 138 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/tests/form3.ui | 206 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/tests/form4.ui | 224 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/tests/form5.ui | 450 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/tests/form6.ui | 167 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/tests/form7.ui | 339 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/tests/form8.ui | 75 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/tests/form9.ui | 211 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/uicsharp.build | 15 | ||||
-rw-r--r-- | qtsharp/src/uicsharp/uicsharp.cs | 934 |
13 files changed, 2954 insertions, 0 deletions
diff --git a/qtsharp/src/uicsharp/Makefile.am b/qtsharp/src/uicsharp/Makefile.am new file mode 100644 index 00000000..ac42d99c --- /dev/null +++ b/qtsharp/src/uicsharp/Makefile.am @@ -0,0 +1,21 @@ +all: uicsharp.exe + +uicsharp.exe: $(wildcard *.cs) + csant -D$(CSC_NAME)=$(CSC) -C $(CSC_NAME) + chmod 0755 $@ + +clean: + -rm uicsharp.exe + +distclean: clean + +install: uicsharp.exe + -$(MAKE) uninstall + -mkdir $(bindir) + install -o root -g root -m 0755 uicsharp.exe $(bindir)/uicsharp.exe + ln -s $(bindir)/uicsharp.exe $(bindir)/uicsharp + +uninstall: + -rm -rf $(bindir)/uicsharp.exe $(bindir)/uicsharp + +.PHONY: all clean install uninstall diff --git a/qtsharp/src/uicsharp/tests/form1.ui b/qtsharp/src/uicsharp/tests/form1.ui new file mode 100644 index 00000000..e5895a10 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form1.ui @@ -0,0 +1,43 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>Form1</class> +<widget class="QDialog"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit"> + <property name="name"> + <cstring>LineEdit1</cstring> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="text"> + <string>PushButton1</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>TextLabel1</string> + </property> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/qtsharp/src/uicsharp/tests/form10.ui b/qtsharp/src/uicsharp/tests/form10.ui new file mode 100644 index 00000000..50b27bb6 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form10.ui @@ -0,0 +1,131 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>Form2</class> +<widget class="QWidget"> + <property name="name"> + <cstring>Form2</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <widget class="QWidgetStack"> + <property name="name"> + <cstring>WidgetStack1</cstring> + </property> + <property name="geometry"> + <rect> + <x>70</x> + <y>80</y> + <width>357</width> + <height>301</height> + </rect> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox2</cstring> + </property> + <property name="text"> + <string>CheckBox2</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>RadioButton2</cstring> + </property> + <property name="text"> + <string>RadioButton2</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListView"> + <column> + <property name="text"> + <string>Column 1</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <item> + <property name="text"> + <string>New Item</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <property name="name"> + <cstring>ListView1</cstring> + </property> + </widget> + <widget class="QTable"> + <property name="name"> + <cstring>Table1</cstring> + </property> + <property name="numRows"> + <number>3</number> + </property> + <property name="numCols"> + <number>3</number> + </property> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>2</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTable"> + <property name="name"> + <cstring>Table2</cstring> + </property> + <property name="numRows"> + <number>3</number> + </property> + <property name="numCols"> + <number>3</number> + </property> + </widget> + </vbox> + </widget> + </widget> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/qtsharp/src/uicsharp/tests/form2.ui b/qtsharp/src/uicsharp/tests/form2.ui new file mode 100644 index 00000000..4d6545d5 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form2.ui @@ -0,0 +1,138 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>Form1</class> +<widget class="QDialog"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="title"> + <string>GroupBox1</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>CheckBox1</cstring> + </property> + <property name="text"> + <string>CheckBox1</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>CheckBox2</cstring> + </property> + <property name="text"> + <string>CheckBox2</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>CheckBox3</cstring> + </property> + <property name="text"> + <string>CheckBox3</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>CheckBox4</cstring> + </property> + <property name="text"> + <string>CheckBox4</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="1"> + <property name="name"> + <cstring>CheckBox5</cstring> + </property> + <property name="text"> + <string>CheckBox5</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="1"> + <property name="name"> + <cstring>CheckBox6</cstring> + </property> + <property name="text"> + <string>CheckBox6</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="1"> + <property name="name"> + <cstring>CheckBox7</cstring> + </property> + <property name="text"> + <string>CheckBox7</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="1"> + <property name="name"> + <cstring>CheckBox8</cstring> + </property> + <property name="text"> + <string>CheckBox8</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0"> + <property name="name"> + <cstring>CheckBox9</cstring> + </property> + <property name="text"> + <string>CheckBox9</string> + </property> + </widget> + </grid> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>Frame3</cstring> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit"> + <property name="name"> + <cstring>LineEdit1</cstring> + </property> + </widget> + <widget class="QListBox"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>ListBox1</cstring> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/qtsharp/src/uicsharp/tests/form3.ui b/qtsharp/src/uicsharp/tests/form3.ui new file mode 100644 index 00000000..2e77c2bd --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form3.ui @@ -0,0 +1,206 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>Form1</class> +<widget class="QDialog"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="title"> + <string>GroupBox1</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>CheckBox1</cstring> + </property> + <property name="text"> + <string>CheckBox1</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>CheckBox2</cstring> + </property> + <property name="text"> + <string>CheckBox2</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>CheckBox3</cstring> + </property> + <property name="text"> + <string>CheckBox3</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>CheckBox4</cstring> + </property> + <property name="text"> + <string>CheckBox4</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="1"> + <property name="name"> + <cstring>CheckBox5</cstring> + </property> + <property name="text"> + <string>CheckBox5</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="1"> + <property name="name"> + <cstring>CheckBox6</cstring> + </property> + <property name="text"> + <string>CheckBox6</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="1"> + <property name="name"> + <cstring>CheckBox7</cstring> + </property> + <property name="text"> + <string>CheckBox7</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="1"> + <property name="name"> + <cstring>CheckBox8</cstring> + </property> + <property name="text"> + <string>CheckBox8</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0"> + <property name="name"> + <cstring>CheckBox9</cstring> + </property> + <property name="text"> + <string>CheckBox9</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox2</cstring> + </property> + <property name="title"> + <string>GroupBox2</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="text"> + <string>PushButton1</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton2</cstring> + </property> + <property name="text"> + <string>PushButton2</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox3</cstring> + </property> + <property name="title"> + <string>GroupBox3</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton3</cstring> + </property> + <property name="text"> + <string>PushButton3</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton4</cstring> + </property> + <property name="text"> + <string>PushButton4</string> + </property> + </widget> + </hbox> + </widget> + </hbox> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>Frame3</cstring> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit"> + <property name="name"> + <cstring>LineEdit1</cstring> + </property> + </widget> + <widget class="QListBox"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>ListBox1</cstring> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/qtsharp/src/uicsharp/tests/form4.ui b/qtsharp/src/uicsharp/tests/form4.ui new file mode 100644 index 00000000..bb18f36e --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form4.ui @@ -0,0 +1,224 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>Form1</class> +<widget class="QDialog"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="title"> + <string>GroupBox1</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>CheckBox1</cstring> + </property> + <property name="text"> + <string>CheckBox1</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>CheckBox2</cstring> + </property> + <property name="text"> + <string>CheckBox2</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>CheckBox3</cstring> + </property> + <property name="text"> + <string>CheckBox3</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>CheckBox4</cstring> + </property> + <property name="text"> + <string>CheckBox4</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="1"> + <property name="name"> + <cstring>CheckBox5</cstring> + </property> + <property name="text"> + <string>CheckBox5</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="1"> + <property name="name"> + <cstring>CheckBox6</cstring> + </property> + <property name="text"> + <string>CheckBox6</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="1"> + <property name="name"> + <cstring>CheckBox7</cstring> + </property> + <property name="text"> + <string>CheckBox7</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="1"> + <property name="name"> + <cstring>CheckBox8</cstring> + </property> + <property name="text"> + <string>CheckBox8</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0"> + <property name="name"> + <cstring>CheckBox9</cstring> + </property> + <property name="text"> + <string>CheckBox9</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox2</cstring> + </property> + <property name="title"> + <string>GroupBox2</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="text"> + <string>PushButton1</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton2</cstring> + </property> + <property name="text"> + <string>PushButton2</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox3</cstring> + </property> + <property name="title"> + <string>GroupBox3</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton3</cstring> + </property> + <property name="text"> + <string>PushButton3</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox10</cstring> + </property> + <property name="text"> + <string>CheckBox10</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox11</cstring> + </property> + <property name="text"> + <string>CheckBox11</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </hbox> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>Frame3</cstring> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit"> + <property name="name"> + <cstring>LineEdit1</cstring> + </property> + </widget> + <widget class="QListBox"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>ListBox1</cstring> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/qtsharp/src/uicsharp/tests/form5.ui b/qtsharp/src/uicsharp/tests/form5.ui new file mode 100644 index 00000000..47cd7d91 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form5.ui @@ -0,0 +1,450 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>Form1</class> +<widget class="QMainWindow"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> +</widget> +<menubar> + <property name="name"> + <cstring>menubar</cstring> + </property> + <item text="&File" name="fileMenu"> + <action name="fileNewAction"/> + <action name="fileOpenAction"/> + <action name="fileSaveAction"/> + <action name="fileSaveAsAction"/> + <separator/> + <action name="filePrintAction"/> + <separator/> + <action name="fileExitAction"/> + </item> + <item text="&Edit" name="editMenu"> + <action name="editUndoAction"/> + <action name="editRedoAction"/> + <separator/> + <action name="editCutAction"/> + <action name="editCopyAction"/> + <action name="editPasteAction"/> + <separator/> + <action name="editFindAction"/> + </item> + <item text="&Help" name="helpMenu"> + <action name="helpContentsAction"/> + <action name="helpIndexAction"/> + <separator/> + <action name="helpAboutAction"/> + </item> +</menubar> +<toolbars> + <toolbar dock="2"> + <property name="name"> + <cstring>toolBar</cstring> + </property> + <property name="label"> + <string>Tools</string> + </property> + <action name="fileNewAction"/> + <action name="fileOpenAction"/> + <action name="fileSaveAction"/> + <action name="fileSaveAsAction"/> + <action name="filePrintAction"/> + <action name="fileExitAction"/> + <separator/> + <action name="editUndoAction"/> + <action name="editRedoAction"/> + </toolbar> +</toolbars> +<actions> + <action> + <property name="name"> + <cstring>fileNewAction</cstring> + </property> + <property name="iconSet"> + <iconset>image0</iconset> + </property> + <property name="text"> + <string>New</string> + </property> + <property name="menuText"> + <string>&New</string> + </property> + <property name="accel"> + <string>Ctrl+N</string> + </property> + </action> + <action> + <property name="name"> + <cstring>fileOpenAction</cstring> + </property> + <property name="iconSet"> + <iconset>image1</iconset> + </property> + <property name="text"> + <string>Open</string> + </property> + <property name="menuText"> + <string>&Open...</string> + </property> + <property name="accel"> + <string>Ctrl+O</string> + </property> + </action> + <action> + <property name="name"> + <cstring>fileSaveAction</cstring> + </property> + <property name="iconSet"> + <iconset>image2</iconset> + </property> + <property name="text"> + <string>Save</string> + </property> + <property name="menuText"> + <string>&Save</string> + </property> + <property name="accel"> + <string>Ctrl+S</string> + </property> + </action> + <action> + <property name="name"> + <cstring>fileSaveAsAction</cstring> + </property> + <property name="text"> + <string>Save As</string> + </property> + <property name="menuText"> + <string>Save &As...</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> + <action> + <property name="name"> + <cstring>filePrintAction</cstring> + </property> + <property name="iconSet"> + <iconset>image3</iconset> + </property> + <property name="text"> + <string>Print</string> + </property> + <property name="menuText"> + <string>&Print...</string> + </property> + <property name="accel"> + <string>Ctrl+P</string> + </property> + </action> + <action> + <property name="name"> + <cstring>fileExitAction</cstring> + </property> + <property name="text"> + <string>Exit</string> + </property> + <property name="menuText"> + <string>E&xit</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> + <action> + <property name="name"> + <cstring>editUndoAction</cstring> + </property> + <property name="iconSet"> + <iconset>image4</iconset> + </property> + <property name="text"> + <string>Undo</string> + </property> + <property name="menuText"> + <string>&Undo</string> + </property> + <property name="accel"> + <string>Ctrl+Z</string> + </property> + </action> + <action> + <property name="name"> + <cstring>editRedoAction</cstring> + </property> + <property name="iconSet"> + <iconset>image5</iconset> + </property> + <property name="text"> + <string>Redo</string> + </property> + <property name="menuText"> + <string>&Redo</string> + </property> + <property name="accel"> + <string>Ctrl+Y</string> + </property> + </action> + <action> + <property name="name"> + <cstring>editCutAction</cstring> + </property> + <property name="iconSet"> + <iconset>image6</iconset> + </property> + <property name="text"> + <string>Cut</string> + </property> + <property name="menuText"> + <string>&Cut</string> + </property> + <property name="accel"> + <string>Ctrl+X</string> + </property> + </action> + <action> + <property name="name"> + <cstring>editCopyAction</cstring> + </property> + <property name="iconSet"> + <iconset>image7</iconset> + </property> + <property name="text"> + <string>Copy</string> + </property> + <property name="menuText"> + <string>C&opy</string> + </property> + <property name="accel"> + <string>Ctrl+C</string> + </property> + </action> + <action> + <property name="name"> + <cstring>editPasteAction</cstring> + </property> + <property name="iconSet"> + <iconset>image8</iconset> + </property> + <property name="text"> + <string>Paste</string> + </property> + <property name="menuText"> + <string>&Paste</string> + </property> + <property name="accel"> + <string>Ctrl+V</string> + </property> + </action> + <action> + <property name="name"> + <cstring>editFindAction</cstring> + </property> + <property name="iconSet"> + <iconset>image9</iconset> + </property> + <property name="text"> + <string>Find</string> + </property> + <property name="menuText"> + <string>&Find...</string> + </property> + <property name="accel"> + <string>Ctrl+F</string> + </property> + </action> + <action> + <property name="name"> + <cstring>helpContentsAction</cstring> + </property> + <property name="text"> + <string>Contents</string> + </property> + <property name="menuText"> + <string>&Contents...</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> + <action> + <property name="name"> + <cstring>helpIndexAction</cstring> + </property> + <property name="text"> + <string>Index</string> + </property> + <property name="menuText"> + <string>&Index...</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> + <action> + <property name="name"> + <cstring>helpAboutAction</cstring> + </property> + <property name="text"> + <string>About</string> + </property> + <property name="menuText"> + <string>&About</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> +</actions> +<images> + <image name="image0"> + <data format="XPM.GZ" length="721">789cedd2b10ac2301405d03d5ff148b62056035241fc04c5511087f425a2432b681d44fc777ba329d6b47fe07d19dee50cc9904cd376b3229d896b6deb13131fed85b4bb95e57db75f3e8434869a93d3548e841c13d3fa5c79ecaad9d52404b540351e83caa833c6a03ad4798e41f5a86c30a816f510126ee94d14d52611fb8e2ad49070a4445ca4447ca4446ca444da07fecac7ffd2956ebe64f81ff4c873215e0583a9b0</data> + </image> + <image name="image1"> + <data format="XPM.GZ" length="691">789cad914d0ac2301085f739c5d0d915b11a140ae211149782b898448b2e5a41eb42c4bb9b9fa6a67644045f0299978f37134896c27ab5803413979aeaa3067da033a4bb6b59de36dbf95d245282d953182703910c41c3f254ed6d8da6c69193b5dada7c924b6fc9dac2c85b156c51b83eacfe41d0c89defc4dfa2dd7c37fc44b025a179043c4152a4b055f4365414ad0e8901fd94c1ae5e19441da9211c68e7f44098d3074d86019e70a0210c089958df7ffb31134fa13797a8</data> + </image> + <image name="image2"> + <data format="XPM.GZ" length="691">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022530543251d2e253d856405bffcbc54105b19c856360003103711c4b530b13082709340dc644310047193c1dcc424d314883958015846190b80ca24262a2721012087349964a030ba69c9c9303d403e9132087b68279388ecff4414193440948c32aa71d86470bb80863258a21b9a0eb0a7905a6b2e006d59a436</data> + </image> + <image name="image3"> + <data format="XPM.GZ" length="2509">789c7d944973db461085effa152cf54d956a932089a55239c896572d96bcc4b253390033186ea2488aa416a7f2dfd3db0cbd44e6d340f8f8def43406209e1c742ecf4f3b074ff6d69b7a33711d37ae6f3a077e3b9f3ffcf5f71fffeced675987fecab293edffb6b77fb1e9b8ced9e2ba65c08c00baf2117e2f5c86d02d99e196b9d7ed963df53f2ab3c47789258fa7c26564688d4bf30f23673de113e6ac1719ae9459e27f4d5c893f17ae126f8d2be3ebc87d9dff4e3904f317ccfd5ef23f28b3c45f26963c7e510ec1fc9570157dd81857967f883c90cd8635f3208b8c0b6596f863e17a500fd597fe8744c35afc1be33aef8bff5ad9b5e637cc7993f7f346fca571637c1fb9d0f99f9543b07ab2df453ff9723d0551a1f3d791cb8170573904f3a5bf725034e66f133be96fa44c1246799e4a573495e461a29cfcbbc8e64f8d9df96564f5519e876a1019668975fda05c593d5c25d67a6f945d6ef3bdb08b3ed491eba1e467c6561fcf229bff4ad9b5c6c7ccf530fa8089bdf8136596703fb1f800c23ee5ff548e3e7a636f3c8ddc68bd8ab91926066596b05c5fe359c285b2cf8de5f7ed7296f050b825d6f74763dc1a0f227bcdbf60f679e29789353f5666093f4facfe857208e63f156e93df8bdc16c223e358ff28b2f939735b240eca2ce1678983f0a57208e6bf150ec96f8d83f127e650b084cf85e5a32fdf9d10b0c6c6e44835c9631dfd9ff235b618925ad1e89779278af5750df7681ea40316d8111eef876a79ad977ae773d8257ec8efead629fdeb3ca4ba9ae6e11fcdbbef6aa72b7934ef695702eddf4e631a13d2f4c73cd599e115f533a639bbc173e6788d0b5cf23a314fe915dee01a37df698bb77887f7f8805ff190e64c342fb59fe2333ca2e373d30b7c89aff035bec1634a9e904ef1417faf78866ff1fc275de03b7c4fa3a1553e50fd8f78a2ef0bfcf43fe973bcc4cff805bb74d6a3de0e31b37c9f561fe090c6583a19612e9d1dd179417db1575237191eeafb172b9cd22a7d409a7bcc8f0c4e68f01900ef44090db8547f4ee9a966456732445083078f779a8756dfdf52f19b1cd59c699254e31c46d0703f30b6fa5239a5d27faabc22b78409de838316bdd51fd1377730a531a12bd363c949aa3d936f1a6821e8fda566aef8fe011d612eba860569495a9196721ebe7d7ed0c30dac491b58d2bd21c116b634bf25ddd2fd9dd9f3f6efef7bff0111915e41</data> + </image> + <image name="image4"> + <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c8563600020b13103711c4b530b1308270f5b082019251068344848c32b23808206494a1e23015890819653db8b81e44255c0659025d460fa70c6e3d78ec814b21b90d052422fb070540f50ebaf84196a9b5e6020011bc73cc</data> + </image> + <image name="image5"> + <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54103b11c8563600020b13105719c4b530b1308270f5b0027acb28278201a64c221c4084136132ca7011885c225c06c91890542256193d98a198327a386570ea49449581bb4d2f114d0624a08c230c50fd4f5cb80da04cad351700f7fd8672</data> + </image> + <image name="image6"> + <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c856360003103711c6b53002abc40a90649491482ac92863955146d6822ca387474619c9301419a03842825819245bd064129513b1cb242602512216994430d44bc4904984c8c1a5e032897a3019a8144c26518f800c92715864d0ec81ab4dc4701b924fb0850e8a4cad351700fbd07ccb</data> + </image> + <image name="image7"> + <data format="XPM.GZ" length="706">789c9d92cb0ac2301045f7f98aa1d915b1da8214c44f505c0ae26226b1e8a20a5a1722febb9924a5af58c19b40e77238a1842431ecb66b881371afb03a2b5027bc41ac1f65f9dc1f562f11a52998bd80793411d114146cae9723cfd2cc7266c395ea9aa75c15d74c65aad05c35d79c727215b91636f6d860c689f40910b4e92147d840b3be39d8416d877c860eb9af478d23919c4b8a7a0ed68eb628e4a04521c7fd46c07138e47448dbf1f32fc767e8d43735741af287d3ced83b782fc5075b18a5a5</data> + </image> + <image name="image8"> + <data format="XPM.GZ" length="736">789c7d92d10a82301486eff714c3dd49649984103d42d165105dcce3465d58507611d1bbb773d674aed93f85fd7efb183ab394ef771b9e66ecdecaf60c1c4ef2c6d3fad134cfc371fd62499e7373957c9e4c5832e5c0b7d78bc2b9307331a36055ae960556c05a16656e69e5aaa5355658c202965825566d62176b57b5a64da3f188c084841e0a29a5e831910ef8885e4854501922e8a6b923586a176a8e40051ec1e63b7d0267387c6738424775091d653f98565a858e26c110447107d1886350d4a1c41c3dea7864e87c37f3ce47fc3aee7cd5207ffe90f78a7d0007c6c175</data> + </image> + <image name="image9"> + <data format="XPM.GZ" length="2798">789cb5d5594f1b491007f0773e8545bda1d53ff81a7bb4da07830103b603b92059edc34cf78c0ff0812f3051befb5677554f56c24428d2aa78e0a7aeaeea6be0dd41e9f6aa573a78b7b75c25ab91299961b2281dd8f564b2fdfb9fbfbeefed572a25fe291f46a5cafe1f7bfbd7ab9229f567d3cc81fa0caa945d785f78c72ebc2f9dabb10bef9e73ade2c21913e77ae2c28f2fc48d6a947ab7c4b169d6bc8f9ca3aa0b3fbfaf4e35ff4c5cccdf8813db34de1def34e4c3881b3cc38fb7d5a918f78525ff46dcaca9576a23a627715cd3f53e8a131b7b63edecba69fd8d3af41b1496fa6d7153f78f86b8a86f0bcbfe9ec5493d16cfc5695dfad34c6d651ca9f7cffdbd173743fd441cd64f0f85a5fe489c6a3fd4d5613c0d4eeade43b189747c1b2ce3683abbeebadf5a702ae343716c743d53313f1febc7bfa843bf1371581f9d06ebf8581df257e2b01eba57675a5fea19177e7c109cfa712271aceba58938b13a6ec4a13fba62ee27f53fa9b51fe5c1ba7f7f1f71cd85f7545cdcf73ad8f8ef137762de9fd4ef898b7e51b0d63f52877e65b10de3c785657eacced4fe7b77b763236fab36fa3e1ec5a9d5f341b0e4d3526c42bd4ab0eee7505cf4fb28ce1aea6fc146fa7f76e6d3e115fafa5d7112cebf254eeb328e6a70967b9f8b437fba13db4ceb2fc5453f7f5ffcfac2795f046bbd0fe2a2df486c42bd2bb18dd46375e89f89b99fccf7ef2dadbbf0eea8add6bf16db4cbd1067b9de8fafc7b7a1ef13cf6213e50defadd846b9acff569c3574fe833ad7fa5fc57943cfdb9f9f894cd8cf93982748fdb9386f64dee4df97c978ff52ef4c9d69ff9938cff53cfdf7ec5627f5ae576f8fdfcf0721410ac391c222fb753e720c30c408638e3bdcf31c7a3d9fb3279862c631c70316586285f5ae1e727fd8e091f3e678c216cf68e108c768e3e4957ccb2b39e5fc337470ce71814b74d143ffe59ae4ff01ae7825d7f8c0753fe213d7ff8c2ffcfb0deccefc016ef115df380e51460555d4504784069aafe48f798f87885126a04a4409a564c8be92bfc115655cb94c395a34409d8634a231afe7c58ee5ef35d7bae3dc2eddd384a634a339c7032d90efcce7bba225ad38525aa3461b7ae478da75037a5f2758d196525ec93359aedde23882a563ae95edc8cf90529b4ee894c6bcf2844f66e2ce1239cf9afc7755c5fbc9b8479fdabcc71b3aa38ee4d039d7b9a04b1ecb5ebe677ea1964712ead2f9cf8aac1ecfd10a6f79ffdc7b4d7dee92bcfd7be1bd5ff29ccedbbf2f90dbfbfffefdfef873ef5fce01d04a</data> + </image> +</images> +<connections> + <connection> + <sender>fileNewAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>fileNew()</slot> + </connection> + <connection> + <sender>fileOpenAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>fileOpen()</slot> + </connection> + <connection> + <sender>fileSaveAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>fileSave()</slot> + </connection> + <connection> + <sender>fileSaveAsAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>fileSaveAs()</slot> + </connection> + <connection> + <sender>filePrintAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>filePrint()</slot> + </connection> + <connection> + <sender>fileExitAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>fileExit()</slot> + </connection> + <connection> + <sender>editUndoAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>editUndo()</slot> + </connection> + <connection> + <sender>editRedoAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>editRedo()</slot> + </connection> + <connection> + <sender>editCutAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>editCut()</slot> + </connection> + <connection> + <sender>editCopyAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>editCopy()</slot> + </connection> + <connection> + <sender>editPasteAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>editPaste()</slot> + </connection> + <connection> + <sender>editFindAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>editFind()</slot> + </connection> + <connection> + <sender>helpIndexAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>helpIndex()</slot> + </connection> + <connection> + <sender>helpContentsAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>helpContents()</slot> + </connection> + <connection> + <sender>helpAboutAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>helpAbout()</slot> + </connection> +</connections> +<slots> + <slot>fileNew()</slot> + <slot>fileOpen()</slot> + <slot>fileSave()</slot> + <slot>fileSaveAs()</slot> + <slot>filePrint()</slot> + <slot>fileExit()</slot> + <slot>editUndo()</slot> + <slot>editRedo()</slot> + <slot>editCut()</slot> + <slot>editCopy()</slot> + <slot>editPaste()</slot> + <slot>editFind()</slot> + <slot>helpIndex()</slot> + <slot>helpContents()</slot> + <slot>helpAbout()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/qtsharp/src/uicsharp/tests/form6.ui b/qtsharp/src/uicsharp/tests/form6.ui new file mode 100644 index 00000000..7e67784c --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form6.ui @@ -0,0 +1,167 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>MyDialog</class> +<widget class="QDialog"> + <property name="name"> + <cstring>MyDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>594</width> + <height>470</height> + </rect> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QSplitter"> + <property name="name"> + <cstring>Splitter1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <widget class="QListView"> + <column> + <property name="text"> + <string>Column 1</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <item> + <property name="text"> + <string>New Item</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <property name="name"> + <cstring>ListView1</cstring> + </property> + </widget> + <widget class="QIconView"> + <item> + <property name="text"> + <string>New Item</string> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + </item> + <property name="name"> + <cstring>IconView1</cstring> + </property> + </widget> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout5</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonHelp</cstring> + </property> + <property name="text"> + <string>&Help</string> + </property> + <property name="accel"> + <string>F1</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> +</widget> +<images> + <image name="image0"> + <data format="XPM.GZ" length="1347">789c7dd3c14ac4301405d07dbf22f4ed8a743ace0882f8098a4b415ca4c92475310a3a2e44fc777393a64df2dabed7452e1c6eb368778d787e7a10cdaefabac8cb9b126a909fa2d1dfe7f3cfcbebfd6f551fae857bf69dd8d75755dd0a251e3fde4f38933b53e707b10f518df18478e8b08803e271c21af1e6168b681165e7f688681055874594211a13a242347efc95da9688dad58946ca75e58d6be9e5ba0a46e92d351a952aa2d3b2495459989849f949546632b5688c32c65aeadde428ed0132da23306e4c5863f1ba017042738f6fc138a5fdbd0a135b2203ec7bca7b723022e23d19628601cb0d6f59e8612dce0c2b2641658fb5650b375a0795a2c2b8afcaaba4859ba852c4cda4364da9964daed64caa60c2475d9a590503c54d54d1d0a2096abb67541bf79955fc0debbfbbea1f81b84f0e</data> + </image> +</images> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>MyDialog</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>MyDialog</receiver> + <slot>reject()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/qtsharp/src/uicsharp/tests/form7.ui b/qtsharp/src/uicsharp/tests/form7.ui new file mode 100644 index 00000000..6cf51c06 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form7.ui @@ -0,0 +1,339 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>Form1</class> +<widget class="QDialog"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox3</cstring> + </property> + <property name="geometry"> + <rect> + <x>382</x> + <y>12</y> + <width>206</width> + <height>150</height> + </rect> + </property> + <property name="title"> + <string>GroupBox3</string> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton3</cstring> + </property> + <property name="geometry"> + <rect> + <x>11</x> + <y>30</y> + <width>82</width> + <height>26</height> + </rect> + </property> + <property name="text"> + <string>PushButton3</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox10</cstring> + </property> + <property name="geometry"> + <rect> + <x>100</x> + <y>21</y> + <width>94</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>CheckBox10</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox11</cstring> + </property> + <property name="geometry"> + <rect> + <x>100</x> + <y>46</y> + <width>94</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>CheckBox11</string> + </property> + </widget> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="geometry"> + <rect> + <x>12</x> + <y>12</y> + <width>202</width> + <height>150</height> + </rect> + </property> + <property name="title"> + <string>GroupBox1</string> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox1</cstring> + </property> + <property name="geometry"> + <rect> + <x>11</x> + <y>20</y> + <width>87</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>CheckBox1</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox2</cstring> + </property> + <property name="geometry"> + <rect> + <x>11</x> + <y>45</y> + <width>87</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>CheckBox2</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox3</cstring> + </property> + <property name="geometry"> + <rect> + <x>11</x> + <y>70</y> + <width>87</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>CheckBox3</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox4</cstring> + </property> + <property name="geometry"> + <rect> + <x>11</x> + <y>95</y> + <width>87</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>CheckBox4</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox5</cstring> + </property> + <property name="geometry"> + <rect> + <x>104</x> + <y>20</y> + <width>87</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>CheckBox5</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox6</cstring> + </property> + <property name="geometry"> + <rect> + <x>104</x> + <y>70</y> + <width>87</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>CheckBox6</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox7</cstring> + </property> + <property name="geometry"> + <rect> + <x>104</x> + <y>95</y> + <width>87</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>CheckBox7</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox8</cstring> + </property> + <property name="geometry"> + <rect> + <x>104</x> + <y>120</y> + <width>87</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>CheckBox8</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox9</cstring> + </property> + <property name="geometry"> + <rect> + <x>11</x> + <y>120</y> + <width>87</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>CheckBox9</string> + </property> + </widget> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox2</cstring> + </property> + <property name="geometry"> + <rect> + <x>220</x> + <y>12</y> + <width>156</width> + <height>150</height> + </rect> + </property> + <property name="title"> + <string>GroupBox2</string> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="geometry"> + <rect> + <x>11</x> + <y>20</y> + <width>134</width> + <height>26</height> + </rect> + </property> + <property name="text"> + <string>PushButton1</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton2</cstring> + </property> + <property name="geometry"> + <rect> + <x>11</x> + <y>52</y> + <width>134</width> + <height>26</height> + </rect> + </property> + <property name="text"> + <string>PushButton2</string> + </property> + </widget> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>Frame3</cstring> + </property> + <property name="geometry"> + <rect> + <x>11</x> + <y>169</y> + <width>578</width> + <height>300</height> + </rect> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <widget class="QLineEdit"> + <property name="name"> + <cstring>LineEdit1</cstring> + </property> + <property name="geometry"> + <rect> + <x>11</x> + <y>139</y> + <width>275</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QListBox"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>ListBox1</cstring> + </property> + <property name="geometry"> + <rect> + <x>292</x> + <y>11</y> + <width>275</width> + <height>278</height> + </rect> + </property> + </widget> + </widget> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/qtsharp/src/uicsharp/tests/form8.ui b/qtsharp/src/uicsharp/tests/form8.ui new file mode 100644 index 00000000..09f20bef --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form8.ui @@ -0,0 +1,75 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>Form1</class> +<widget class="QWidget"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="geometry"> + <rect> + <x>100</x> + <y>70</y> + <width>161</width> + <height>51</height> + </rect> + </property> + <property name="text"> + <string>PushButton1</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>RadioButton1</cstring> + </property> + <property name="geometry"> + <rect> + <x>100</x> + <y>130</y> + <width>96</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>RadioButton1</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox1</cstring> + </property> + <property name="geometry"> + <rect> + <x>60</x> + <y>170</y> + <width>131</width> + <height>41</height> + </rect> + </property> + <property name="font"> + <font> + <family>Century Schoolbook l [Urw]</family> + <pointsize>34</pointsize> + <bold>1</bold> + <italic>1</italic> + <underline>1</underline> + <strikeout>1</strikeout> + </font> + </property> + <property name="text"> + <string>CheckBox1</string> + </property> + </widget> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/qtsharp/src/uicsharp/tests/form9.ui b/qtsharp/src/uicsharp/tests/form9.ui new file mode 100644 index 00000000..b1e61488 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form9.ui @@ -0,0 +1,211 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>MyDialog1</class> +<widget class="QDialog"> + <property name="name"> + <cstring>MyDialog1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>528</width> + <height>368</height> + </rect> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QTabWidget"> + <property name="name"> + <cstring>tabWidget</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>Widget8</cstring> + </property> + <attribute name="title"> + <string>Tab</string> + </attribute> + <widget class="QComboBox"> + <property name="name"> + <cstring>ComboBox1</cstring> + </property> + <property name="geometry"> + <rect> + <x>27</x> + <y>75</y> + <width>61</width> + <height>21</height> + </rect> + </property> + </widget> + <widget class="QListBox"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>ListBox1</cstring> + </property> + <property name="geometry"> + <rect> + <x>187</x> + <y>65</y> + <width>88</width> + <height>60</height> + </rect> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="geometry"> + <rect> + <x>77</x> + <y>145</y> + <width>131</width> + <height>41</height> + </rect> + </property> + <property name="text"> + <string>TextLabel1</string> + </property> + </widget> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>Widget9</cstring> + </property> + <attribute name="title"> + <string>Tab</string> + </attribute> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListBox"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>ListBox2</cstring> + </property> + </widget> + <widget class="QTextEdit"> + <property name="name"> + <cstring>TextEdit1</cstring> + </property> + </widget> + </hbox> + </widget> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonHelp</cstring> + </property> + <property name="text"> + <string>&Help</string> + </property> + <property name="accel"> + <string>F1</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>MyDialog1</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>MyDialog1</receiver> + <slot>reject()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/qtsharp/src/uicsharp/uicsharp.build b/qtsharp/src/uicsharp/uicsharp.build new file mode 100644 index 00000000..d4bf8f5f --- /dev/null +++ b/qtsharp/src/uicsharp/uicsharp.build @@ -0,0 +1,15 @@ +<?xml version="1.0"> +<project name="Qt# UI Compiler" default="all"> + <target name="all"> + <compile output="uicsharp.exe" target="exe" optimize="true"> + <references> + <file name="../bindings/Qt.dll" /> + </references> + + <sources> + <includes name="*.cs" /> + + </sources> + </compile> + </target> +</project> diff --git a/qtsharp/src/uicsharp/uicsharp.cs b/qtsharp/src/uicsharp/uicsharp.cs new file mode 100644 index 00000000..a2553d23 --- /dev/null +++ b/qtsharp/src/uicsharp/uicsharp.cs @@ -0,0 +1,934 @@ +// A Qt compatible UI to C# generator. +// +// Copyright (C) 2002 Joseph Wenninger (jowenn@kde.org) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation. +// +// MODIFICATION: ONLY VERSION 2 IS VALID +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +using System.IO; +using System.Xml; +using System.Text; +using System.Collections; +using System.Reflection; +using Qt; + +namespace QtSharp { + + enum ElementType{LayoutType,WidgetType,PropertyType}; + + + public class Generator { + + void Usage () + { + Console.Write ( + "generator -f file.ui -m\n\n" + + " -f || --file file.ui The file to parse.\n"+ + " -m Create test main.\n\n" ); + } + + public static void Main (string[] args) + { + Generator gen = new Generator (args); + } + + + + XmlTextReader xtr; + TextWriter writer; + Hashtable fields; + String uifile; + bool createMain; + String generatedClass; + + Assembly qtAssembly; + + + public Generator (string[] args) + { + + + try { + String []dummyargs=new String[0]; + QApplication dummyapp=new QApplication(dummyargs,false); + qtAssembly=Assembly.GetAssembly(dummyapp.GetType()); +// qtAssembly=Assembly.Load("Qt.dll"); + Console.WriteLine("CodeBase="+qtAssembly.CodeBase); + } + catch (Exception e) { + Console.WriteLine(e.Message); + Console.WriteLine("exiting"); + return; + } + + uifile = null; + string outfile = null; + createMain=false; + generatedClass=null; + + int argc = args.Length; + for (int i = 0; i < argc; i++) { + string arg = args[i]; + if (arg.StartsWith("-") || arg.StartsWith("/")) { + switch (arg) { + case "-f": case "--file": + if ((i + 1) >= argc) { + Usage(); + return; + } + uifile = args[++i]; + continue; + case "-m": createMain=true; break; + default: + Usage (); + return; + } + } + } + if (uifile == null) { + Usage(); + return; + } + if (!uifile.EndsWith(".ui")) + { + Usage(); + return; + } + + if (!File.Exists (uifile)) { + Console.WriteLine ("\n No UI file at {0}\n", uifile); + return; + } + + outfile=uifile.Substring(0,uifile.Length-3); + outfile+=".cs"; + Console.WriteLine ("\n Converting {0} ==> {1}\n",uifile,outfile); + + + writer = new StreamWriter(outfile, false, new ASCIIEncoding()); + + writer.WriteLine("//**********************************************************************"); + writer.WriteLine("// This file has been generated by the uicsharp User Interface compiler"); + writer.WriteLine("// the input file has been: "+uifile); + writer.WriteLine("//**********************************************************************"); + writer.WriteLine("\nusing System;\nusing Qt;\n"); + fields= new Hashtable(); + createClass(); + writer.Flush(); + writer.Close(); + + } + + + XmlDocument uiDoc; + XmlElement widgetElement; + XmlElement menubarElement; + XmlElement toolbarsElement; + XmlElement actionsElement; + XmlElement imagesElement; + String className; + String defLayoutSpacing; + String defLayoutMargin; + String buddyList; + + + public void createClass () + { + menubarElement=null; + toolbarsElement=null; + actionsElement=null; + imagesElement=null; + defLayoutSpacing="1"; + defLayoutMargin="1"; + String classname=null; + String ancestor=null; + buddyList=""; + uiDoc=new XmlDocument(); + uiDoc.Load(uifile); + Console.WriteLine(uiDoc.DocumentElement.Name); + XmlElement dummy=uiDoc.DocumentElement.FirstChild as XmlElement; + while (dummy!=null) + { + Console.WriteLine("not null"); + switch (dummy.Name) { + case "class": className=dummy.InnerText; + break; + case "widget": widgetElement=dummy; + Console.WriteLine("Widget element has been found"); + break; + case "menubar": menubarElement=dummy; + break; + case "toolbars": toolbarsElement=dummy; + break; + case "actions": actionsElement=dummy; + break; + case "images": imagesElement=dummy; + break; + case "layoutdefaults": defLayoutSpacing=dummy.GetAttribute("spacing"); + defLayoutMargin=dummy.GetAttribute("margin"); + break; + } + dummy=dummy.NextSibling as XmlElement; + } + Console.WriteLine("class should be named: "+className); + writer.WriteLine("public class "+className+" : "+widgetElement.GetAttribute("class")+"\n{"); + addSubMembers(widgetElement); + addImagesMembers(); + addMenuBarMembers(); + addToolBarMembers(); + addActionMembers(); + + createConstructor(); +// setupSignalsSlots(); + + if (createMain) writeMain(); + writer.WriteLine("}"); + } + + + private void addImagesMembers() + { + if (imagesElement==null) return; + writer.WriteLine("\t//Images member fields"); + foreach (XmlNode node in imagesElement.ChildNodes) { + XmlElement el=node as XmlElement; + writer.WriteLine("\tString[] "+el.GetAttribute("name")+"_data={\"22 22 7 1\","+ + "\". c None\",\"# c #000000\",\"b c #2e2e2e\",\"c c #5c5c5c\","+ + "\"d c #878787\",\"e c #c2c2c2\",\"a c #ffffff\","+ + "\"......................\",\"....##########........\","+ +"\"....#aaaaaaa#b#.......\",\"....#aaaaaaa#cb#......\",\"....#aaaaaaa#dcb#.....\","+ +"\"....#aaaaaaa#edcb#....\",\"....#aaaaaaa#aedcb#...\",\"....#aaaaaaa#######...\","+ +"\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\","+ +"\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\","+ +"\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\","+ +"\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\",\"....###############...\","+ +"\"......................\",\"......................\"};"); + writer.WriteLine("\tQPixmap {0};",el.GetAttribute("name")); + + } + } + + private void addMenuBarMembers() + { + if (menubarElement==null) return; + writer.WriteLine("\t//Menubar member fields"); + writer.WriteLine("\t QMenuBar menubar;"); + foreach (XmlNode node in menubarElement.ChildNodes) { + XmlElement el=node as XmlElement; + if (el.Name=="item") { + writer.WriteLine("\tpublic QPopupMenu {0};",el.GetAttribute("name")); + } + } + } + + private void addActionMembers() + { + if (actionsElement==null) return; + writer.WriteLine("\t//Action member fields"); + foreach (XmlNode node in actionsElement.ChildNodes) { + XmlElement el=node as XmlElement; + if (el.Name=="action") { + writer.WriteLine("\tpublic QAction {0};",getName(el)); + } + } + } + + private void addToolBarMembers() + { + if (toolbarsElement==null) return; + writer.WriteLine("\t//Toolbar member fields"); + foreach (XmlNode node in toolbarsElement.ChildNodes) { + XmlElement el=node as XmlElement; + if (el.Name=="toolbar") { + writer.WriteLine("\tpublic QToolBar {0};",getName(el)); + } + } + } + + + + private void addSubMembers(XmlElement widget) + { + String [] membertypes={"widget","vbox","hbox","grid"}; + foreach (String membertype in membertypes) { + XmlNodeList nl=widget.GetElementsByTagName(membertype); + foreach (XmlNode submembernode in nl) { + if (submembernode.ParentNode!=widget) continue; // I think this is a workaround for a classlib bug + XmlElement submember=submembernode as XmlElement; + addSubMembers(submember); + if (submember.GetAttribute("class")=="QLayoutWidget") continue; //they are private + String membername=getName(submember); + if (membername==String.Empty) continue; + writer.WriteLine("\t"+submember.GetAttribute("class")+" "+membername+";"); + Console.WriteLine((submember as XmlElement).Name); + } + } + } + + private String getName(XmlElement element) + { + if (element.GetAttribute("uicsharp_name")!=String.Empty) + return element.GetAttribute("uicsharp_name"); + foreach(XmlNode property in element.ChildNodes) { + //if (property.ParentNode!=element) continue ;//see comment in addSubMembers + XmlElement prop=property as XmlElement; + if (prop.Name!="property") continue; + if (prop.GetAttribute("name")=="name") { + return (prop.FirstChild.InnerXml=="unnamed")?String.Empty:prop.FirstChild.InnerXml; + } + } + return String.Empty; + } + + + private void setupTabOrder() + { + foreach (XmlNode node in uiDoc.DocumentElement.ChildNodes) { + XmlElement element=node as XmlElement; + if (element.Name!="tabstops") continue; + writer.WriteLine("\n\t\t// tab stop order"); + foreach( XmlNode tsnode in element.ChildNodes) { + XmlElement ts=tsnode as XmlElement; + if (ts.NextSibling==null) break; + XmlElement ts1=ts.NextSibling as XmlElement; + writer.WriteLine("\t\tSetTabOrder({0},{1});",ts.InnerText,ts1.InnerText); + } + break; + } + + } + + private void setupConnections() + { + return; + foreach (XmlNode node in uiDoc.DocumentElement.ChildNodes) { + XmlElement element=node as XmlElement; + if (element.Name!="connections") continue; + writer.WriteLine("\n\t\t// setting up signal / slot connections"); + foreach( XmlNode connnode in element.ChildNodes) { + XmlElement conn=connnode as XmlElement; + + XmlElement tmp=conn.FirstChild as XmlElement; + String sender=tmp.InnerText; + sender=(sender==className)?"this":sender; + tmp=tmp.NextSibling as XmlElement; + String signal=tmp.InnerText; + + tmp=tmp.NextSibling as XmlElement; + String receiver=tmp.InnerText; + receiver=(receiver==className)?"this":receiver; + + tmp=tmp.NextSibling as XmlElement; + String slot=tmp.InnerText; + + writer.WriteLine("\t\tQObject.Connect({0},SIGNAL(\"{1}\"),{2},SLOT(\"{3}\"));", + sender,signal,receiver,slot); + } + break; + } + + } + + + private void createConstructor() + { + //Later handle non qwidgets better (dialog,....) + writer.WriteLine("\n\tpublic "+className+"(QWidget parent, String name) :base(parent, name) {"); + writer.WriteLine("\t\tif (name==null) SetName(\""+className+"\");"); + setupImages(); + setupActions(); + setupToolBars(); + setupMenuBar(); + constructEverything(); + setupConnections(); + setupTabOrder(); + setProperties(widgetElement); + + if (buddyList!=String.Empty) writer.WriteLine("\n\t\t//link buddies\n"+buddyList); + +// writer.WriteLine("\t\tinit();\n\t}"); + writer.WriteLine("\n\t}"); + } + + + private void setupImages() + { + if (imagesElement==null) return; + writer.WriteLine("\t//images"); + foreach (XmlNode node in imagesElement.ChildNodes) { + XmlElement el=node as XmlElement; + writer.WriteLine("\t\t{0}=new QPixmap({1}_data);", + el.GetAttribute("name"),el.GetAttribute("name")); + } + } + + private void setupActions() + { + if (actionsElement==null) return; + writer.WriteLine("\t//actions"); + foreach (XmlNode aNode in actionsElement.ChildNodes) { + XmlElement action=aNode as XmlElement; + if (action.Name!="action") continue; + writer.WriteLine("\t\t{0}= new QAction(this,\"{1}\");",getName(action),getName(action)); + foreach (XmlNode pNode in action.ChildNodes) { + XmlElement prop=pNode as XmlElement; + if (prop.Name!="property") continue; + if (prop.GetAttribute("name")=="name") continue; + writer.WriteLine(generateSetProperty(getName(action),"",prop)); + } + } + } + + + private void setupMenuBar() + { + if (menubarElement==null) return; + writer.WriteLine("\t//menubar"); + String barname=getName(menubarElement); + writer.WriteLine("\t\t{0}=new QMenuBar(this,\"{1}\");",barname,barname); + int count=0; + foreach (XmlNode mNode in menubarElement.ChildNodes) { + XmlElement item=mNode as XmlElement; + if (item.Name!="item") continue; + String submenu_name=item.GetAttribute("name"); + String submenu_text=stringify(item.GetAttribute("text")); + writer.WriteLine("\t\t{0}=new QPopupMenu(this);",submenu_name); + + foreach (XmlNode node in item.ChildNodes) { + XmlElement element=node as XmlElement; + if ((element.Name=="property") && (element.GetAttribute("name")!="name")) generateSetProperty(barname,"",element); + else if (element.Name=="separator") writer.WriteLine("\t\t{0}.InsertSeparator();",submenu_name); + else if (element.Name=="action") writer.WriteLine("\t\t{0}.AddTo({1});",element.GetAttribute("name"),submenu_name); + } + writer.WriteLine("\t\t{0}.InsertItem(\"{1}\",{2},{3});",barname, + submenu_text,submenu_name,count.ToString()); + count++; + + } + } + + private void setupToolBars() + { + if (toolbarsElement==null) return; + writer.WriteLine("\t//toolbars"); + foreach (XmlNode tNode in toolbarsElement.ChildNodes) { + XmlElement toolbar=tNode as XmlElement; + if (toolbar.Name!="toolbar") continue; + String varname=getName(toolbar); + writer.WriteLine("\t\t{0}=new QToolBar(this,\"{1}\");",varname,varname); + writer.WriteLine("\t\tthis.AddDockWindow({0},(Qt.Dock){1},false);",varname,toolbar.GetAttribute("dock")); + foreach (XmlNode node in toolbar.ChildNodes) { + XmlElement element=node as XmlElement; + if ((element.Name=="property") && (element.GetAttribute("name")!="name")) generateSetProperty(varname,"",element); + else if (element.Name=="separator") writer.WriteLine("\t\t{0}.AddSeparator();",varname); + else if (element.Name=="action") writer.WriteLine("\t\t{0}.AddTo({1});",element.GetAttribute("name"),varname); + } + } + } + + private ElementType elementType(XmlElement el) + { + switch (el.Name) { + case "widget": return (el.GetAttribute("class")=="QLayoutWidget")? + ElementType.LayoutType:ElementType.WidgetType; + case "vbox": return ElementType.LayoutType; + case "hbox": return ElementType.LayoutType; + case "grid": return ElementType.LayoutType; + case "spacer": return ElementType.LayoutType; + default: return ElementType.PropertyType; + } + } + + private void constructEverything() + { + foreach (XmlNode subNode in widgetElement.ChildNodes) + { + XmlElement obj=subNode as XmlElement; + switch (elementType(obj)) { + case ElementType.WidgetType: constructChild("this",obj,true); + widgetAdd("this",widgetElement,obj); + break; + case ElementType.LayoutType: constructChild("this",obj,true); + break; + default: break; + } + } + + } + + + private void widgetAdd(String parname,XmlElement par, XmlElement obj) + { + if (par==widgetElement) { + if (par.GetAttribute("class")=="QWizard") + { + writer.WriteLine("\t\tAddPage("+getName(obj)+", "+getName(obj)+".Caption());"); + } + } + else { + if (elementType(par)==ElementType.LayoutType) { + if (getLayoutType(par)=="grid") { + writer.WriteLine("\t\t"+getName(par)+insertIntoGrid("Widget",getName(obj),obj)); + } + else writer.WriteLine("\t\t"+parname+".Add("+getName(obj)+");"); + } + else switch(par.GetAttribute("class")) { + case "QTabWidget": writer.WriteLine("\t\t"+parname+".InsertTab("+getName(obj)+",\"\");"); + break; + default: break; + } + } + } + + + private String getLayoutType(XmlElement el) + { + String tmp=el.Name; + if (tmp=="widget") tmp=el.GetAttribute("uicsharp_type"); + return tmp; + } + + + private String insertIntoGrid(String what, String name, XmlElement obj) + { + String col,row,colspan,rowspan,endcol,endrow; + + int tmpcols=int.Parse( + (obj.GetAttribute("column")==String.Empty)? + "0":obj.GetAttribute("column"))+ + int.Parse((obj.GetAttribute("colspan")==String.Empty)? + "1":obj.GetAttribute("colspan"))-1; + + int tmprows=int.Parse( + (obj.GetAttribute("row")==String.Empty)? + "0":obj.GetAttribute("row"))+ + int.Parse((obj.GetAttribute("rowspan")==String.Empty)? + "1":obj.GetAttribute("rowspan"))-1; + + col=obj.GetAttribute("column"); + row=obj.GetAttribute("row"); + endcol=tmpcols.ToString(); + endrow=tmprows.ToString(); + if ((col==endcol) && (row==endrow)) + { + return ".Add"+what+"( "+name+", "+row + ", "+col +");"; + } + else + { + what=(what=="Item")?"":what; + return ".AddMultiCell"+what+"( "+name+", "+row+","+endrow+", "+col+", "+endcol+");"; + } + + } + + private void layoutAdd(XmlElement par, XmlElement obj) + { + String what=(getLayoutType(obj)=="spacer")?"Item":"Layout"; + if (getLayoutType(par)!="grid"){ + writer.WriteLine("\t\t"+getName(par)+".Add"+what+"("+getName(obj)+");"); + } + else + { + writer.WriteLine("\t\t"+getName(par)+insertIntoGrid(what,getName(obj),obj)); + } + } + + + void createSpacer(String name, XmlElement obj) { + String orientation; + String sizeType; + String shx,shy; + orientation=null; + sizeType=null; + shx=null; + shy=null; + foreach (XmlNode node in obj.ChildNodes) { + XmlElement el=node as XmlElement; + if (el.Name!="property") continue; + switch (el.GetAttribute("name")) { + case "orientation": orientation=(((el.FirstChild as XmlElement).InnerText).ToUpper()); + break; + case "sizeType" : sizeType=(((el.FirstChild as XmlElement).InnerText)); + break; + case "sizeHint" : foreach (XmlNode shn in (el.FirstChild as XmlElement).ChildNodes) { + XmlElement she=shn as XmlElement; + switch (she.Name) { + case "width": shx=she.InnerText; + break; + case "height": shy=she.InnerText; + break; + } + } + break; + } + } + writer.WriteLine("\t\tQSpacerItem {0}=new QSpacerItem({1},{2},{3},{4});", + name,shx,shy, + (orientation=="VERTICAL")?"Qt.QSizePolicy.SizeType.Minimum":("Qt.QSizePolicy.SizeType."+toPascal(sizeType)), + (orientation!="VERTICAL")?"Qt.QSizePolicy.SizeType.Minimum":("Qt.QSizePolicy.SizeType."+toPascal(sizeType))); + } + + int layoutcnt=1; + + XmlElement createLayout(String parent, XmlElement obj, ref String name, bool privateLayout) + { + name = ((name==String.Empty)?getName(obj):name); + if (name==String.Empty) + { + name="my_internal_Layout"+layoutcnt; + privateLayout=true; + layoutcnt++; + } + + if ((privateLayout) && (obj.Name!="widget")) + obj.SetAttribute("uicsharp_name",name); + + if ((obj.Name!="widget") && (obj.GetAttribute("uicsharp_parent")!=String.Empty)) + parent=obj.GetAttribute("uicsharp_parent"); + + switch (obj.Name) { + case "vbox": writer.WriteLine("\t\t"+(privateLayout?"QVBoxLayout ":"")+name+"= new QVBoxLayout("+ + ((parent==null)?"":parent)+");"); + setupLayout(name,obj); + return obj; + case "hbox": writer.WriteLine("\t\t"+(privateLayout?"QHBoxLayout ":"")+name+"= new QHBoxLayout("+ + ((parent==null)?"":parent)+");"); + setupLayout(name,obj); + return obj; + case "spacer": createSpacer(name,obj); + return obj; + case "widget": + foreach (XmlNode node in obj.ChildNodes) + { + if (elementType(node as XmlElement)==ElementType.LayoutType) { + (node as XmlElement).SetAttribute("uicsharp_margin","0"); + XmlElement el=createLayout(parent,node as XmlElement,ref name,true); + obj.SetAttribute("uicsharp_name",getName(el)); + obj.SetAttribute("uicsharp_type",el.Name); + return el; + } + } + return null; + case "grid": + int cols=1; + int rows=1; + foreach (XmlNode node in obj.ChildNodes){ + XmlElement elem=node as XmlElement; + ElementType etype=elementType(elem); + if ((etype==ElementType.LayoutType) || + (etype==ElementType.WidgetType)) { + Console.WriteLine("Grid size calculation group"); + int tmpcols=int.Parse( + (elem.GetAttribute("column")==String.Empty)? + "0":elem.GetAttribute("column"))+ + int.Parse((elem.GetAttribute("colspan")==String.Empty)? + "1":elem.GetAttribute("colspan"))-1; + + int tmprows=int.Parse( + (elem.GetAttribute("row")==String.Empty)? + "0":elem.GetAttribute("row"))+ + int.Parse((elem.GetAttribute("rowspan")==String.Empty)? + "1":elem.GetAttribute("rowspan"))-1; + + cols=(tmpcols<cols)?cols:tmpcols; + rows=(tmprows<rows)?rows:tmprows; + } + } + writer.WriteLine("\t\t"+ (privateLayout?"QGridLayout ":"")+name +"= new QGridLayout ("+ + ((parent==null)?"":(parent+", "))+rows+", "+cols+");"); + setupLayout(name,obj); + return obj; + } + + return obj; + + } + + + private void setupLayout(String name,XmlElement layout) + { + + String margin=layout.GetAttribute("uicsharp_margin"); + if (margin==String.Empty){ + foreach(XmlNode node in layout.ChildNodes) { + XmlElement el=node as XmlElement; + if ((el.Name=="property") && (el.GetAttribute("name")=="margin")) { + margin=(el.FirstChild as XmlElement).InnerText; + break; + } + } + } + if (margin==String.Empty) margin=defLayoutMargin; + + String spacing=layout.GetAttribute("uicsharp_spacing"); + if (spacing==String.Empty){ + foreach(XmlNode node in layout.ChildNodes) { + XmlElement el=node as XmlElement; + if ((el.Name=="property") && (el.GetAttribute("name")=="spacing")) { + margin=(el.FirstChild as XmlElement).InnerText; + break; + } + } + } + if (spacing==String.Empty) spacing=defLayoutSpacing; + + String alignment=layout.GetAttribute("uicsharp_alignment"); + if (alignment!=String.Empty) writer.WriteLine("\t\t{0}.SetAlignment({1});",name,alignment); + + writer.WriteLine("\t\t{0}.SetMargin({1});",name,margin); + writer.WriteLine("\t\t{0}.SetSpacing({1});",name,spacing); + } + + + private void widgetType(XmlElement obj, ref String typename, ref XmlElement subcontainer, bool write) + { + typename=obj.GetAttribute("class"); + if ((typename!="QGroupBox") && (typename!="ButtonGroup")) return; + foreach (XmlNode node in obj.ChildNodes) { + if (elementType(node as XmlElement)==ElementType.LayoutType) { + XmlElement el =node as XmlElement; +// subcontainer=el; + el.SetAttribute("uicsharp_type",el.Name); + el.SetAttribute("uicsharp_name",getName(obj)+"Layout"); + el.SetAttribute("uicsharp_parent",getName(obj)+".Layout()"); + el.SetAttribute("uicsharp_margin","0"); + el.SetAttribute("uicsharp_alignment","(int)Qt.AlignmentFlags.AlignTop"); + + switch (el.Name) { + case "vbox": typename="QGroupBox"; + if (write) + writer.WriteLine("\t\t QVBoxLayout "+el.GetAttribute("uicsharp_name")+";"); + return; + case "hbox": typename="QGroupBox"; + if (write) + writer.WriteLine("\t\t QHBoxLayout "+el.GetAttribute("uicsharp_name")+";"); + return; + case "grid": typename="QGroupBox"; + if (write) + writer.WriteLine("\t\t QGridLayout "+el.GetAttribute("uicsharp_name")+";"); + return; + + + } + } + } +// typename=null; + } + + private void specialInit(XmlElement el) + { + if (el.GetAttribute("class").EndsWith("GroupBox")) + writer.WriteLine("\t\t"+getName(el)+".SetColumnLayout(0,Qt.Orientation.Vertical);"); + } + + + private String toPascal(String data) + { + return System.Char.ToUpper(data[0]).ToString()+ data.Substring(1,data.Length-1); + } + + private String stringify(String data) + { + data=data.Replace("\"","\\\""); + data=data.Replace("\n","\\n"); + return data; + } + + + private String toBool(String data) + { + if ((data=="1") || (data=="true")) return "true"; else return "false"; + } + + private String generateSetProperty(String varName, String widgetClass, XmlElement prop) + { + if ((prop.GetAttribute("name")=="whatsThis") || (prop.GetAttribute("name")=="toolTip")) + { + String tmp="\t\tQ"+toPascal(prop.GetAttribute("name"))+".Add("+varName+", \""+ + stringify((prop.FirstChild as XmlElement).InnerText)+"\");"; + return tmp; + } + + String methodName="Set"+toPascal(prop.GetAttribute("name")); + String sc=methodName+" ("; + + XmlElement value=(prop.FirstChild as XmlElement); + + switch (value.Name) { + case "string" : if (prop.GetAttribute("name")!="accel") sc += "\""+stringify(value.InnerText)+"\""; + else sc+="new QKeySequence(\""+stringify(value.InnerText)+"\")"; + break; + case "cstring" : sc += value.InnerText; + break; + case "rect" : String rx=null,ry=null,rw=null,rh=null; + foreach (XmlNode srn in value.ChildNodes) { + XmlElement sre=srn as XmlElement; + switch (sre.Name) { + case "x" : rx=sre.InnerText; + break; + case "y" : ry=sre.InnerText; + break; + case "height" : rh=sre.InnerText; + break; + case "width" : rw=sre.InnerText; + break; + default: break; + } + } + if ((varName=="this") && (methodName=="SetGeometry")) + sc = "Resize ((new QSize("+rw+", "+rh+")).ExpandedTo(SizeHint())"; + else + sc += "new QRect("+rx+", "+ry+", "+rw+", "+rh+")"; + + break; + case "enum" : + try { + Type ct=qtAssembly.GetType("Qt."+widgetClass,true); + MemberInfo []mi=ct.GetMember(methodName); + ParameterInfo []pi=((MethodBase)mi[0]).GetParameters(); + String ptn=pi[0].ParameterType.FullName; + Console.WriteLine("Parameter Type Name: "+ptn); + ptn=ptn.Replace("+","."); + sc+=ptn+"."+toPascal(value.InnerText); + } + catch (Exception e) { + Console.WriteLine(e.Message+":"+widgetClass); + Console.WriteLine("ERROR DURING >ENUM TRANSLATION<"); + } + + break; + case "iconset" : sc += "new QIconSet("+value.InnerText+")"; + break; + case "bool" : sc += value.InnerText; + break; + case "font": String fvn=varName+"_Font"; + sc="\t\tQFont "+fvn+" = ("+varName+".Font());\n"; + foreach(XmlNode fn in value.ChildNodes) { + XmlElement fe=fn as XmlElement; + switch (fe.Name) { + case "pointsize": + sc+="\t\t"+fvn+".SetPointSize("+fe.InnerText+");\n"; + break; + case "bold": + sc+="\t\t"+fvn+".SetBold("+toBool(fe.InnerText)+");\n"; + break; + case "italic": + sc+="\t\t"+fvn+".SetItalic("+toBool(fe.InnerText)+");\n"; + break; + case "underline": + sc+="\t\t"+fvn+".SetUnderline("+toBool(fe.InnerText)+");\n"; + break; + case "strikeout": + sc+="\t\t"+fvn+".SetStrikeOut("+toBool(fe.InnerText)+");\n"; + break; + } + } + sc +="\t\t"+varName+".SetFont("+fvn+");"; + return sc; + default: Console.WriteLine("Not yet supported property type : "+value.Name); + return String.Empty; + } + + sc += " )"; + return "\t\t"+varName+"."+sc+";"; + + } + + + private void setProperties(XmlElement obj) + { + String myWidgetClass=null; + XmlElement dummy=null; + + widgetType(obj, ref myWidgetClass, ref dummy,false); + + foreach (XmlNode node in obj.ChildNodes) { + XmlElement prop = node as XmlElement; + if (prop.Name!="property") continue; + if (prop.GetAttribute("name")=="buddy") { + buddyList+="\n"+generateSetProperty(getName(obj),myWidgetClass,prop); + continue; + } + if (prop.GetAttribute("name")=="name") continue; + String str=generateSetProperty((obj==widgetElement)?"this":getName(obj),myWidgetClass,prop); + if (str!=String.Empty) writer.WriteLine(str); + } + } + + + private void constructChild(String parent,XmlElement obj,bool mainLayout) + { + ElementType mytype=elementType(obj); + String myname=getName(obj); + XmlElement lobj=null; + switch (mytype){ + case ElementType.WidgetType: + String widgettype=null; + XmlElement tmpobj=null; + widgetType(obj,ref widgettype,ref tmpobj,true); + mainLayout=true; + XmlElement origNode=obj; + if (tmpobj!=null) { + mytype=ElementType.LayoutType; + lobj=obj; + obj=tmpobj; + mainLayout=false; + } + writer.WriteLine("\t\t"+myname+"=new "+widgettype + +"("+parent+", \""+myname+"\");"); + specialInit(origNode); + setProperties(origNode); + parent=myname; + break; + case ElementType.LayoutType: + lobj=obj; + myname=""; + obj=createLayout(mainLayout?parent:null,obj,ref myname,false); + mainLayout=false; + break; + default: return; + } + + foreach (XmlNode subNode in obj.ChildNodes) + { + XmlElement subObj=subNode as XmlElement; + switch (elementType(subObj)) { + case ElementType.WidgetType: constructChild(parent,subObj,mainLayout); + widgetAdd(myname,obj,subObj); + break; + case ElementType.LayoutType: constructChild(parent,subObj,mainLayout); + if (mytype==ElementType.LayoutType) layoutAdd(lobj,subObj); + break; + default: break; + } + } + + } + + + private void writeMain() + { + writer.WriteLine("\tpublic static void Main (String[] args)\n"+ + "\t{\n"+ + "\t\tQApplication app = new QApplication (args);\n"+ + "\t\t"+className+" test = new "+className+" (null,\"\");\n"+ + "\t\tapp.SetMainWidget (test);\n"+ + "\t\ttest.Show ();\n"+ + "\t\tapp.Exec ();\n"+ + "\t}"); + } + } +} |