From 90825e2392b2d70e43c7a25b8a3752299a933894 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- qtsharp/src/uicsharp/Makefile.am | 21 + qtsharp/src/uicsharp/tests/form1.ui | 43 ++ qtsharp/src/uicsharp/tests/form10.ui | 131 +++++ qtsharp/src/uicsharp/tests/form2.ui | 138 ++++++ qtsharp/src/uicsharp/tests/form3.ui | 206 ++++++++ qtsharp/src/uicsharp/tests/form4.ui | 224 +++++++++ qtsharp/src/uicsharp/tests/form5.ui | 450 +++++++++++++++++ qtsharp/src/uicsharp/tests/form6.ui | 167 +++++++ qtsharp/src/uicsharp/tests/form7.ui | 339 +++++++++++++ qtsharp/src/uicsharp/tests/form8.ui | 75 +++ qtsharp/src/uicsharp/tests/form9.ui | 211 ++++++++ qtsharp/src/uicsharp/uicsharp.build | 15 + qtsharp/src/uicsharp/uicsharp.cs | 934 +++++++++++++++++++++++++++++++++++ 13 files changed, 2954 insertions(+) create mode 100644 qtsharp/src/uicsharp/Makefile.am create mode 100644 qtsharp/src/uicsharp/tests/form1.ui create mode 100644 qtsharp/src/uicsharp/tests/form10.ui create mode 100644 qtsharp/src/uicsharp/tests/form2.ui create mode 100644 qtsharp/src/uicsharp/tests/form3.ui create mode 100644 qtsharp/src/uicsharp/tests/form4.ui create mode 100644 qtsharp/src/uicsharp/tests/form5.ui create mode 100644 qtsharp/src/uicsharp/tests/form6.ui create mode 100644 qtsharp/src/uicsharp/tests/form7.ui create mode 100644 qtsharp/src/uicsharp/tests/form8.ui create mode 100644 qtsharp/src/uicsharp/tests/form9.ui create mode 100644 qtsharp/src/uicsharp/uicsharp.build create mode 100644 qtsharp/src/uicsharp/uicsharp.cs (limited to 'qtsharp/src/uicsharp') 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 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + unnamed + + + + LineEdit1 + + + + + PushButton1 + + + PushButton1 + + + + + TextLabel1 + + + TextLabel1 + + + + + + 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 @@ + +Form2 + + + Form2 + + + + 0 + 0 + 600 + 480 + + + + + WidgetStack1 + + + + 70 + 80 + 357 + 301 + + + + + page + + + 0 + + + + unnamed + + + + CheckBox2 + + + CheckBox2 + + + + + RadioButton2 + + + RadioButton2 + + + + + + + page + + + 1 + + + + unnamed + + + + + Column 1 + + + true + + + true + + + + + New Item + + + + + + + ListView1 + + + + + Table1 + + + 3 + + + 3 + + + + + + + page + + + 2 + + + + unnamed + + + + Table2 + + + 3 + + + 3 + + + + + + + + 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 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + unnamed + + + + GroupBox1 + + + GroupBox1 + + + + unnamed + + + + CheckBox1 + + + CheckBox1 + + + + + CheckBox2 + + + CheckBox2 + + + + + CheckBox3 + + + CheckBox3 + + + + + CheckBox4 + + + CheckBox4 + + + + + CheckBox5 + + + CheckBox5 + + + + + CheckBox6 + + + CheckBox6 + + + + + CheckBox7 + + + CheckBox7 + + + + + CheckBox8 + + + CheckBox8 + + + + + CheckBox9 + + + CheckBox9 + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + + LineEdit1 + + + + + + New Item + + + + ListBox1 + + + + + + + + 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 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + unnamed + + + + Layout1 + + + + unnamed + + + + GroupBox1 + + + GroupBox1 + + + + unnamed + + + + CheckBox1 + + + CheckBox1 + + + + + CheckBox2 + + + CheckBox2 + + + + + CheckBox3 + + + CheckBox3 + + + + + CheckBox4 + + + CheckBox4 + + + + + CheckBox5 + + + CheckBox5 + + + + + CheckBox6 + + + CheckBox6 + + + + + CheckBox7 + + + CheckBox7 + + + + + CheckBox8 + + + CheckBox8 + + + + + CheckBox9 + + + CheckBox9 + + + + + + + GroupBox2 + + + GroupBox2 + + + + unnamed + + + + PushButton1 + + + PushButton1 + + + + + PushButton2 + + + PushButton2 + + + + + + + GroupBox3 + + + GroupBox3 + + + + unnamed + + + + PushButton3 + + + PushButton3 + + + + + PushButton4 + + + PushButton4 + + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + + LineEdit1 + + + + + + New Item + + + + ListBox1 + + + + + + + + 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 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + unnamed + + + + Layout1 + + + + unnamed + + + + GroupBox1 + + + GroupBox1 + + + + unnamed + + + + CheckBox1 + + + CheckBox1 + + + + + CheckBox2 + + + CheckBox2 + + + + + CheckBox3 + + + CheckBox3 + + + + + CheckBox4 + + + CheckBox4 + + + + + CheckBox5 + + + CheckBox5 + + + + + CheckBox6 + + + CheckBox6 + + + + + CheckBox7 + + + CheckBox7 + + + + + CheckBox8 + + + CheckBox8 + + + + + CheckBox9 + + + CheckBox9 + + + + + + + GroupBox2 + + + GroupBox2 + + + + unnamed + + + + PushButton1 + + + PushButton1 + + + + + PushButton2 + + + PushButton2 + + + + + + + GroupBox3 + + + GroupBox3 + + + + unnamed + + + + PushButton3 + + + PushButton3 + + + + + Layout2 + + + + unnamed + + + + CheckBox10 + + + CheckBox10 + + + + + CheckBox11 + + + CheckBox11 + + + + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + + LineEdit1 + + + + + + New Item + + + + ListBox1 + + + + + + + + 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 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + + menubar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + toolBar + + + Tools + + + + + + + + + + + + + + + + fileNewAction + + + image0 + + + New + + + &New + + + Ctrl+N + + + + + fileOpenAction + + + image1 + + + Open + + + &Open... + + + Ctrl+O + + + + + fileSaveAction + + + image2 + + + Save + + + &Save + + + Ctrl+S + + + + + fileSaveAsAction + + + Save As + + + Save &As... + + + + + + + + filePrintAction + + + image3 + + + Print + + + &Print... + + + Ctrl+P + + + + + fileExitAction + + + Exit + + + E&xit + + + + + + + + editUndoAction + + + image4 + + + Undo + + + &Undo + + + Ctrl+Z + + + + + editRedoAction + + + image5 + + + Redo + + + &Redo + + + Ctrl+Y + + + + + editCutAction + + + image6 + + + Cut + + + &Cut + + + Ctrl+X + + + + + editCopyAction + + + image7 + + + Copy + + + C&opy + + + Ctrl+C + + + + + editPasteAction + + + image8 + + + Paste + + + &Paste + + + Ctrl+V + + + + + editFindAction + + + image9 + + + Find + + + &Find... + + + Ctrl+F + + + + + helpContentsAction + + + Contents + + + &Contents... + + + + + + + + helpIndexAction + + + Index + + + &Index... + + + + + + + + helpAboutAction + + + About + + + &About + + + + + + + + + 789cedd2b10ac2301405d03d5ff148b62056035241fc04c5511087f425a2432b681d44fc777ba329d6b47fe07d19dee50cc9904cd376b3229d896b6deb13131fed85b4bb95e57db75f3e8434869a93d3548e841c13d3fa5c79ecaad9d52404b540351e83caa833c6a03ad4798e41f5a86c30a816f510126ee94d14d52611fb8e2ad49070a4445ca4447ca4446ca444da07fecac7ffd2956ebe64f81ff4c873215e0583a9b0 + + + 789cad914d0ac2301085f739c5d0d915b11a140ae211149782b898448b2e5a41eb42c4bb9b9fa6a67644045f0299978f37134896c27ab5803413979aeaa3067da033a4bb6b59de36dbf95d245282d953182703910c41c3f254ed6d8da6c69193b5dada7c924b6fc9dac2c85b156c51b83eacfe41d0c89defc4dfa2dd7c37fc44b025a179043c4152a4b055f4365414ad0e8901fd94c1ae5e19441da9211c68e7f44098d3074d86019e70a0210c089958df7ffb31134fa13797a8 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022530543251d2e253d856405bffcbc54105b19c856360003103711c4b530b13082709340dc644310047193c1dcc424d314883958015846190b80ca24262a2721012087349964a030ba69c9c9303d403e9132087b68279388ecff4414193440948c32aa71d86470bb80863258a21b9a0eb0a7905a6b2e006d59a436 + + + 789c7d944973db461085effa152cf54d956a932089a55239c896572d96bcc4b253390033186ea2488aa416a7f2dfd3db0cbd44e6d340f8f8def43406209e1c742ecf4f3b074ff6d69b7a33711d37ae6f3a077e3b9f3ffcf5f71fffeced675987fecab293edffb6b77fb1e9b8ced9e2ba65c08c00baf2117e2f5c86d02d99e196b9d7ed963df53f2ab3c47789258fa7c26564688d4bf30f23673de113e6ac1719ae9459e27f4d5c893f17ae126f8d2be3ebc87d9dff4e3904f317ccfd5ef23f28b3c45f26963c7e510ec1fc9570157dd81857967f883c90cd8635f3208b8c0b6596f863e17a500fd597fe8744c35afc1be33aef8bff5ad9b5e637cc7993f7f346fca571637c1fb9d0f99f9543b07ab2df453ff9723d0551a1f3d791cb8170573904f3a5bf725034e66f133be96fa44c1246799e4a573495e461a29cfcbbc8e64f8d9df96564f5519e876a1019668975fda05c593d5c25d67a6f945d6ef3bdb08b3ed491eba1e467c6561fcf229bff4ad9b5c6c7ccf530fa8089bdf8136596703fb1f800c23ee5ff548e3e7a636f3c8ddc68bd8ab91926066596b05c5fe359c285b2cf8de5f7ed7296f050b825d6f74763dc1a0f227bcdbf60f679e29789353f5666093f4facfe857208e63f156e93df8bdc16c223e358ff28b2f939735b240eca2ce1678983f0a57208e6bf150ec96f8d83f127e650b084cf85e5a32fdf9d10b0c6c6e44835c9631dfd9ff235b618925ad1e89779278af5750df7681ea40316d8111eef876a79ad977ae773d8257ec8efead629fdeb3ca4ba9ae6e11fcdbbef6aa72b7934ef695702eddf4e631a13d2f4c73cd599e115f533a639bbc173e6788d0b5cf23a314fe915dee01a37df698bb77887f7f8805ff190e64c342fb59fe2333ca2e373d30b7c89aff035bec1634a9e904ef1417faf78866ff1fc275de03b7c4fa3a1553e50fd8f78a2ef0bfcf43fe973bcc4cff805bb74d6a3de0e31b37c9f561fe090c6583a19612e9d1dd179417db1575237191eeafb172b9cd22a7d409a7bcc8f0c4e68f01900ef44090db8547f4ee9a966456732445083078f779a8756dfdf52f19b1cd59c699254e31c46d0703f30b6fa5239a5d27faabc22b78409de838316bdd51fd1377730a531a12bd363c949aa3d936f1a6821e8fda566aef8fe011d612eba860569495a9196721ebe7d7ed0c30dac491b58d2bd21c116b634bf25ddd2fd9dd9f3f6efef7bff0111915e41 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c8563600020b13103711c4b530b1308270f5b082019251068344848c32b23808206494a1e23015890819653db8b81e44255c0659025d460fa70c6e3d78ec814b21b90d052422fb070540f50ebaf84196a9b5e6020011bc73cc + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54103b11c8563600020b13105719c4b530b1308270f5b0027acb28278201a64c221c4084136132ca7011885c225c06c91890542256193d98a198327a386570ea49449581bb4d2f114d0624a08c230c50fd4f5cb80da04cad351700f7fd8672 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c856360003103711c6b53002abc40a90649491482ac92863955146d6822ca387474619c9301419a03842825819245bd064129513b1cb242602512216994430d44bc4904984c8c1a5e032897a3019a8144c26518f800c92715864d0ec81ab4dc4701b924fb0850e8a4cad351700fbd07ccb + + + 789c9d92cb0ac2301045f7f98aa1d915b1da8214c44f505c0ae26226b1e8a20a5a1722febb9924a5af58c19b40e77238a1842431ecb66b881371afb03a2b5027bc41ac1f65f9dc1f562f11a52998bd80793411d114146cae9723cfd2cc7266c395ea9aa75c15d74c65aad05c35d79c727215b91636f6d860c689f40910b4e92147d840b3be39d8416d877c860eb9af478d23919c4b8a7a0ed68eb628e4a04521c7fd46c07138e47448dbf1f32fc767e8d43735741af287d3ced83b782fc5075b18a5a5 + + + 789c7d92d10a82301486eff714c3dd49649984103d42d165105dcce3465d58507611d1bbb773d674aed93f85fd7efb183ab394ef771b9e66ecdecaf60c1c4ef2c6d3fad134cfc371fd62499e7373957c9e4c5832e5c0b7d78bc2b9307331a36055ae960556c05a16656e69e5aaa5355658c202965825566d62176b57b5a64da3f188c084841e0a29a5e831910ef8885e4854501922e8a6b923586a176a8e40051ec1e63b7d0267387c6738424775091d653f98565a858e26c110447107d1886350d4a1c41c3dea7864e87c37f3ce47fc3aee7cd5207ffe90f78a7d0007c6c175 + + + 789cb5d5594f1b491007f0773e8545bda1d53ff81a7bb4da07830103b603b92059edc34cf78c0ff0812f3051befb5677554f56c24428d2aa78e0a7aeaeea6be0dd41e9f6aa573a78b7b75c25ab91299961b2281dd8f564b2fdfb9fbfbeefed572a25fe291f46a5cafe1f7bfbd7ab9229f567d3cc81fa0caa945d785f78c72ebc2f9dabb10bef9e73ade2c21913e77ae2c28f2fc48d6a947ab7c4b169d6bc8f9ca3aa0b3fbfaf4e35ff4c5cccdf8813db34de1def34e4c3881b3cc38fb7d5a918f78525ff46dcaca9576a23a627715cd3f53e8a131b7b63edecba69fd8d3af41b1496fa6d7153f78f86b8a86f0bcbfe9ec5493d16cfc5695dfad34c6d651ca9f7cffdbd173743fd441cd64f0f85a5fe489c6a3fd4d5613c0d4eeade43b189747c1b2ce3683abbeebadf5a702ae343716c743d53313f1febc7bfa843bf1371581f9d06ebf8581df257e2b01eba57675a5fea19177e7c109cfa712271aceba58938b13a6ec4a13fba62ee27f53fa9b51fe5c1ba7f7f1f71cd85f7545cdcf73ad8f8ef137762de9fd4ef898b7e51b0d63f52877e65b10de3c785657eacced4fe7b77b763236fab36fa3e1ec5a9d5f341b0e4d3526c42bd4ab0eee7505cf4fb28ce1aea6fc146fa7f76e6d3e115fafa5d7112cebf254eeb328e6a70967b9f8b437fba13db4ceb2fc5453f7f5ffcfac2795f046bbd0fe2a2df486c42bd2bb18dd46375e89f89b99fccf7ef2dadbbf0eea8add6bf16db4cbd1067b9de8fafc7b7a1ef13cf6213e50defadd846b9acff569c3574fe833ad7fa5fc57943cfdb9f9f894cd8cf93982748fdb9386f64dee4df97c978ff52ef4c9d69ff9938cff53cfdf7ec5627f5ae576f8fdfcf0721410ac391c222fb753e720c30c408638e3bdcf31c7a3d9fb3279862c631c70316586285f5ae1e727fd8e091f3e678c216cf68e108c768e3e4957ccb2b39e5fc337470ce71814b74d143ffe59ae4ff01ae7825d7f8c0753fe213d7ff8c2ffcfb0deccefc016ef115df380e51460555d4504784069aafe48f798f87885126a04a4409a564c8be92bfc115655cb94c395a34409d8634a231afe7c58ee5ef35d7bae3dc2eddd384a634a339c7032d90efcce7bba225ad38525aa3461b7ae478da75037a5f2758d196525ec93359aedde23882a563ae95edc8cf90529b4ee894c6bcf2844f66e2ce1239cf9afc7755c5fbc9b8479fdabcc71b3aa38ee4d039d7b9a04b1ecb5ebe677ea1964712ead2f9cf8aac1ecfd10a6f79ffdc7b4d7dee92bcfd7be1bd5ff29ccedbbf2f90dbfbfffefdfef873ef5fce01d04a + + + + + fileNewAction + activated() + Form1 + fileNew() + + + fileOpenAction + activated() + Form1 + fileOpen() + + + fileSaveAction + activated() + Form1 + fileSave() + + + fileSaveAsAction + activated() + Form1 + fileSaveAs() + + + filePrintAction + activated() + Form1 + filePrint() + + + fileExitAction + activated() + Form1 + fileExit() + + + editUndoAction + activated() + Form1 + editUndo() + + + editRedoAction + activated() + Form1 + editRedo() + + + editCutAction + activated() + Form1 + editCut() + + + editCopyAction + activated() + Form1 + editCopy() + + + editPasteAction + activated() + Form1 + editPaste() + + + editFindAction + activated() + Form1 + editFind() + + + helpIndexAction + activated() + Form1 + helpIndex() + + + helpContentsAction + activated() + Form1 + helpContents() + + + helpAboutAction + activated() + Form1 + helpAbout() + + + + fileNew() + fileOpen() + fileSave() + fileSaveAs() + filePrint() + fileExit() + editUndo() + editRedo() + editCut() + editCopy() + editPaste() + editFind() + helpIndex() + helpContents() + helpAbout() + + + 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 @@ + +MyDialog + + + MyDialog + + + + 0 + 0 + 594 + 470 + + + + true + + + + unnamed + + + + Splitter1 + + + Vertical + + + + + Column 1 + + + true + + + true + + + + + New Item + + + + + + + ListView1 + + + + + + New Item + + + image0 + + + + IconView1 + + + + + + Layout5 + + + + unnamed + + + 0 + + + 6 + + + + buttonOk + + + &OK + + + + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + + + + true + + + + + buttonHelp + + + &Help + + + F1 + + + true + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + 789c7dd3c14ac4301405d07dbf22f4ed8a743ace0882f8098a4b415ca4c92475310a3a2e44fc777393a64df2dabed7452e1c6eb368778d787e7a10cdaefabac8cb9b126a909fa2d1dfe7f3cfcbebfd6f551fae857bf69dd8d75755dd0a251e3fde4f38933b53e707b10f518df18478e8b08803e271c21af1e6168b681165e7f688681055874594211a13a242347efc95da9688dad58946ca75e58d6be9e5ba0a46e92d351a952aa2d3b2495459989849f949546632b5688c32c65aeadde428ed0132da23306e4c5863f1ba017042738f6fc138a5fdbd0a135b2203ec7bca7b723022e23d19628601cb0d6f59e8612dce0c2b2641658fb5650b375a0795a2c2b8afcaaba4859ba852c4cda4364da9964daed64caa60c2475d9a590503c54d54d1d0a2096abb67541bf79955fc0debbfbbea1f81b84f0e + + + + + buttonOk + clicked() + MyDialog + accept() + + + buttonCancel + clicked() + MyDialog + reject() + + + + 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 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + GroupBox3 + + + + 382 + 12 + 206 + 150 + + + + GroupBox3 + + + + PushButton3 + + + + 11 + 30 + 82 + 26 + + + + PushButton3 + + + + + CheckBox10 + + + + 100 + 21 + 94 + 19 + + + + CheckBox10 + + + + + CheckBox11 + + + + 100 + 46 + 94 + 19 + + + + CheckBox11 + + + + + + GroupBox1 + + + + 12 + 12 + 202 + 150 + + + + GroupBox1 + + + + CheckBox1 + + + + 11 + 20 + 87 + 19 + + + + CheckBox1 + + + + + CheckBox2 + + + + 11 + 45 + 87 + 19 + + + + CheckBox2 + + + + + CheckBox3 + + + + 11 + 70 + 87 + 19 + + + + CheckBox3 + + + + + CheckBox4 + + + + 11 + 95 + 87 + 19 + + + + CheckBox4 + + + + + CheckBox5 + + + + 104 + 20 + 87 + 19 + + + + CheckBox5 + + + + + CheckBox6 + + + + 104 + 70 + 87 + 19 + + + + CheckBox6 + + + + + CheckBox7 + + + + 104 + 95 + 87 + 19 + + + + CheckBox7 + + + + + CheckBox8 + + + + 104 + 120 + 87 + 19 + + + + CheckBox8 + + + + + CheckBox9 + + + + 11 + 120 + 87 + 19 + + + + CheckBox9 + + + + + + GroupBox2 + + + + 220 + 12 + 156 + 150 + + + + GroupBox2 + + + + PushButton1 + + + + 11 + 20 + 134 + 26 + + + + PushButton1 + + + + + PushButton2 + + + + 11 + 52 + 134 + 26 + + + + PushButton2 + + + + + + Frame3 + + + + 11 + 169 + 578 + 300 + + + + StyledPanel + + + Raised + + + + LineEdit1 + + + + 11 + 139 + 275 + 22 + + + + + + + New Item + + + + ListBox1 + + + + 292 + 11 + 275 + 278 + + + + + + + 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 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + PushButton1 + + + + 100 + 70 + 161 + 51 + + + + PushButton1 + + + + + RadioButton1 + + + + 100 + 130 + 96 + 20 + + + + RadioButton1 + + + + + CheckBox1 + + + + 60 + 170 + 131 + 41 + + + + + Century Schoolbook l [Urw] + 34 + 1 + 1 + 1 + 1 + + + + CheckBox1 + + + + + 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 @@ + +MyDialog1 + + + MyDialog1 + + + + 0 + 0 + 528 + 368 + + + + true + + + + unnamed + + + 11 + + + 6 + + + + tabWidget + + + + Widget8 + + + Tab + + + + ComboBox1 + + + + 27 + 75 + 61 + 21 + + + + + + + New Item + + + + ListBox1 + + + + 187 + 65 + 88 + 60 + + + + + + TextLabel1 + + + + 77 + 145 + 131 + 41 + + + + TextLabel1 + + + + + + Widget9 + + + Tab + + + + unnamed + + + + + New Item + + + + ListBox2 + + + + + TextEdit1 + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + F1 + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + + + + true + + + + + + + + + buttonOk + clicked() + MyDialog1 + accept() + + + buttonCancel + clicked() + MyDialog1 + reject() + + + + 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 @@ + + + + + + + + + + + + + + + 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=(tmpcolsENUM 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}"); + } + } +} -- cgit v1.2.1